This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

FP and optimization in C


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]