Specifications
Section 19. Troubleshooting
19-4
TABLE 19.1-1. Math Expressions and CRBASIC Results
Expression CRBASIC Expression Result
0 / 0 0 / 0 NAN
∞ - ∞ (1 / 0) - (1 / 0) NAN
(-1)
∞
-1 ^ (1 / 0) NAN
0 * -∞ 0 * (-1 * (1 / 0)) NAN
±∞ / ±∞ (1 / 0) / (1 / 0) NAN
1
∞
1 ^ (1 / 0) NAN
0 * ∞ 0 * (1 / 0) NAN
x / 0 1 / 0 INF
x / -0 1 / -0 INF
-x / 0 -1 / 0 -INF
-x / -0 -1 / -0 -INF
∞
0
(1 / 0) ^ 0 INF
0
∞
0 ^ (1 / 0) 0
0
0
0 ^ 0 1
19.1.4.3 Data Types, NAN, and ±INF
NAN and ±INF are presented differently depending on the declared variable
data type. Further, they are recorded differently depending on the final storage
data type chosen compounded with the declared variable data type used as the
source (TABLE 19.1-2). For example, INF
in a variable declared as LONG is
represented by the integer -2147483648. When that variable is used as the
source, the final storage word when sampled as UINT2 is stored as 0.
TABLE 19.1-2. Variable and FS Data Types with NAN and ±INF
Test FS FS FS FS FS FS
Expression Variable FP2 IEEE4 UINT2 STRING BOOL LONG
As FLOAT
Jan-00 INF INF INF 65535 +INF TRUE 2,147,483,647
0 / 0 NAN NAN NAN 0 NAN TRUE -2,147,483,648
As LONG
1 / 0 2,147,483,647 7999 2.147484E+09 65535 2147483647 TRUE 2,147,483,647
0 / 0 -2,147,483,648 -7999 -2.147484E+09 0 -2147483648 TRUE -2,147,483,648
As Boolean
1 / 0 TRUE -1 -1 65535 -1 TRUE -1
0 / 0 TRUE -1 -1 65535 -1 TRUE -1
As STRING
1 / 0 +INF INF INF 65535 +INF TRUE 2,147,483,647
0 / 0 NAN NAN NAN 0 NAN TRUE -2,147,483,648