Why use float and double instead of real?

Witold Baryluk baryluk at smp.if.uj.edu.pl
Tue Jun 23 09:52:06 PDT 2009


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.

> > and many application (scientific computations, simultions, interval
> > arithmetic) absolutly needs IEEE 754 semantic (correct rounding, known
> > error behaviour, and so on).
> 
> > additionally
> > real have varying precission on multiple platforms, and varing size,
> > or are just not supported.
> 
> reals are /always/ supported if the platform supports FP, even if only with 
> 16-bit FP types.
yes, you are absolutely right. i was thinking about reals which are
mapped to something bigger than double precision.

I'm using sometimes reals for intermediate values, for example
when summing large number of values. One can also use Kahan's algorithm.






More information about the Digitalmars-d-learn mailing list