[Oberon] Upper limit of FLOOR

Hans Klaver hklaver at dds.nl
Mon Jan 16 13:13:29 CET 2023


Hi all,

One of the gotcha's I encountered while trying to improve Texts.WriteRealFix was that in PO the standard function procedure FLOOR overflows for values > 16777215.00 (2^24-1) and not, as I expected, only for values > 2147483647.00 (2^31-1). I guess I'm not the only one who is surprised by this (see for instance: https://lists.inf.ethz.ch/pipermail/oberon/2020/015013.html).

Some other Oberon-07 compilers (e.g. OBNC) do not have this limit. 

For FLT I can understand the limit of 16777215 because larger integers do not always have an exact floating point representation. For FLOOR there is no parallel argument: every REAL up to 2147483647.00 can unequivocally be transferred to a 32-bit INTEGER.

So why this limit? Does anyone have an opinion on this?

If you would like to test these limits, you can use procedure TestRealIO.FltFloor which can be found here: https://github.com/hansklav/Oberon-REAL-IO/blob/main/TestRealIO.Mod

Regards,

Hans Klaver



More information about the Oberon mailing list