The procedures contained in module SYSTEM are listed in the following table. v stands for a variable. x, y, and n stands for expressions. T stands for a type.
Function procedures
Name Argument types Result type Description
...
VAL(T, x) T, x: any type T x interpreted as of type T
* integer types without LONGINT
issue#-188 compiler trap with SYSTEM.VAL
Re: issue#-188 compiler trap with SYSTEM.VAL
Is that consistent with the PSI, maybe that needs correcting?
- Josef Templ
- Posts: 2047
- Joined: Tue Sep 17, 2013 6:50 am
Re: issue#-188 compiler trap with SYSTEM.VAL
We can add a hint about possible restrictions with respect to different register sets.
The precise rule of what is allowed and what is not allowed is very complicated
and hard to describe in prose text.
- Josef
The precise rule of what is allowed and what is not allowed is very complicated
and hard to describe in prose text.
- Josef
-
- Posts: 204
- Joined: Wed Sep 18, 2013 10:06 pm
- Contact:
Re: issue#-188 compiler trap with SYSTEM.VAL
This sort of information is often best presented in a tabular form as in this example for SQL Server CAST and CONVERT:
Re: issue#-188 compiler trap with SYSTEM.VAL
I can't resist posting an interesting case I came across recently:This usually works fine, but TRAPs for m = -4503599627370495.
I am NOT claiming this is a bug, although the error report is less than transparent.
Code: Select all
VAR
m : LONGINT;
x : REAL;
BEGIN
...
x := SYSTEM.VAL (REAL, m)
I am NOT claiming this is a bug, although the error report is less than transparent.
- Josef Templ
- Posts: 2047
- Joined: Tue Sep 17, 2013 6:50 am
Re: issue#-188 compiler trap with SYSTEM.VAL
The error message is "undefined real result".
Most probably this specified bit pattern of m is not a valid IEEE floating point representation.
- Josef
Most probably this specified bit pattern of m is not a valid IEEE floating point representation.
- Josef
Re: issue#-188 compiler trap with SYSTEM.VAL
It is a valid (whatever that means in this context) "signalling NaN". If you include signalling NaNs, all bit patterns are valid.Josef Templ wrote:Most probably this specified bit pattern of m is not a valid IEEE floating point representation.
By way of explanation: -4503599627370496 corresponds to -INF, so this example is the smallest signalling NaN.
SYSTEM.VAL handles non-signalling NaNs perfectly well.
- Josef Templ
- Posts: 2047
- Joined: Tue Sep 17, 2013 6:50 am
Re: issue#-188 compiler trap with SYSTEM.VAL
Doesn't "signalling NaN" mean that it signals an error when it is used?Robert wrote: It is a valid (whatever that means in this context) "signalling NaN".
By way of explanation: -4503599627370496 corresponds to -INF, so this example is the smallest signalling NaN.
SYSTEM.VAL handles non-signalling NaNs perfectly well.
This is exactly what you observe, a trap.
- Josef