issue with system.val(float, constant)
Issue with system.val for float constant
MODULE TestCast;
IMPORT SYSTEM;
CONST pi = UNSIGNED64(0x40091EB851EB851F); (*3.14*)
PROCEDURE Do*;
VAR d: RECORD f: FLOAT64; bits { OFFSET=0 }: SET64 END;
BEGIN
d.f := 3.14;
TRACE( d.f, d.bits);
d.bits := SET64(pi);
TRACE( d.f, d.bits);
VAR u64 := pi: UNSIGNED64;
d.f := SYSTEM.VAL(FLOAT64, u64); (* OK *)
TRACE( d.f, d.bits);
d.f := SYSTEM.VAL(FLOAT64, pi); (* BAD *)
TRACE( d.f, d.bits);
END Do;
END TestCast.
System.Free TestCast ~
TestCast.Do ~