From: octachron <octa@polychoron.fr>
To: caml-list@inria.fr
Subject: Re: [Caml-list] Performance degradation when using '=' instead of 'compare'
Date: Fri, 28 Apr 2017 17:21:10 +0200 [thread overview]
Message-ID: <503a12e7-09a4-b26f-7248-804ef5cffbcf@polychoron.fr> (raw)
In-Reply-To: <00fad276-cfec-0aca-9718-ae00a38f2437@gmail.com>
The non-reflexivity of floating point equality is responsible for this
problem. Since NaN ≠ NaN, (=) cannot use physical equality as a
shortcut. For instance, with
let x = [1, [0. /. 0.]]
(x = x) is false, even if (x == x) is true.
Compare is not subject to this semantic for floating point equality and
can therefore use physical equality as a shortcut.
See also https://caml.inria.fr/mantis/view.php?id=7502 for another
instance of this problem in the context of cyclic data structure.
— octachron.
prev parent reply other threads:[~2017-04-28 15:21 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-28 14:36 Leonardo Laguna Ruiz
2017-04-28 15:21 ` octachron [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=503a12e7-09a4-b26f-7248-804ef5cffbcf@polychoron.fr \
--to=octa@polychoron.fr \
--cc=caml-list@inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).