9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: Bakul Shah <bakul@bitblocks.com>
To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net>
Subject: Re: [9fans] emulated fp on arm
Date: Wed, 30 Jan 2013 14:18:45 -0800	[thread overview]
Message-ID: <20130130221845.CB4BAB82A@mail.bitblocks.com> (raw)
In-Reply-To: Your message of "Tue, 29 Jan 2013 17:44:16 EST." <d1329b9babc534669c4b183f34394a01@kw.quanstro.net>

On Tue, 29 Jan 2013 17:44:16 EST erik quanstrom <quanstro@quanstro.net> wrote:
> On Tue Jan 29 17:12:15 EST 2013, 9fans@hamnavoe.com wrote:
> > > i'm not a fp expert, but i think there are two problems here.  first
> > > it is bad form to generate -0 in the emulator, even if it is technically
> > > correct, and second, -0 is defined to be equal to 0 by the spec, so
> > > -0 == 0 should always be true.
> >
> > I think you're right on the second point (I haven't read the IEEE spec
> > lately, just looked at wikipedia), and wrong on the first.  IEEE fp
> > definitely allows for positive and negative zero, so the emulator should
> > be generating them when the spec calls for them to do so.
>
> you might be right about the first point, but i'm really having a hard
> time sorting this out. i don't have the standard, and it's $85.
> this wiki page says there are some rules funny rules for addition/subtraction
> :
> http://en.wikipedia.org/wiki/Signed_zero#Arithmetic
>
> here's what i have with the as-is fpi
>
> ; for(i in ocilla ladd kw)cpu -h $i -c /tmp/awktest
> Xeon 	-1 + 1 = 0 cmp 0 ok; cmp -0 ok
> 	1 + -1 = 0 cmp 0 ok; cmp -0 ok
> Atom 	-1 + 1 = 0 cmp 0 ok; cmp -0 ok
> 	1 + -1 = 0 cmp 0 ok; cmp -0 ok
> ARM 	-1 + 1 = -0 cmp 0 fail; cmp -0 fail
> 	1 + -1 = 0 cmp 0 ok; cmp -0 ok
> ; and gcc/amd64 + gawk
> 	-1 + 1 = 0 cmp 0 ok; cmp -0 ok

As ieee754 (1985):

  When the sum of two operands with opposite signs (or the
  difference of two operands with like signs) is exactly zero,
  the sign of that sum (or difference) shall be + in all
  rounding modes except round toward -INFINITY, in which mode
  that sign shall be -.



  parent reply	other threads:[~2013-01-30 22:18 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-28 17:08 erik quanstrom
2013-01-28 17:10 ` erik quanstrom
2013-01-29 22:10 ` Richard Miller
2013-01-29 22:44   ` erik quanstrom
2013-01-30 10:35     ` Richard Miller
2013-01-30 22:18     ` Bakul Shah [this message]
2013-01-31  3:50       ` 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=20130130221845.CB4BAB82A@mail.bitblocks.com \
    --to=bakul@bitblocks.com \
    --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).