package gsl

  1. Overview
  2. Docs

IEEE floating-point arithmetic

Representation of floating point numbers

type ieee_type =
  1. | NAN
  2. | INF
  3. | NORMAL
  4. | DENORMAL
  5. | ZERO
type float_rep = {
  1. sign : int;
  2. mantissa : string;
  3. exponent : int;
  4. ieee_type : ieee_type;
}
val rep_of_float : float -> float_rep
val print : float -> string

IEEE environment

type precision =
  1. | SINGLE
  2. | DOUBLE
  3. | EXTENDED
type rounding =
  1. | TO_NEAREST
  2. | DOWN
  3. | UP
  4. | TO_ZERO
type exceptions =
  1. | MASK_INVALID
  2. | MASK_DENORMALIZED
  3. | MASK_DIVISION_BY_ZERO
  4. | MASK_OVERFLOW
  5. | MASK_UNDERFLOW
  6. | MASK_ALL
  7. | TRAP_INEXACT
val set_mode : ?precision:precision -> ?rounding:rounding -> exceptions list -> unit
val env_setup : unit -> unit

FPU status word

type excepts =
  1. | FE_INEXACT
  2. | FE_DIVBYZERO
  3. | FE_UNDERFLOW
  4. | FE_OVERFLOW
  5. | FE_INVALID
  6. | FE_ALL_EXCEPT
val clear_except : excepts list -> unit
val test_except : excepts list -> excepts list
OCaml

Innovation. Community. Security.