9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: erik quanstrom <quanstro@labs.coraid.com>
To: 9fans@9fans.net
Subject: Re: [9fans] emulated fp on arm
Date: Wed, 30 Jan 2013 22:50:49 -0500	[thread overview]
Message-ID: <e3167c3256b3ba2a465fdbb4055318ad@coraid.com> (raw)
In-Reply-To: <20130130221845.CB4BAB82A@mail.bitblocks.com>

> 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 -.

due to the emulator interface, both cases call fpisub.
i've run a number of tests on this with relatively small
numbers that are equal.  and this seems to solve the
problems without creating new ones.

- erik

; diff -c fpi.c /sys/src/9/omap
fpi.c:137,143 - /sys/src/9/omap/fpi.c:137,142
  void
  fpisub(Internal *x, Internal *y, Internal *i)
  {
- 	int exact;
  	Internal *t;
  
  	if(y->e < x->e
fpi.c:158,164 - /sys/src/9/omap/fpi.c:157,162
  			SetInfinity(i);
  		return;
  	}
- 	exact = x->e == y->e;
  	matchexponents(x, y);
  	i->e = y->e;
  	i->h = y->h - x->h;
fpi.c:167,179 - /sys/src/9/omap/fpi.c:165,172
  		i->l += CarryBit;
  		i->h--;
  	}
- 	if(i->h == 0 && i->l == 0){
+ 	if(i->h == 0 && i->l == 0)
  		SetZero(i);
- 
- 		/* canceling rule */
- 		if(x->s != y->s && exact)
- 			i->s = 0;	/* 1 in round to -∞ mode */
- 	}
  	else while(i->e > 1 && (i->h & HiddenBit) == 0)
  		shift(i);
  }



      reply	other threads:[~2013-01-31  3:50 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
2013-01-31  3:50       ` erik quanstrom [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=e3167c3256b3ba2a465fdbb4055318ad@coraid.com \
    --to=quanstro@labs.coraid.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).