FP and optimization in C

Ladislav Mecir lmecir@mbox.vol.cz
Thu Dec 8 08:54:00 GMT 2005


Hi all, I have got a following function:

int is_negligible (double a, double b) {
    volatile double c = a + b;
    return (c - b) == 0.0;
}

Can this be optimized in some way? (I need it to work the same way even 
when gcc -O2 is used)

TIA

-Ladislav



More information about the Gcc-help mailing list