Module CCFloat
Basic operations on floating-point numbers
- since
- 0.6.1
type t= floattype fpclass= CCShims_.Stdlib.fpclass=|FP_normal|FP_subnormal|FP_zero|FP_infinite|FP_nan
val nan : tEqual to
Stdlib.nan.
val max_value : tPositive infinity. Equal to
Stdlib.infinity.
val min_value : tNegative infinity. Equal to
Stdlib.neg_infinity.
val max_finite_value : tEqual to
Stdlib.max_float.
val epsilon : tThe smallest positive float x such that
1.0 +. x <> 1.0. Equal toStdlib.epsilon_float.
val is_nan : t -> boolis_nan freturnstrueif f is NaN,falseotherwise.
val pp : t printerval hash : t -> intval random : t -> t random_genval random_small : t random_genval random_range : t -> t -> t random_genval fsign : t -> tfsign xis one of-1., -0., +0., +1., ornanifxis NaN.- since
- 0.7
val sign_exn : t -> intsign_exn xwill return the sign ofxas1, 0or-1, or raise an exceptionTrapNaNifxis NaN. Note that infinities have defined signs in OCaml.- since
- 0.7
val to_int : t -> intAlias to
int_of_float. Unspecified if outside of the range of integers.
val of_int : int -> tAlias to
float_of_int.
val to_string : t -> stringval of_string_exn : string -> tAlias to
float_of_string.- raises Failure
in case of failure.
- since
- 1.2
val of_string : string -> tval equal_precision : epsilon:t -> t -> t -> boolEquality with allowed error up to a non negative epsilon value.
val classify : t -> fpclassReturn the class of the given floating-point number: normal, subnormal, zero, infinite or nan (not a number).
Infix Operators
- since
- 0.17
module Infix : sig ... end