diff options
Diffstat (limited to 'stdlib')
-rw-r--r-- | stdlib/float.ml | 2 | ||||
-rw-r--r-- | stdlib/float.mli | 9 |
2 files changed, 11 insertions, 0 deletions
diff --git a/stdlib/float.ml b/stdlib/float.ml index f51275faf3..e5a4d52718 100644 --- a/stdlib/float.ml +++ b/stdlib/float.ml @@ -21,6 +21,8 @@ external mul : float -> float -> float = "%mulfloat" external div : float -> float -> float = "%divfloat" external rem : float -> float -> float = "caml_fmod_float" "fmod" [@@unboxed] [@@noalloc] +external fma : float -> float -> float -> float = "caml_fma_float" "caml_fma" + [@@unboxed] [@@noalloc] external abs : float -> float = "%absfloat" let zero = 0. diff --git a/stdlib/float.mli b/stdlib/float.mli index b8a9094335..38386e0256 100644 --- a/stdlib/float.mli +++ b/stdlib/float.mli @@ -57,6 +57,15 @@ external mul : float -> float -> float = "%mulfloat" external div : float -> float -> float = "%divfloat" (** Floating-point division. *) +external fma : float -> float -> float -> float = + "caml_fma_float" "caml_fma" [@@unboxed] [@@noalloc] +(** [fma x y z] returns [x * y + z], with a best effort for computing + this expression with a single rounding, using either hardware + instructions (providing full IEEE compliance) or a software + emulation. Note: since software emulation of the fma is costly, + make sure that you are using hardware fma support if performance + matters. @since 4.08.0 *) + external rem : float -> float -> float = "caml_fmod_float" "fmod" [@@unboxed] [@@noalloc] (** [rem a b] returns the remainder of [a] with respect to [b]. The returned |