float vs double

Gary Tarolli tarolli at dragon.SGI.COM
Tue May 2 00:41:05 AEST 1989


One thing to remember - even if you declare variables to be float, they are
still passed as doubles and expressions are usually evaulated in double
precision.  To prevent expressions from being done in double prec. except
where necessary, compile with -float.  To pass arguments as floats, use
ANSI templates (see gl.h for examples).  Beware with templates - both
the caller and callee have to be properly compiled with the template for
things to work.

I agree with the previous comment, that the time to do double prec. vs. 
single prec. is probably insignificant compared to the time it takes to
do the memory accesses and conversions. 



More information about the Comp.sys.sgi mailing list