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? 

If someone wanted to volunteer time to adjust the math unit to always behave 
the same way, would it be something that would be accepted or is there some 
fundamental reason why it is like this?

James


-----Original Message-----
From: fpc-pascal [mailto:fpc-pascal-boun...@lists.freepascal.org] On Behalf Of 
Sven Barth via fpc-pascal
Sent: Wednesday, June 20, 2018 5:23 PM
To: fpc-pascal@lists.freepascal.org
Cc: Sven Barth <pascaldra...@googlemail.com>
Subject: Re: [fpc-pascal] math with infinity and NaN

Am 20.06.2018 um 23:15 schrieb James Richters:
> Is there a way to prevent getting the runtime error?

=== code begin ===

SetExceptionMask(GetExceptionMask + [exInvalidOp]);

=== code end ===

Regards,
Sven
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org 
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to