Debian Codegraph @

kernel/float64.mli

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 (** [t] is currently implemented by OCaml's [float] type.
12
13 Beware: NaNs have a sign and a payload, while they should be
14 indistinguishable from Rocq's perspective. *)
15 type t
16
17 (** Test functions for special values to avoid calling [classify] *)
18 val is_nan : t -> bool
19 val is_infinity : t -> bool
20 val is_neg_infinity : t -> bool
21
22 val of_string : string -> t
23
24 (** Print a float exactly as an hexadecimal value (exact decimal
25 * printing would be possible but sometimes requires more than 700
26 * digits). *)
27 val to_hex_string : t -> string
28
29 (** Print a float as a decimal value. The printing is not exact (the
30 * real value printed is not always the given floating-point value),
31 * however printing is precise enough that forall float [f],
32 * [of_string (to_decimal_string f) = f]. *)
33 val to_string : t -> string
34
35 val compile : t -> string
36
37 val of_float : float -> t
38
39 (** All NaNs are normalized to [Stdlib.nan].
40 @since 8.15 *)
41 val to_float : t -> float
42
43 (** Return [true] for "-", [false] for "+". *)
44 val sign : t -> bool
45
46 val opp : t -> t
47 val abs : t -> t
48
49 type float_comparison = FEq | FLt | FGt | FNotComparable
50
51 val eq : t -> t -> bool
52
53 val lt : t -> t -> bool
54
55 val le : t -> t -> bool
56
57 (** The IEEE 754 float comparison.
58 * NotComparable is returned if there is a NaN in the arguments *)
59 val compare : t -> t -> float_comparison
60
61 type float_class =
62 | PNormal | NNormal | PSubn | NSubn | PZero | NZero | PInf | NInf | NaN
63
64 val classify : t -> float_class
65
66 val mul : t -> t -> t
67
68 val add : t -> t -> t
69
70 val sub : t -> t -> t
71
72 val div : t -> t -> t
73
74 val sqrt : t -> t
75
76 (** Link with integers *)
77 val of_uint63 : Uint63.t -> t
78
79 val normfr_mantissa : t -> Uint63.t
80
81 (** Shifted exponent extraction *)
82 val eshift : int
83
84 val frshiftexp : t -> t * Uint63.t (* float remainder, shifted exponent *)
85
86 val ldshiftexp : t -> Uint63.t -> t
87
88 val next_up : t -> t
89
90 val next_down : t -> t
91
92 (** Return true if two floats are equal.
93 * All NaN values are considered equal. *)
94 val equal : t -> t -> bool
95
96 val hash : t -> int
97
98 (** Total order relation over float values. Behaves like [Pervasives.compare].*)
99 val total_compare : t -> t -> int
100
101 val is_float64 : Obj.t -> bool