Re: subnormal floating point numbers
- From: Joe Wright <joewwright@xxxxxxxxxxx>
- Date: Sun, 20 May 2007 11:07:08 -0400
Charles Richmond wrote:
CBFalconer wrote:00000000 10000000 00000000 00000000ultimatewarrior wrote:
... snip ...
I have written a piece of code that was supposed to be quite
portable, and uses a lot fp numbers. Everything goes well on PPC
cpus, but on some x86 CPU I get a dramatic loss of performance.
After some investigations I've discovered that the problem is
caused by some numbers becoming subnormal, PPC cpus seems to
treat them quietly without any significant loss of speed whereas
on some x86 CPU I get really very poor results as soon as these
"strange" entities begin to pop out...
What is a 'subnormal' number?
Maybe he means unnormalized. But I thought that with IEEE
floating point, *all* the floating point numbers *had* to
be normalized so the "phantom 0" could be recognized
correctly.
Exp = 1 (-125)
10000011
Man = .10000000 00000000 00000000
1.17549435e-38
The above is the IEEE FLT_MIN. Your "phantom" is b23 which is low order of the exponent and high order of the mantissa. Decrementing the exponent gives us..
00000000 00000000 00000000 00000000
...or zero. If a float has exponent 0 and any mantissa bit 1 it is declared subnormal because it can't be normalized (Normalization consists of moving mantissa bits left while decrementing the exponent. As the exponent is already zero, it can't be further decremented).
A subnormal float converted to double will be normalized because double has a wider exponent than float.
--
Joe Wright
"Everything should be made as simple as possible, but not simpler."
--- Albert Einstein ---
.
- References:
- subnormal floating point numbers
- From: ultimatewarrior
- Re: subnormal floating point numbers
- From: CBFalconer
- Re: subnormal floating point numbers
- From: Charles Richmond
- subnormal floating point numbers
- Prev by Date: Re: Problem with use of pointer
- Next by Date: Re: output all a* by searching a text file
- Previous by thread: Re: subnormal floating point numbers
- Next by thread: Re: subnormal floating point numbers
- Index(es):
Relevant Pages
|