Search code examples
ocamlutop

Absolute value of float in ocaml


When I use the function abs_float, Merlin (running in emacs) tells me:

Warning 3: deprecated: Core.Std.abs_float [since 2014-10] Use [Float]

(The code still compiles, though.) What is this trying to tell me? I've tried Float.abs and similar variants without success. When I try #require "Float" and open Float in utop, I get No such package and unbound module errors.

I know it's trivial to write an absolute value function oneself, but I'm still interested in knowing how to do this the "right" way.


Solution

  • The answer is :

     Core.Std.Float.abs (-6.0)