package ocaml_intrinsics

  1. Overview
  2. Docs

Module Ocaml_intrinsics.FloatSource

Sourceval iround_half_to_even : float -> int64

Rounds a float to an int64 using the current rounding mode. The default rounding mode is "round half to even", and we expect that no program will change the rounding mode.

If the argument is NaN or infinite or if the rounded value cannot be represented, then the result is unspecified.

On an x86-64 machine, this compiles to cvtsd2si rax, xmm0.

Sourceval min : float -> float -> float

Equivalent to if x < y then x else y.

On an x86-64 machine, this compiles to minsd xmm0, xmm1.

Sourceval max : float -> float -> float

Equivalent to if x > y then x else y.

On an x86-64 machine, this compiles to maxsd xmm0, xmm1.

Sourceval round_half_to_even : float -> float

Rounds a float to an integer float using the current rounding mode. The default rounding mode is "round half to even", and we expect that no program will change the rounding mode.

On an x86-64 machine, this compiles to roundsd xmm0, xmm1, $12. Requires SSE4.1.

Sourceval round_down : float -> float

Rounds a float to an integer float using the mode specified in the function name.

Sourceval round_up : float -> float
Sourceval round_towards_zero : float -> float