On 11/2/11, Andrew Haley <aph@xxxxxxxxxx> wrote: > On 11/02/2011 09:01 AM, Vincent Lefevre wrote: >> In ISO C99, I don't think the compiler is allowed to replace a >> floating expression with an underflow or overflow by its result >> at compile time. > > But surely the "as if" rule applies here: if no conforming program > can tell the difference, a transformation is allowed. > > Andrew. > I dont think that this is the point i am making... Gcc allows certain optimization options eg -Ofast (4.6) where -ffast-math (even prior to 4.6), and some other, unsafe wrt pedantic standard definitions, optimization options become available (including, i think floating-point constant folding opportunities). I am very happy with such options by the way so the question was not about standard compliance (hence my original statement about the said compile-time calculations being done under certain conditions, not all the time and having nothing to do with c++03/11 standard specifications). I am saying that having such, great, otimization options available it would be super-helpful if there was a way to have a diagnostic/warning about compile-time calculations producing non-finite floating point values (whether via lib mpfr or otherwise). Regards Leon Zadorin.