package mopsa

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

Single precision operations.

Single precision numbers are stored inside OCaml's floats, that are actually double precion, but rounding is done to single precision.

Operations

val add_near : t -> t -> t
val add_up : t -> t -> t
val add_down : t -> t -> t
val add_zero : t -> t -> t

Addition

val sub_near : t -> t -> t
val sub_up : t -> t -> t
val sub_down : t -> t -> t
val sub_zero : t -> t -> t

Subtraction

val mul_near : t -> t -> t
val mul_up : t -> t -> t
val mul_down : t -> t -> t
val mul_zero : t -> t -> t

Multiplication

val mulz_near : t -> t -> t
val mulz_up : t -> t -> t
val mulz_down : t -> t -> t
val mulz_zero : t -> t -> t

Special multiplication where 0 times an infinity is 0, not NaN. This is particularly useful for interal bounds.

val div_near : t -> t -> t
val div_up : t -> t -> t
val div_down : t -> t -> t
val div_zero : t -> t -> t

Division

val divz_near : t -> t -> t
val divz_up : t -> t -> t
val divz_down : t -> t -> t
val divz_zero : t -> t -> t

Special division where 0 / 0 is 0, not NaN. This is particularly useful for interal bounds.

val mod_near : t -> t -> t
val mod_up : t -> t -> t
val mod_down : t -> t -> t
val mod_zero : t -> t -> t

Remainder.

val square_near : t -> t
val square_up : t -> t
val square_down : t -> t
val square_zero : t -> t

Square.

val sqrt_near : t -> t
val sqrt_up : t -> t
val sqrt_down : t -> t
val sqrt_zero : t -> t

Square root.

val round_int_near : t -> t
val round_int_up : t -> t
val round_int_down : t -> t
val round_int_zero : t -> t

Rounding to an integer.

val of_double_near : t -> t
val of_double_up : t -> t
val of_double_down : t -> t
val of_double_zero : t -> t

Rounding from double to single precision.

val of_int_near : int -> t
val of_int_up : int -> t
val of_int_down : int -> t
val of_int_zero : int -> t
val of_int_cur : int -> t

Conversion from int with rounding.

val of_int64_near : int64 -> t
val of_int64_up : int64 -> t
val of_int64_down : int64 -> t
val of_int64_zero : int64 -> t
val of_int64_cur : int64 -> t

Conversion from int64 with rounding.

Code from Zarith to convert from Z.t to float using the current rounding mode. We add a version for single precision rounding.

val round_z_to_single : Z.t -> bool -> t
val z_to_single : Z.t -> t
val of_z_near : Z.t -> t
val of_z_up : Z.t -> t
val of_z_down : Z.t -> t
val of_z_zero : Z.t -> t

Conversion from Zarith with rounding.

Floating-point format characteristics

val mantissa_bits : int
val exponent_bits : int
val exponent_bias : int
val min_exponent : int
val max_exponent : int
val nan_infinity_exponent : int
val min_denormal : t
val min_normal : t
val max_normal : t
val max_exact : t
val ulp : t

Units in the last place (relative precision).

val rep_of_bits : int32 -> bit_float
val bits_of_rep : bit_float -> int32
val to_bits : t -> int32
val of_bits : int32 -> t
val succ : t -> t
val pred : t -> t

Returns the float immediately follownig or preceeding the argument.

val succ_zero : t -> t
val pred_zero : t -> t

As succ and pred, but does not cross zero.

val of_string_up : string -> t
val of_string_down : string -> t

Conversion from string.

OCaml

Innovation. Community. Security.