Newsgroups: | comp.parallel,comp.arch,comp.compilers |
From: | scott@cs.arizona.edu (Scott E Gilbert) |
Status: | R |
Originator: | rmuise@dragon.acadiau.ca |
Organization: | University of Arizona CS Department, Tucson AZ |
References: | <3aqv5k$e27@monalisa.usc.edu> |
Date: | Wed, 23 Nov 1994 21:57:36 GMT |
In article <3aqv5k$e27@monalisa.usc.edu>,
Zhiwei Xu <zxu@monalisa.usc.edu> 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.
>
Without looking too closely at your code, I'll say that in "many" platforms
floats are stored as single precision but are converted to doubles when the
actual operations are performed. Thus there are extra steps involved
converting the float to a double and back before and after operations. You
could probably look at the assembly generated and see if this is what is
really happening.
--
Scott Gilbert ( scott@cs.arizona.edu )
Return to the
comp.compilers page.
Search the
comp.compilers archives again.