Re: [fpc-pascal] math with infinity and NaN

2018-06-21 Thread Adriaan van Os
g...@wolfgang-ehrhardt.de wrote: Zitat von Adriaan van Os : Even with masked exceptions, runtime errors are produced in the Math unit. That is not conformant to the standard. Even with masked exInvalidOp? Can you give an example? Math.power with a negative base would except, even with maske

Re: [fpc-pascal] math with infinity and NaN

2018-06-21 Thread gtt
Zitat von James Richters : The fact that it raises the exception at all makes it a signaling NaN not a quiet Nan, but they are supposed to be Quiet Nan which never throw the exception according to the specification which clearly states they are Quiet Nans, not Signaling Nans. Suppressi

Re: [fpc-pascal] math with infinity and NaN

2018-06-21 Thread James Richters
discussions Subject: Re: [fpc-pascal] math with infinity and NaN Zitat von James Richters : >> For operations producing results in floating-point format, the >> default result of an operation that signals the invalid operation >> exception shall be a quiet NaN that should provi

Re: [fpc-pascal] math with infinity and NaN

2018-06-21 Thread gtt
Zitat von James Richters : For operations producing results in floating-point format, the default result of an operation that signals the invalid operation exception shall be a quiet NaN that should provide some diagnostic information (see 6.2). If it shall be a quiet NaN doesn't that mea

Re: [fpc-pascal] math with infinity and NaN

2018-06-21 Thread James Richters
- From: fpc-pascal [mailto:fpc-pascal-boun...@lists.freepascal.org] On Behalf Of g...@wolfgang-ehrhardt.de Sent: Thursday, June 21, 2018 2:46 AM To: FPC-Pascal users discussions Subject: Re: [fpc-pascal] math with infinity and NaN Quoting James Richters : > SetExceptionMask(GetExceptionM

Re: [fpc-pascal] math with infinity and NaN

2018-06-21 Thread James Richters
0, 2018 3:42 AM To: fpc-pascal@lists.freepascal.org Subject: Re: [fpc-pascal] math with infinity and NaN This is compatible with IEEE-754. Section 7.2 says 7.2 Invalid operation For operations producing results in floating-point format, the default result of an operation that signals the invalid

Re: [fpc-pascal] math with infinity and NaN

2018-06-21 Thread gtt
Zitat von Adriaan van Os : Even with masked exceptions, runtime errors are produced in the Math unit. That is not conformant to the standard. Even with masked exInvalidOp? Can you give an example? ___ fpc-pascal maillist - fpc-pascal@lists.freepa

Re: [fpc-pascal] math with infinity and NaN

2018-06-21 Thread Adriaan van Os
Florian Klämpfl wrote: Am 20.06.2018 um 10:59 schrieb Adriaan van Os: James Richters wrote: I’ve been updating my old programs to use the MATH unit in freepascal and while testing things I came across a runtime error 217 Invalid floating point operation. Here is my test program I su

Re: [fpc-pascal] math with infinity and NaN

2018-06-20 Thread gtt
Quoting James Richters : 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,

Re: [fpc-pascal] math with infinity and NaN

2018-06-20 Thread gtt
Zitat von C Western : My first reaction is that SetExceptionMask([exDenormalized,exZeroDivide,exOverflow,exUnderflow,exPrecision]) would be required (I can't remember what the default is), but it doesn't stop the error (x86_64/linux). I suspect a bug, though I am slightly surprised it hasn'

Re: [fpc-pascal] math with infinity and NaN

2018-06-20 Thread gtt
This is compatible with IEEE-754. Section 7.2 says 7.2 Invalid operation For operations producing results in floating-point format, the default result of an operation that signals the invalid operation exception shall be a quiet NaN that should provide some diagnostic information (see 6.2)

Re: [fpc-pascal] math with infinity and NaN

2018-06-20 Thread James Richters
ssage- 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 Subject: Re: [fpc-pascal] math with infinity and NaN Am 20.06.2018 um 23:15 schrieb James Ric

Re: [fpc-pascal] math with infinity and NaN

2018-06-20 Thread C Western
On 20/06/18 22:16, C Western wrote: On 20/06/18 21:58, Florian Klämpfl wrote: Am 19.06.2018 um 23:50 schrieb James Richters: I’ve been updating my old programs to use the MATH unit in freepascal and while testing things I came across a runtime error 217  Invalid floating point operation.  Here

Re: [fpc-pascal] math with infinity and NaN

2018-06-20 Thread Sven Barth via fpc-pascal
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.f

Re: [fpc-pascal] math with infinity and NaN

2018-06-20 Thread C Western
On 20/06/18 21:58, Florian Klämpfl wrote: Am 19.06.2018 um 23:50 schrieb James Richters: I’ve been updating my old programs to use the MATH unit in freepascal and while testing things I came across a runtime error 217  Invalid floating point operation.  Here is my test program Uses math; var

Re: [fpc-pascal] math with infinity and NaN

2018-06-20 Thread James Richters
>Please read the standard, exceptions are part of it. Not much of a 'standard' if it's full of exceptions so everyone just does it however they want and therefore nothing is actually standard. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org

Re: [fpc-pascal] math with infinity and NaN

2018-06-20 Thread James Richters
Is there a way to prevent getting the runtime error? James -Original Message- From: fpc-pascal [mailto:fpc-pascal-boun...@lists.freepascal.org] On Behalf Of Florian Klämpfl Sent: Wednesday, June 20, 2018 4:59 PM To: fpc-pascal@lists.freepascal.org Subject: Re: [fpc-pascal] math with

Re: [fpc-pascal] math with infinity and NaN

2018-06-20 Thread Florian Klämpfl
Am 20.06.2018 um 10:59 schrieb Adriaan van Os: James Richters wrote: I’ve been updating my old programs to use the MATH unit in freepascal and while testing things I came across a runtime error 217  Invalid floating point operation.  Here is my test program I suggest to file a bug report. I

Re: [fpc-pascal] math with infinity and NaN

2018-06-20 Thread Florian Klämpfl
Am 19.06.2018 um 23:50 schrieb James Richters: I’ve been updating my old programs to use the MATH unit in freepascal and while testing things I came across a runtime error 217  Invalid floating point operation.  Here is my test program Uses math; var    variable1:double;    variable2:doubl

Re: [fpc-pascal] math with infinity and NaN

2018-06-20 Thread James Richters
manity.com/Infinity_Minus_Infinity.html James -Original Message- From: fpc-pascal [mailto:fpc-pascal-boun...@lists.freepascal.org] On Behalf Of Marco van de Voort Sent: Wednesday, June 20, 2018 9:21 AM To: FPC-Pascal users discussions Subject: Re: [fpc-pascal] math with infinity and NaN In our previo

Re: [fpc-pascal] math with infinity and NaN

2018-06-20 Thread Marco van de Voort
In our previous episode, C Western said: > > I can do things like +infinity*2 and +infinity-3 and even sqr(infinity) > > and power(infinity,10) the results are still +Inf which is expected? > > ??but I can?t do anything involving subtracting infinity from > > infinity.? Isn't that normal? Oth

Re: [fpc-pascal] math with infinity and NaN

2018-06-20 Thread Adriaan van Os
James Richters wrote: I’ve been updating my old programs to use the MATH unit in freepascal and while testing things I came across a runtime error 217 Invalid floating point operation. Here is my test program I suggest to file a bug report. It is very unfortunate that the Math unit doesn

Re: [fpc-pascal] math with infinity and NaN

2018-06-20 Thread C Western
On 19/06/18 22:50, James Richters wrote: I’ve been updating my old programs to use the MATH unit in freepascal and while testing things I came across a runtime error 217  Invalid floating point operation.  Here is my test program Uses math; var    variable1:double;    variable2:double; B

[fpc-pascal] math with infinity and NaN

2018-06-19 Thread James Richters
I’ve been updating my old programs to use the MATH unit in freepascal and while testing things I came across a runtime error 217 Invalid floating point operation. Here is my test program Uses math; var variable1:double; variable2:double; Begin variable1:= Infinity; variable2:= -