Files
pplus-library/pseudo/programs/51-ieee.pseudo
T
2026-10-06 09:57:04 -04:00

13 lines
560 B
Plaintext

// USE IEEE: NaN and the infinities flow through a calculation as IEEE 754 says, instead of stopping the run.
// EXPECT: infinity -infinity not a number
// EXPECT: TRUE TRUE FALSE TRUE
// EXPECT: not a number -infinity FALSE
USE IEEE
DECLARE Zero : FLOAT <- 0.0
DECLARE Inf : FLOAT
Inf <- 1.0 / Zero
DECLARE NotANumber : FLOAT <- Inf - Inf
OUTPUT Inf, " ", -Inf, " ", NotANumber
OUTPUT IS_INF(Inf), " ", IS_NAN(NotANumber), " ", NotANumber == NotANumber, " ", NotANumber != NotANumber
OUTPUT SQRT(-1.0), " ", LOG(0.0), " ", IS_FINITE(MAX_VALUE(FLOAT64) * 2.0)