Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > IEEE-754

Reply
Thread Tools

IEEE-754

 
 
=?ISO-8859-1?Q?Roman_T=F6ngi?=
Guest
Posts: n/a
 
      08-23-2007
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?



Thanks a lot
Roman
 
Reply With Quote
 
 
 
 
Boudewijn Dijkstra
Guest
Posts: n/a
 
      08-23-2007
Op Thu, 23 Aug 2007 12:45:52 +0200 schreef Roman Töngi
<(E-Mail Removed)>:
> 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?


Yes, but your assumptions are invalid. How did you arrive at a machine
epsilon of 2^(-52)?


--
Gemaakt met Opera's revolutionaire e-mailprogramma:
http://www.opera.com/mail/
 
Reply With Quote
 
 
 
 
Eric Sosman
Guest
Posts: n/a
 
      08-23-2007
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.

--
http://www.velocityreviews.com/forums/(E-Mail Removed)


 
Reply With Quote
 
=?ISO-8859-15?Q?Roman_T=F6ngi?=
Guest
Posts: n/a
 
      08-23-2007
Boudewijn Dijkstra wrote:
> Op Thu, 23 Aug 2007 12:45:52 +0200 schreef Roman Töngi
> <(E-Mail Removed)>:
>> 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?

>
> Yes, but your assumptions are invalid. How did you arrive at a machine
> epsilon of 2^(-52)?
>
>

From the IEEE-specification for double format.
 
Reply With Quote
 
Boudewijn Dijkstra
Guest
Posts: n/a
 
      08-24-2007
Op Thu, 23 Aug 2007 18:08:15 +0200 schreef Roman Töngi
<(E-Mail Removed)>:
> Boudewijn Dijkstra wrote:
>> Op Thu, 23 Aug 2007 12:45:52 +0200 schreef Roman Töngi
>> <(E-Mail Removed)>:
>> How did you arrive at a machine epsilon of 2^(-52)?
>>

> From the IEEE-specification for double format.


I asked how, not where. Unless it says something like: "the machine
epsilon is 2^(-52); this corresponds to the upper limit of the rounding
error."


--
Gemaakt met Opera's revolutionaire e-mailprogramma:
http://www.opera.com/mail/
 
Reply With Quote
 
cr88192
Guest
Posts: n/a
 
      08-24-2007

"Boudewijn Dijkstra" <(E-Mail Removed)> wrote in message
news(E-Mail Removed)...
> Op Thu, 23 Aug 2007 18:08:15 +0200 schreef Roman Töngi
> <(E-Mail Removed)>:
>> Boudewijn Dijkstra wrote:
>>> Op Thu, 23 Aug 2007 12:45:52 +0200 schreef Roman Töngi
>>> <(E-Mail Removed)>:
>>> How did you arrive at a machine epsilon of 2^(-52)?
>>>

>> From the IEEE-specification for double format.

>
> I asked how, not where. Unless it says something like: "the machine
> epsilon is 2^(-52); this corresponds to the upper limit of the rounding
> error."
>


my guess (probably OT here, oh well):

it will be this, presumably, unless the machine computes using less bits
than the format (such as if the calculations were internally performed with
floats, or with 48 bit mantissa values, or such).

may be a little higher really, as presumably the exact values of the low
order bits will depend on the exact HW.

for example, calculations performed with doubles in SSE are often slightly
off from those performed in the FPU, given the FPU uses an internal 80 bit
representation (with a 64 bit mantissa).

now, if our basic value is 1, and things are properly normalized (I think
this is required, except in the edge case of very small values), then our
epsilon is about the same as the relative weight of our low order bits.


now, if the major value were something other than 1, then the epsilon would
differ, in step with the exponent.

or such...


>
> --
> Gemaakt met Opera's revolutionaire e-mailprogramma:
> http://www.opera.com/mail/



 
Reply With Quote
 
Boudewijn Dijkstra
Guest
Posts: n/a
 
      08-27-2007
Op Fri, 24 Aug 2007 12:17:09 +0200 schreef cr88192 <(E-Mail Removed)>:
> "Boudewijn Dijkstra" <(E-Mail Removed)> wrote in message
> news(E-Mail Removed)...
>> Op Thu, 23 Aug 2007 18:08:15 +0200 schreef Roman Töngi
>> <(E-Mail Removed)>:
>>> Boudewijn Dijkstra wrote:
>>>> Op Thu, 23 Aug 2007 12:45:52 +0200 schreef Roman Töngi
>>>> <(E-Mail Removed)>:
>>>> How did you arrive at a machine epsilon of 2^(-52)?
>>>>
>>> From the IEEE-specification for double format.

>>
>> I asked how, not where. Unless it says something like: "the machine
>> epsilon is 2^(-52); this corresponds to the upper limit of the rounding
>> error."
>>

> now, if our basic value is 1, and things are properly normalized (I think
> this is required, except in the edge case of very small values), then our
> epsilon is about the same as the relative weight of our low order bits.
>
>
> now, if the major value were something other than 1, then the epsilon
> would differ, in step with the exponent.
>
> or such...


Exactly. The epsilon will be proportional to the exponent.



--
Gemaakt met Opera's revolutionaire e-mailprogramma:
http://www.opera.com/mail/
 
Reply With Quote
 
Peter J. Holzer
Guest
Posts: n/a
 
      08-27-2007
On 2007-08-27 07:24, Boudewijn Dijkstra <(E-Mail Removed)> wrote:
> Exactly. The epsilon will be proportional to the exponent.


And now read the OP again.

hp


--
_ | Peter J. Holzer | I know I'd be respectful of a pirate
|_|_) | Sysadmin WSR | with an emu on his shoulder.
| | | (E-Mail Removed) |
__/ | http://www.hjp.at/ | -- Sam in "Freefall"
 
Reply With Quote
 
Boudewijn Dijkstra
Guest
Posts: n/a
 
      08-28-2007
Op Mon, 27 Aug 2007 15:52:30 +0200 schreef Peter J. Holzer
<(E-Mail Removed)>:
> On 2007-08-27 07:24, Boudewijn Dijkstra <(E-Mail Removed)> wrote:
>> Exactly. The epsilon will be proportional to the exponent.

>
> And now read the OP again.


You're beyond me now. The OP was talking about a constant epsilon for the
whole range of numbers within the normalized range. Or did you read
something else between lines?


--
Gemaakt met Opera's revolutionaire e-mailprogramma:
http://www.opera.com/mail/
 
Reply With Quote
 
CBFalconer
Guest
Posts: n/a
 
      08-28-2007
Boudewijn Dijkstra wrote:
> schreef Peter J. Holzer <(E-Mail Removed)>:
>> Boudewijn Dijkstra <(E-Mail Removed)> wrote:
>>
>>> Exactly. The epsilon will be proportional to the exponent.

>>
>> And now read the OP again.

>
> You're beyond me now. The OP was talking about a constant epsilon
> for the whole range of numbers within the normalized range. Or
> did you read something else between lines?


You are the first I have noted to consider 'proportional' to denote
a constant.

--
Chuck F (cbfalconer at maineline dot net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home.att.net>



--
Posted via a free Usenet account from http://www.teranews.com

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off




Advertisments