Debian Codegraph @

kernel/float64_common.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 = float
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 (** Link with integers *)
67 val of_uint63 : Uint63.t -> t
68
69 val normfr_mantissa : t -> Uint63.t
70
71 (** Shifted exponent extraction *)
72 val eshift : int
73
74 val frshiftexp : t -> t * Uint63.t (* float remainder, shifted exponent *)
75
76 val ldshiftexp : t -> Uint63.t -> t
77
78 val next_up : t -> t
79
80 val next_down : t -> t
81
82 (** Return true if two floats are equal.
83 * All NaN values are considered equal. *)
84 val equal : t -> t -> bool
85
86 val hash : t -> int
87
88 (** Total order relation over float values. Behaves like [Pervasives.compare].*)
89 val total_compare : t -> t -> int
90
91 val is_float64 : Obj.t -> bool