Subject: Re: OT: float and double format
To: <>
From: David Laight <david@l8s.co.uk>
List: netbsd-users
Date: 02/26/2002 17:54:33
On Tue, Feb 26, 2002 at 06:08:17PM +0100, Wojciech Puchar wrote:
> what is float & double floating-point variables format?
>
> i mean how many bits is for exponent , how many for number itself
usually:
float: sign + 8 exponent + 23 mantissa
double: sign + 11 exponent + 52 mantissa
If the exponent bits are all 1s then the value is infinity
if the mantissa bits are 0 and NaN otherwise. Infinity may
be -ve, the sign bit shouldn't be set for NaN.
The most significant bit of the mantissa is ommited (hidden
bit normalisation) unless the exponent is 0.
The bit pattern all 0s has the value 0, -ve is allowed.
Value 1 is 3f:f0:00:00:00:00:00:00 or 3f:80:00:00
For doubles the two words are normally in the 'natural' order
for the system (ie the bytes go ms..ls or ls..ms). Except
on ARM which has the word containing the exponent at the
lower address - but is otherwise little endian.
Dunno about quad (128 bit) fp numbers.
I think you also get 80bit numbers in some fpu.
David
--
David Laight: david@l8s.co.uk