On 22/07/2022 15:16, Anton Ertl wrote:
dxforth <dxf...@gmail.com> writes:
VFX:
0e fln f. -NaN ok
VFX Forth for Linux IA32 Version: 4.72 [build 0555]
Including /usr/local/VfxLinEval/Lib/x86/Ndp387.fth
0e fln f. -Inf ok
NDP Potential Exception: NDP SW = 0004
VFX Forth 64 5.11 RC2 [build 0112] 2021-05-02 for Linux x64
© MicroProcessor Engineering Ltd, 1998-2021
0e fln f. Invalid argument to FLN/FLOGStephen advises the fix will be in the next release.
0e fln f.^
dxforth schrieb am Sonntag, 24. Juli 2022 um 06:31:22 UTC+2:
On 22/07/2022 15:16, Anton Ertl wrote:
dxforth <dxf...@gmail.com> writes:
VFX:
0e fln f. -NaN ok
VFX Forth for Linux IA32 Version: 4.72 [build 0555]
Including /usr/local/VfxLinEval/Lib/x86/Ndp387.fth
0e fln f. -Inf ok
NDP Potential Exception: NDP SW = 0004
VFX Forth 64 5.11 RC2 [build 0112] 2021-05-02 for Linux x64
© MicroProcessor Engineering Ltd, 1998-2021
0e fln f. Invalid argument to FLN/FLOG
0e fln f.
^
Stephen advises the fix will be in the next release.
IEEE 754 section 9.2.1 specifies clearly
".. log(±0) is −∞ and signals the divideByZero exception .."
Reference page 43 in
https://irem.univ-reunion.fr/IMG/pdf/ieee-754-2008.pdf
On 7/30/22 07:22, minf...@arcor.de wrote:
dxforth schrieb am Sonntag, 24. Juli 2022 um 06:31:22 UTC+2:
On 22/07/2022 15:16, Anton Ertl wrote:
dxforth <dxf...@gmail.com> writes:
VFX:
0e fln f. -NaN ok
VFX Forth for Linux IA32 Version: 4.72 [build 0555]
Including /usr/local/VfxLinEval/Lib/x86/Ndp387.fth
0e fln f. -Inf ok
NDP Potential Exception: NDP SW = 0004
VFX Forth 64 5.11 RC2 [build 0112] 2021-05-02 for Linux x64
© MicroProcessor Engineering Ltd, 1998-2021
0e fln f. Invalid argument to FLN/FLOG
0e fln f.
^
Stephen advises the fix will be in the next release.
IEEE 754 section 9.2.1 specifies clearly
".. log(±0) is −∞ and signals the divideByZero exception .."
Reference page 43 in https://irem.univ-reunion.fr/IMG/pdf/ieee-754-2008.pdfThe divideByZero exception mask bit must be set in order for the fpu to signal the exception. It is not set by default.
In kForth-32/64,
\ Check ln(0)
0e f.
0 ok
0e fln f.
-inf ok
\ Check ln(-0)
-0e f.
-0 ok
-0e fln f.
-inf ok
In kForth-32, the FPU's exception mask bit for divideByZero may be set
as follows:
------
include ans-words
include strings
include modules
include syscalls
include mc
include asm-x86
include fpu-x86
cr
.( FLN of zero with default FPU exception mask ) cr
0e fln f. cr
.( Press a key to set the divideByZero FPU exception ) cr
key drop
FPU_CW_ZERODIVIDE FPU_CW_EXCEPTION_MASK modifyFPUStateX86
0e fln f.
------
Output of the above code in kForth-32:
-------
$ kforth32
kForth-32 v 2.4.0 (Build: 2022-06-30)
Copyright (c) 1998--2022 Krishna Myneni
Contributions by: dpw gd mu bk abs tn cmb bg dnw
Provided under the GNU Affero General Public License, v3.0 or later
Ready!
include fpu-signals-test
FLN of zero with default FPU exception mask
-inf
Press a key to set the divideByZero FPU exception
Floating point exception (core dumped)
$
------
We can, of course, trap the signal in kForth (see sigfpe.4th for an
example of how to trap a signal in kForth).
Krishna Myneni schrieb am Samstag, 30. Juli 2022 um 18:31:38 UTC+2:
On 7/30/22 07:22, minf...@arcor.de wrote:
dxforth schrieb am Sonntag, 24. Juli 2022 um 06:31:22 UTC+2:The divideByZero exception mask bit must be set in order for the fpu to
On 22/07/2022 15:16, Anton Ertl wrote:
dxforth <dxf...@gmail.com> writes:
VFX:
0e fln f. -NaN ok
VFX Forth for Linux IA32 Version: 4.72 [build 0555]
Including /usr/local/VfxLinEval/Lib/x86/Ndp387.fth
0e fln f. -Inf ok
NDP Potential Exception: NDP SW = 0004
VFX Forth 64 5.11 RC2 [build 0112] 2021-05-02 for Linux x64
© MicroProcessor Engineering Ltd, 1998-2021
0e fln f. Invalid argument to FLN/FLOG
0e fln f.
^
Stephen advises the fix will be in the next release.
IEEE 754 section 9.2.1 specifies clearly
".. log(±0) is −∞ and signals the divideByZero exception .."
Reference page 43 in
https://irem.univ-reunion.fr/IMG/pdf/ieee-754-2008.pdf
signal the exception. It is not set by default.
In kForth-32/64,
\ Check ln(0)
0e f.
0 ok
0e fln f.
-inf ok
\ Check ln(-0)
-0e f.
-0 ok
-0e fln f.
-inf ok
In kForth-32, the FPU's exception mask bit for divideByZero may be set
as follows:
------
include ans-words
include strings
include modules
include syscalls
include mc
include asm-x86
include fpu-x86
cr
.( FLN of zero with default FPU exception mask ) cr
0e fln f. cr
.( Press a key to set the divideByZero FPU exception ) cr
key drop
FPU_CW_ZERODIVIDE FPU_CW_EXCEPTION_MASK modifyFPUStateX86
0e fln f.
------
Output of the above code in kForth-32:
-------
$ kforth32
kForth-32 v 2.4.0 (Build: 2022-06-30)
Copyright (c) 1998--2022 Krishna Myneni
Contributions by: dpw gd mu bk abs tn cmb bg dnw
Provided under the GNU Affero General Public License, v3.0 or later
Ready!
include fpu-signals-test
FLN of zero with default FPU exception mask
-inf
Press a key to set the divideByZero FPU exception
Floating point exception (core dumped)
$
------
We can, of course, trap the signal in kForth (see sigfpe.4th for an
example of how to trap a signal in kForth).
Well done!
BTW I was sometimes wondering about those strange exception codes
54 and 55 in table 9.1 of the standard document. They seem a half-cooked rudiment and practically useless.
On 7/30/22 07:22, minf...@arcor.de wrote:
dxforth schrieb am Sonntag, 24. Juli 2022 um 06:31:22 UTC+2:
On 22/07/2022 15:16, Anton Ertl wrote:
dxforth <dxf...@gmail.com> writes:
VFX:
0e fln f. -NaN ok
VFX Forth for Linux IA32 Version: 4.72 [build 0555]
Including /usr/local/VfxLinEval/Lib/x86/Ndp387.fth
0e fln f. -Inf ok
NDP Potential Exception: NDP SW = 0004
VFX Forth 64 5.11 RC2 [build 0112] 2021-05-02 for Linux x64
© MicroProcessor Engineering Ltd, 1998-2021
0e fln f. Invalid argument to FLN/FLOG
0e fln f.
^
Stephen advises the fix will be in the next release.
IEEE 754 section 9.2.1 specifies clearly
".. log(±0) is −∞ and signals the divideByZero exception .."
Reference page 43 in
https://irem.univ-reunion.fr/IMG/pdf/ieee-754-2008.pdf
The divideByZero exception mask bit must be set in order for the fpu to signal the exception. It is not set by default.
In kForth-32/64,
\ Check ln(0)
0e f.
0 ok
0e fln f.
-inf ok
\ Check ln(-0)
-0e f.
-0 ok
-0e fln f.
-inf ok
In kForth-32, the FPU's exception mask bit for divideByZero may be set
as follows:
------
include ans-words
include strings
include modules
include syscalls
include mc
include asm-x86
include fpu-x86
cr
.( FLN of zero with default FPU exception mask ) cr
0e fln f. cr
.( Press a key to set the divideByZero FPU exception ) cr
key drop
FPU_CW_ZERODIVIDE FPU_CW_EXCEPTION_MASK modifyFPUStateX86
FPU_CW_ZERODIVIDE FPU_CW_EXCEPTION_MASK modifyFPUStateX86
is actually masking the divideByZero exception, rather than enabling it.
The program generates an exception for the odd reason that when I loaded
the strings.4th module, the fpu status register indicates an INVALID
error, caused by the following statement in strings.4th
0e 0e f/ fconstant NAN
used to define NAN for the word STRING>F .
On 7/30/22 23:02, Krishna Myneni wrote:...
0 unmaskFPUexceptions \ mask all exceptions...
On 7/30/22 11:31, Krishna Myneni wrote:,,,
FPU_CW_ZERODIVIDE FPU_CW_EXCEPTION_MASK modifyFPUStateX86...
is actually masking the divideByZero exception, rather than enabling it.
The program generates an exception for the odd reason that when I loaded
the strings.4th module, the fpu status register indicates an INVALID
error, caused by
Bottom line is the code I intended to enable an exception on the fpu...
divide by zero error is not correct, and only generates an exception due
to a leftover status error from somewhere else in the code. The word modifyFPUStateX86 may be faulty.
On 31/07/2022 14:02, Krishna Myneni wrote:
FPU_CW_ZERODIVIDE FPU_CW_EXCEPTION_MASK modifyFPUStateX86
is actually masking the divideByZero exception, rather than enabling it.
The program generates an exception for the odd reason that when I loaded
the strings.4th module, the fpu status register indicates an INVALID
error, caused by the following statement in strings.4th
0e 0e f/ fconstant NAN
used to define NAN for the word STRING>F .
The bit patterns for IEEE INF NAN are documented. Load them into PAD and F@
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 546 |
Nodes: | 16 (2 / 14) |
Uptime: | 143:45:34 |
Calls: | 10,383 |
Calls today: | 8 |
Files: | 14,054 |
D/L today: |
2 files (1,861K bytes) |
Messages: | 6,417,671 |