Newsgroups: | comp.parallel,comp.arch,comp.compilers |
From: | bevan@cs.man.ac.uk (Stephen J Bevan) |
In-Reply-To: | zxu@monalisa.usc.edu's message of Wed, 23 Nov 1994 00:38:40 GMT |
Status: | RO |
Originator: | rmuise@dragon.acadiau.ca |
Organization: | Department of Computer Science; University of Manchester |
References: | <3aqv5k$e27@monalisa.usc.edu> |
Date: | Wed, 23 Nov 1994 22:08:55 GMT |
In article <3aqv5k$e27@monalisa.usc.edu> zxu@monalisa.usc.edu (Zhiwei Xu) writes:
Can any one explain why a C program using single precision (float) is slower
that the same code using double precision (double)?
[ program deleted ]
Using gcc (2.5.8) on a SPARC most of the arithmetic in the critical
loop appears to be done in double precision independent of whether you
declare the variables as float or double. Declaring the variables as
float means that a bunch of extra single-to-double and
double-to-single instructions are inserted which obviously slows down
the loop. If you add -fshort-double to the compiler options, it
appears to do the arithmetic in single precision.
Return to the
comp.compilers page.
Search the
comp.compilers archives again.