Newsgroups: | comp.parallel,comp.arch,comp.compilers |
From: | trobey@taos.arc.unm.edu (Thomas H. Robey) |
Status: | RO |
Originator: | rmuise@dragon.acadiau.ca |
Organization: | Spectra Research Institute |
X-Newsreader: | News Xpress Version 1.0 Beta #0 |
References: | <3aqv5k$e27@monalisa.usc.edu> |
Date: | Wed, 23 Nov 1994 22:23:54 GMT |
zxu@monalisa.usc.edu (Zhiwei Xu) wrote:
>Can any one explain why a C program using single precision (float) is slower
>that the same code using double precision (double)? Please try the following
>code for computing pi. I have tried it on IBM RS6000/250, IBM SP2, Sun4, and
>Sun SS20, and got the same strange timing.
>
C often performs the computations in double precision by default. Thus, when you request single precision, the
compiler probably does the computation in double precision and then truncates or rounds-off to get the single
precision result. Thus, single precision usually is slower than double precision. This behavior is also dependent on the
platform being used and whether a floating point coprocessor is used.
Thomas H. Robey
trobey@arc.unm.edu
Return to the
comp.compilers page.
Search the
comp.compilers archives again.