package codex

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Module Framac_ival.Fc_floatSource

Implementation of floating-point values of different precision, using the standard ocaml floating-point numbers in double precision. Long_Double and Real are inexact.

include Float_sig.S with type t = float
Sourcetype t = float
Sourceval hash : t -> int
Sourceval pretty : Format.formatter -> t -> unit
Sourceval is_exact : Float_sig.prec -> bool

Is the representation of floating-point numbers of a given precision exact? Should at least be false for Real.

Sourceval of_float : Float_sig.round -> Float_sig.prec -> float -> t

Converts a caml float into a floating-point number of the given precision. Must work on infinities and on negative and positive zeros.

Sourceval to_float : t -> float

Converts a floating-point number of single or double precision into a caml float. Never called on better precision than double.

Sourceval cmp_ieee : t -> t -> int

IEEE comparison: do not distinguish between -0.0 and 0.0. This comparison must work between values of different precisions.

Sourceval compare : t -> t -> int

Comparison that distinguishes -0.0 and 0.0. This comparison must work between values of different precisions.

Sourceval is_nan : t -> bool
Sourceval is_finite : t -> bool
Sourceval is_infinite : t -> bool
Sourceval is_negative : t -> bool

Is a number negative? Never called on NaN, but must be correct on infinities and zeros.

Sourceval round_to_precision : Float_sig.round -> Float_sig.prec -> t -> t

Rounds a number to a given precision.

Sourceval next_float : Float_sig.prec -> t -> t

First value above the argument in the given precision. Returns the minimum finite value on -infty. Returns +0 on -0, and the minimum strictly positive value on +0. Returns +infty on the maximum finite value. Returns +infty on +infty. Undefined on NaN.

Sourceval prev_float : Float_sig.prec -> t -> t

First value below the argument in the given precision. Inversed behavior as next_float.

Sourceval widen_up : t -> t

widen_up f returns a value strictly larger than f, such that successive applications of widen_up converge rapidly to infinity.

Floating-point operations.

Sourceval neg : t -> t
Sourceval abs : t -> t
Sourceval floor : t -> t
Sourceval ceil : t -> t
Sourceval trunc : t -> t
Sourceval fround : t -> t
Sourceval add : Float_sig.round -> Float_sig.prec -> t -> t -> t
Sourceval sub : Float_sig.round -> Float_sig.prec -> t -> t -> t
Sourceval mul : Float_sig.round -> Float_sig.prec -> t -> t -> t
Sourceval div : Float_sig.round -> Float_sig.prec -> t -> t -> t
Sourceval fmod : Float_sig.round -> Float_sig.prec -> t -> t -> t
Sourceval pow : Float_sig.round -> Float_sig.prec -> t -> t -> t
Sourceval atan2 : Float_sig.round -> Float_sig.prec -> t -> t -> t