Re: IEEE-754
- From: Eric Sosman <Eric.Sosman@xxxxxxx>
- Date: Thu, 23 Aug 2007 10:38:48 -0400
Roman Töngi wrote On 08/23/07 06:45,:
IEEE-754 Arithmetic:
Most real numbers can't be stored exactly on the computer, but there can
be stated the range within which a machine number lies.
For the following example, I assume double precision and the round mode
in effect to be 'round to nearest' and that the number lies within the
normalized range:
Definitions:
x := real number
round(x) := correctly rounded normalized number
eps := machine epsilon (2^(-52) for double precision)
abs(x) := absolute value of x
That is:
round(x) = x*(1 + delta)
with delta:
abs(delta) <= 1/2*eps (round to nearest)
i.d. abs(delta) <= 2^(-53) (double precision)
abs(delta) corresponds to the relative rounding error.
Now I can state the range including round(x):
-----------------------------------------
x*(1-2(-53)) <= round(x) <= x*(1+2^(-53))
-----------------------------------------
Is this the correct range according to my assumptions?
It looks right to me for x >= 0 (for x < 0 the
inequalities are backwards), and given suitable hand-
waving for abs(x) very small or very large. It might
be possible (I'm not sure) to sharpen the analysis a
tiny bit and change a `<=' to a `<', but whether that's
worth trying depends on your purpose in obtaining the
bound in the first place.
Note that the C language does not require IEEE
floating-point, nor does it require round-to-nearest,
nor does it specify the value of eps.
--
Eric.Sosman@xxxxxxx
.
- References:
- IEEE-754
- From: Roman Töngi
- IEEE-754
- Prev by Date: Re: Function prototypes
- Next by Date: Re: Are there books about C data structures?
- Previous by thread: Re: IEEE-754
- Next by thread: Argc and Argv
- Index(es):
Relevant Pages
|