Wed, 23 Nov 1994 22:23:06 GMT

Newsgroups: | comp.parallel,comp.arch,comp.compilers |

From: | dsmentek@hpfcla.fc.hp.com (Dave Smentek) |

Status: | RO |

Followup-To: | comp.parallel,comp.arch,comp.compilers |

Originator: | rmuise@dragon.acadiau.ca |

Organization: | Hewlett-Packard Fort Collins Site |

X-Newsreader: | TIN [version 1.2 PL2] |

References: | <3aqv5k$e27@monalisa.usc.edu> |

Date: | Wed, 23 Nov 1994 22:23:06 GMT |

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.*

... lots of stuff deleted....

The C language is defined to do all floating point operations in the highest

available precision of the machine (regardless of the original data

precision). An operation on 2 single precision operands, producing a

single precision result, gets compiled as:

2 floating point converts from single to double

a double precision FLOP

a floating point convert from double to single

Double precision computations don't have the 3 converts, so they execute in

fewer cycles.

dave

Post a followup to this message

Return to the
comp.compilers page.

Search the
comp.compilers archives again.