A REAL bad program compiles well
Posted: Tue Jan 05, 2021 12:38 pm
Colleagues,
As far as I understand, -0.4523987 cannot be represented in the 4-byte format. In this case, I would regard s := -0.4523987 to be a bad program, and expect an error message from the compiler. Just as if i: INTEGER then i := MAX(INTEGER) + 1 is a bad program, and if sh: SHORTCHAR then sh := 100X is a bad program, and both are regarded by the compiler as such.
However, I don't have any experience with REAL numbers. Is my expectation wrong? The Language reports states of literals:
Code: Select all
PROCEDURE Really*;
VAR s: SHORTREAL; r: REAL;
BEGIN s := -0.4523987; r := -0.4523987; Log.Real(s); Log.Char(' '); Log.Real(r)
END Really;
(* output: -0.4523986876010895 -0.4523987 *)
However, I don't have any experience with REAL numbers. Is my expectation wrong? The Language reports states of literals:
LR, 3. Vocabulary and representation wrote:A real number is always of type REAL