forked from ocaml/ocaml
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathnumbers.mli
118 lines (85 loc) · 3.38 KB
/
numbers.mli
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
(**************************************************************************)
(* *)
(* OCaml *)
(* *)
(* Pierre Chambart, OCamlPro *)
(* Mark Shinwell and Leo White, Jane Street Europe *)
(* *)
(* Copyright 2013--2016 OCamlPro SAS *)
(* Copyright 2014--2016 Jane Street Group LLC *)
(* *)
(* All rights reserved. This file is distributed under the terms of *)
(* the GNU Lesser General Public License version 2.1, with the *)
(* special exception on linking described in the file LICENSE. *)
(* *)
(**************************************************************************)
(** Modules about numbers, some of which satisfy {!Identifiable.S}.
{b Warning:} this module is unstable and part of
{{!Compiler_libs}compiler-libs}.
*)
module Int : sig
include Identifiable.S with type t = int
(** [zero_to_n n] is the set of numbers \{0, ..., n\} (inclusive). *)
val zero_to_n : int -> Set.t
end
module Int8 : sig
type t
val zero : t
val one : t
val of_int_exn : int -> t
val to_int : t -> int
end
module Int16 : sig
type t
val of_int_exn : int -> t
val of_int64_exn : Int64.t -> t
val to_int : t -> int
end
module Float : Identifiable.S with type t = float
module Float_by_bit_pattern : sig
(** Floating point numbers whose comparison and equality relations are
the usual [Int64] relations on the bit patterns of the floats. This
in particular means that different representations of NaN will be
distinguished, as will the two signed zeros.
Never use [Stdlib.compare] on values of type [t]. Use either
[compare] (comparison on bit patterns) or [IEEE_semantics.compare]
depending on which semantics you want. Likewise for equality.
*)
include Identifiable.S
val create : float -> t
val of_bits : Int64.t -> t
val of_string : string -> t
val to_float : t -> float
val one : t
val zero : t
val minus_one : t
val is_either_zero : t -> bool
val is_any_nan : t -> bool
module IEEE_semantics : sig
val add : t -> t -> t
val sub : t -> t -> t
val mul : t -> t -> t
val div : t -> t -> t
val mod_ : t -> t -> t
val neg : t -> t
val abs : t -> t
val compare : t -> t -> int
val equal : t -> t -> bool
end
module Pair : Identifiable.S with type t = t * t
val cross_product : Set.t -> Set.t -> Pair.Set.t
end
module Int32 : sig
include module type of struct include Int32 end
include Identifiable.S with type t := Int32.t
val swap_byte_endianness : t -> t
module Pair : Identifiable.S with type t = t * t
val cross_product : Set.t -> Set.t -> Pair.Set.t
end
module Int64 : sig
include module type of struct include Int64 end
include Identifiable.S with type t := Int64.t
val swap_byte_endianness : t -> t
module Pair : Identifiable.S with type t = t * t
val cross_product : Set.t -> Set.t -> Pair.Set.t
end