Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
From: Rick Gorton <Rick.Gorton@alpha-processor.com>
To: "'axp-list@redhat.com'" <axp-list@redhat.com>
Subject: RE: long->double->long goes negative
Date: Fri, 29 Sep 2000 07:58:37 -0400	[thread overview]
Message-ID: <051DFF3BBA73D3119A5800A0C95BD021642E65@barracuda.api-networks.com> (raw)

I suggest that you peruse a copy of ieee754-1985, the ieee floating
point specification for a detailed description of why some of these
things can and do happen.  You're working on the edge cases of IEEE,
and those are fairly tricky.  A quick rule-of-thumb is that it is fair
to assume that any floating point value can vary by an amount equal to
the value of the least significant bit for any operation.

				/-- 0x7fffffff fffffffe
	0x7fffffff ffffffff
				\-- 0x80000000 00000000

				/-- 0x3fefffff ffffffff
	0x3ff00000 00000000
				\-- 0x3ff00000 00000001

		Input			Input + 0.0e0

There are other things which affect the result, such as an odd-even
when to add, and when not to.
Another thing you can look at is paranoia.c (from someplace on the net)
which I think has commentary in the code about what's happening.
Yeah, sometimes it's counter-intuitive.

	Rick




             reply	other threads:[~2000-09-29 12:12 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-09-29 11:58 Rick Gorton [this message]
2000-09-29 14:43 ` long->double->long goes negative Uncle George
  -- strict thread matches above, loose matches on Subject: below --
2000-09-29 16:36 Brad Lucier
2000-09-29  7:49 Phil Carmody
2000-09-29  0:44 Uncle George
2000-09-29  4:09 ` Brad Lucier
2000-09-29  9:41   ` Uncle George
2000-09-29  9:56     ` Dr. David Gilbert
2000-09-29 10:57       ` Uncle George
2000-09-29 11:55         ` Dr. David Gilbert
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox