Why use float and double instead of real?

BCS ao at pathlink.com
Tue Jun 23 10:14:21 PDT 2009


Reply to Witold,

> Dnia 2009-06-23, wto o godzinie 16:01 +0000, BCS pisze:
> 
>> I think you are in error here. IIRC IEEE-754 has some stuff about
>> "extended precision" values that work like the normal types but with
>> more bits. That is what 80 bit reals are. If you force rounding to
>> 64-bits after each op, I think things will come out exactly the same
>> as for a 64-bit FPU.
>> 
> this is exactly the same think which cpu already does when dealing
> with doubles and floats. internal computations are performed in ext.
> precision, and written somewhere, truncating to 64bits.
> 

You misread me; if you need computation to exactly match 32 or 64bit math, 
you will need to round after every single operation (+, -, *, /, etc.), what 
most systems do is use full internal precision for intermediate value and 
round only when the value is stored to a variable. If you don't need bit-for-bit 
matches, then 80-bit matches IEEE-754 semantics just with more bits of precision.




More information about the Digitalmars-d-learn mailing list