Debian Codegraph @

kernel/float64_63.ml

raw symbols SCIP
1 (************************************************************************)
2 (* * The Rocq Prover / The Rocq Development Team *)
3 (* v * Copyright INRIA, CNRS and contributors *)
4 (* <O___,, * (see version control and CREDITS file for authors & dates) *)
5 (* \VV/ **************************************************************)
6 (* // * This file is distributed under the terms of the *)
7 (* * GNU Lesser General Public License Version 2.1 *)
8 (* * (see LICENSE file for the text of the license) *)
9 (************************************************************************)
10
11 include Float64_common
12
13 let mul (x : float) (y : float) : float = x *. y
14 [@@ocaml.inline always]
15
16 let add (x : float) (y : float) : float = x +. y
17 [@@ocaml.inline always]
18
19 let sub (x : float) (y : float) : float = x -. y
20 [@@ocaml.inline always]
21
22 let div (x : float) (y : float) : float = x /. y
23 [@@ocaml.inline always]
24
25 let sqrt (x : float) : float = sqrt x
26 [@@ocaml.inline always]
27
28 (*** Test at runtime that no harmful double rounding seems to
29 be performed with an intermediate 80 bits representation (x87). *)
30 let () =
31 let b = ldexp 1. 53 in
32 let s = add 1. (ldexp 1. (-52)) in
33 if add b s <= b || add b 1. <> b || ldexp 1. (-1074) <= 0. then
34 failwith "Detected non IEEE-754 compliant architecture (or wrong \
35 rounding mode). Use of Float is thus unsafe."