www.digitalmars.com         C & C++   DMDScript  

D - There is an error?

reply "Luigi" <igiul.reverse email.it> writes:
But the operator == if it must confront operating that it is a NAN, raises a
invalid exception?

In the D's notes of the web site, there is the table of the "Floating point
comparison operators" where there is written that == does not raise the
exception

Thak you

--
Luigi
--
void f (OS x) {while (x.getbugs() > 0); destroy(earth);};
f (windows); // No problem!
Sep 08 2002
parent "Dario" <supdar yahoo.com> writes:
You shouldn't use op== to compare to nans. Use the isnan property instead.
Or use the isnan() function in math.d.

Anyway you don't get an exception. You get a false return value: if one of
the operands is nan, op== always returns false, regardless of the context.
Walter didn't want it to be an exception to the rule because he wants the
language to be IEEE compliant.

 But the operator == if it must confront operating that it is a NAN, raises

 invalid exception?

 In the D's notes of the web site, there is the table of the "Floating

 comparison operators" where there is written that == does not raise the
 exception

 Thak you

 --
 Luigi
 --
 void f (OS x) {while (x.getbugs() > 0); destroy(earth);};
 f (windows); // No problem!

Sep 08 2002