Sun, 26 Jun 1994 03:06:39 GMT

Related articles |
---|

Does the gcc optimizer rearrange floating point expressions? jrs+@cs.cmu.edu (1994-06-26) |

Re: Does the gcc optimizer rearrange floating point expressions? dmoore@reed.edu (1994-06-28) |

Re: Does the gcc optimizer rearrange floating point expressions? drtr@mailer.astronomy.cambridge.ac.uk (1994-06-29) |

Re: Does the gcc optimizer rearrange floating point expressions? dje@cygnus.com (1994-06-30) |

Newsgroups: | comp.lang.c,gnu.gcc.help,comp.compilers |

From: | jrs+@cs.cmu.edu (Jonathan R Shewchuk) |

Followup-To: | comp.compilers |

Keywords: | GCC, question, C, optimize |

Organization: | School of Computer Science, Carnegie Mellon |

Date: | Sun, 26 Jun 1994 03:06:39 GMT |

I'm planning to implement some complicated floating point algorithms.

Rounding behavior is of great importance, so I want to ensure that the

expressions I write are executed exactly as written.

Although I havent started coding yet, I'm worried that optimizing C

compilers, particularly gcc (which is my main compiler), may foolishly

rearrange expressions under the mistaken belief that floating point

numbers are subject to the usual rules of arithmetic. For instance, given

the expression (x + y) - y, which I use to determine the amount of

floating point roundoff error in (x + y), a non-floating point-aware

optimizer might mistakenly reduce it to x.

Can anybody tell me whether gcc behaves intelligently under these

circumstances? Are there any compiler flags I can use to disable the

optimizations that might cause trouble?

Thanks,

Jonathan Shewchuk

jrs@cs.cmu.edu

P.S. If anyone's curious, I'm trying to implement exact geometric

primitives for a Delaunay triangulation algorithm using floating

point arithmetic. I believe that the expression (x + y) - y

should give the precise rounding error of (x + y) if

|y| > |x|.

--

Post a followup to this message

Return to the
comp.compilers page.

Search the
comp.compilers archives again.