9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: erik quanstrom <quanstro@quanstro.net>
To: 9fans@9fans.net
Subject: Re: [9fans] comparisons with NaN
Date: Wed, 21 Aug 2013 10:34:38 -0400	[thread overview]
Message-ID: <c38f52146686d86e55ef4d91cd20eb04@brasstown.quanstro.net> (raw)
In-Reply-To: <6ee41a996f876d895cfdb23a2fda5a06@hamnavoe.com>

amd64 does yet something else.

amd64	(a == b) (a >= b) (a > b) (b == a) (b >= a) (b > a)
386	(a < b) (a <= b) (a == b) (b < a) (b <= a) (b == a)
arm	(a < b) (a <= b) (a != b) (b < a) (b <= a) (b != a)
mips	(a < b) (a <= b) (a != b) (b < a) (b <= a) (b != a)

> mainly the assumption, in the compiler and linker, that something like this:
> 	if (a < b) f();
> can safely be transformed to this:
> 	if (a >= b) goto skip;
> 	f();
> 	skip:
> Unfortunately if a or b is NaN, the conditional will be false in both cases.
>
> So is this a feature, or a bug that needs fixing?

how about another option, just a bug.

there are other issues with the floating point, including
the fact that -0.0 is transformed both by the compiler, and
by print(2) to 0.0.  ape's printf prints -0.0 correctly.

at least in terms of passing floating point test suites
(like python's) the NaN issue doesn't come up, but the
-0 issue breaks a number of tests.

- erik



  reply	other threads:[~2013-08-21 14:34 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-21 13:17 Richard Miller
2013-08-21 14:34 ` erik quanstrom [this message]
2013-08-21 16:08   ` Richard Miller
2013-08-21 16:55     ` erik quanstrom
2013-08-21 17:42       ` Bakul Shah
2013-08-21 17:47         ` erik quanstrom
2013-08-21 18:00           ` Bakul Shah
2013-08-21 18:00           ` Richard Miller
2013-08-21 18:24             ` Charles Forsyth
2013-08-22 14:05               ` Richard Miller
2013-08-22 14:25                 ` Charles Forsyth
2013-09-20  9:05                   ` Richard Miller
2013-08-21 14:36 ` erik quanstrom
2013-08-21 18:24   ` lucio
2013-08-21 18:27     ` erik quanstrom

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=c38f52146686d86e55ef4d91cd20eb04@brasstown.quanstro.net \
    --to=quanstro@quanstro.net \
    --cc=9fans@9fans.net \
    /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).