[Oberon] Fighting a dragon ...

Hans Klaver hklaver at dds.nl
Tue Jul 16 10:45:17 CEST 2024


On 16 July 2024, at 08:14 Jörg Straube wrote:

> To narrow done where the culprit is, you might know that Wirth’s Oberon compiler has an undocumented feature allowing to write the REALs directly in hex IEEE 754 notation. With this feature you are absolutely sure what REAL we are talking about.
> I use this in numerical algorithms, where it is important to have the REAL constants correct to the ulp.
>  
> CONST pi = 40490FDBR; (* pi is between 40490FDAR and 40490FDBR, closer to the latter *)
> Out.Real(40000001R, 12);
> Out.RealFix(40000001R, 12, 7)
> IF FLT(2) = 40000000R THEN Out.String("FLT okay") END;
> IF 3.14159265 = pi THEN Out.String(“compiler okay”) ELSE Out.String("compiler bad") END;

That's a handy feature indeed, especially when testing FLT, ORD or constants.

Testing with the line:

  IF FLT(2) = 40000000R THEN Out.String("FLT okay") END;

and getting the result "FLT okay" in an emulator without your proposed patch to fp.add() in risc-fp.c I conclude that that patch is not necessary. Is that a sound conclusion?

Regards,

Hans



More information about the Oberon mailing list