Thread Links Date Links
Thread Prev Thread Next Thread Index Date Prev Date Next Date Index

About exact results and exact endpoints



On Tue, 2013-02-12 at 21:30 -0800, Richard Fateman wrote:

> It is amusing to consider that [1/3, 0.1d0] could either be converted,
> with some loss,
> to two floats [0.3333...3, 0.1d0]
> or without loss to two rationals, 
> 
> [1/3,   3602879701896397/ 2^55]
> 
In fact, 3602879701896397/ 2^55 =
0.1000000000000000055511151231257827021181583404541015625
and not 0.1. 

It is impossible to get an exact rational representation of the vast
majority of decimal fractions using only a power of 2 denominator. That
is the mathematical reason that lead to the inclusion of decimal
floating point specification in IEEE 754-2008. 

--
Hossam A. H. Fahmy
Associate Professor
Electronics and Communications Engineering
Cairo University
Egypt


Attachment: signature.asc
Description: This is a digitally signed message part