T
Thomas Jahns
So my program has the following function at the moment to replace -0.0 with +0.0
in a function argument:
static inline double
sign_flat(double v)
{
if (v == 0.0)
return 0.0;
return v;
}
But when compiling with the Intel Compiler icc at optimization level -O2 or
higher the above still produces -0.0. This raises two questions:
1. is the compiler free to convert above function into a NOP?
2. does anyone know a work-around or even more suitable formulation to achieve
the same? Preferably not some integer operations using signbit since our main
system is a Power6 which has some issues with FPU depending on ALU results and
vice versa. I've done some searching but the Internet is flooded with people
trying to wrap their head around the fact that -0.0 exists.
1. is actually the less interesting question since even when the answer was no
I still want my code to work with the Intel compiler.
Regards, Thomas
in a function argument:
static inline double
sign_flat(double v)
{
if (v == 0.0)
return 0.0;
return v;
}
But when compiling with the Intel Compiler icc at optimization level -O2 or
higher the above still produces -0.0. This raises two questions:
1. is the compiler free to convert above function into a NOP?
2. does anyone know a work-around or even more suitable formulation to achieve
the same? Preferably not some integer operations using signbit since our main
system is a Power6 which has some issues with FPU depending on ALU results and
vice versa. I've done some searching but the Internet is flooded with people
trying to wrap their head around the fact that -0.0 exists.
1. is actually the less interesting question since even when the answer was no
I still want my code to work with the Intel compiler.
Regards, Thomas