Hi Sébastien, I feel obligated to point out that the _semantics_ of floating-point comparison is a bit tricky. IEEE 754 mandates that NaN == NaN should return false (as well as NaN != NaN), breaking all algebraic laws known to mankind :-). OCaml's operators '=' and '!=' follow this convention, but 'compare nan nan' returns 0, which is usually the desired behavior. However, 'compare 0. (-0.)' also returns 0, while you might want to distinguish those two values. HTH, On Thu, Jul 23, 2015 at 10:35 AM, Sébastien Hinderer < Sebastien.Hinderer@inria.fr> wrote: > Dear all, > > What's the most efficient way to compare floats, please? > Is it the polymorphic compare function, or is there a more specialized > version of it? > > I saw Float.compare mentionned on the web but that does not seem to exist > any longer? > > Thanks, > > Sébastien. > > -- > Caml-list mailing list. Subscription management and archives: > https://sympa.inria.fr/sympa/arc/caml-list > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs > -- Boris