Quoting James Richters <ja...@productionautomation.net>:
SetExceptionMask(GetExceptionMask + [exInvalidOp]); Works!
Thank you for the help!
I'm curious why things like SQRT(-1) just produce NAN without
needing to change the exception mask and (+inf) - (+inf) does not
behave the same way. They both are invalid, why treat one method
of generating an invalid number one way and another method of
getting just as invalid of a number another way? If there is
flexibility in the standard, then why not choose to always be
consistent? I have a lot of examples of things that do produce
NAN without needing to change the exception mask... like ln(-1) or
0/0 why do some cause the exception and others do not?
The case SQRT(-1) seems to be handled by the compiler, just like the
definition
Nan = 0/0 in math.
If you have an expression, which is not handled at compile time you get
the EInvalidOp exception, try
variable2 := Pi-4;
variable1 := sqrt(variable2);
Writeln(variable1);
_______________________________________________
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal