Debian Codegraph @

kernel/float64_31.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 external mul : float -> float -> float = "rocq_fmul_byte" "rocq_fmul"
14 [@@unboxed] [@@noalloc]
15
16 external add : float -> float -> float = "rocq_fadd_byte" "rocq_fadd"
17 [@@unboxed] [@@noalloc]
18
19 external sub : float -> float -> float = "rocq_fsub_byte" "rocq_fsub"
20 [@@unboxed] [@@noalloc]
21
22 external div : float -> float -> float = "rocq_fdiv_byte" "rocq_fdiv"
23 [@@unboxed] [@@noalloc]
24
25 external sqrt : float -> float = "rocq_fsqrt_byte" "rocq_fsqrt"
26 [@@unboxed] [@@noalloc]
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."