Velocity Reviews > C++ > IEEE-754

# 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

=?ISO-8859-1?Q?Erik_Wikstr=F6m?=
Guest
Posts: n/a

 08-23-2007
On 2007-08-23 12:54, Roman Töngi wrote:
> 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?

These kinds of questions that have noting to do with C++ (since C++ does
not require IEEE-754) are better asked in comp.programming.

--
Erik Wikström

=?ISO-8859-1?Q?Roman_T=F6ngi?=
Guest
Posts: n/a

 08-23-2007
Erik Wikström wrote:
> On 2007-08-23 12:54, Roman Töngi wrote:
>> 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?

>
> These kinds of questions that have noting to do with C++ (since C++ does
> not require IEEE-754) are better asked in comp.programming.
>

How does C++ store numbers then?

red floyd
Guest
Posts: n/a

 08-23-2007
Roman Töngi wrote:
> Erik Wikström wrote:

>>
>> These kinds of questions that have noting to do with C++ (since C++
>> does not require IEEE-754) are better asked in comp.programming.
>>

> How does C++ store numbers then?

In an implementation dependent manner. The Standard does not impose any
requirements on *how* an implementation implements floating point
numbers. An implementation *may choose* to use IEEE-754 (I believe most
x86 compilers do so), but it is not required to (cf. VAX -- are there
any left out there?).

Bo Persson
Guest
Posts: n/a

 08-23-2007
red floyd wrote:
:: Roman Töngi wrote:
::: Erik Wikström wrote:
::
::::
:::: These kinds of questions that have noting to do with C++ (since
:::: C++ does not require IEEE-754) are better asked in
:::: comp.programming.
::::
::: How does C++ store numbers then?
::
:: In an implementation dependent manner. The Standard does not
:: impose any requirements on *how* an implementation implements
:: floating point numbers. An implementation *may choose* to use
:: IEEE-754 (I believe most x86 compilers do so), but it is not
:: required to (cf. VAX -- are there any left out there?)

Probably not that many.

More important is IBM zSeries. Perhaps only 10.000 installations, but
big systems with BIG companies.

http://www-03.ibm.com/systems/z/

Bo Persson

red floyd
Guest
Posts: n/a

 08-23-2007
Bo Persson wrote:
> red floyd wrote:
> :: An implementation *may choose* to use
> :: IEEE-754 (I believe most x86 compilers do so), but it is not
> :: required to (cf. VAX -- are there any left out there?)
>
> Probably not that many.
>
> More important is IBM zSeries. Perhaps only 10.000 installations, but
> big systems with BIG companies.
>
> http://www-03.ibm.com/systems/z/
>

Cool. I chose VAX simply because I *knew* it didn't use 754 floating
point. Didn't know that about the zSeries.

 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 OffTrackbacks are On Pingbacks are On Refbacks are Off Forum Rules

Advertisments