fpclass

fpclass

#include
#include

Why does this program output 40 == _FPCLASS_PZ
According to IEEE it should be _FPCLASS_QNAN
and that is also what VC7 produces.

int main () {
double zero = 0.0;
double inf = 1.0 / zero;
double nan = 0.0 * inf;

std::cout << std::hex << _fpclass(nan) << std::endl;

return 0;
}

3 Beiträge / 0 neu
Letzter Beitrag
Nähere Informationen zur Compiler-Optimierung finden Sie in unserem Optimierungshinweis.

Hi,

Could you kindly tell me what options you used to build the program?
Is this with /Op or not? (/Op[-] improve floating-pt consistency)

Thanks,
Ganesh

Hi Ganesh,

Thanks a lot. That solves the problem. Is there
any documentation about this, and the pro&cons ?
I mean what is the impact of this option?
Doesit result in less performant code?
Is this option really good in practice (and
then why is it not the default?).

We detected this "problem" in the testsuite
of our product, but on a rather artificial
example.

thanks again,

andreas

Kommentar hinterlassen

Bitte anmelden, um einen Kommentar hinzuzufügen. Sie sind noch nicht Mitglied? Jetzt teilnehmen