<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
font-size:10.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:70.85pt 70.85pt 2.0cm 70.85pt;}
div.WordSection1
{page:WordSection1;}
--></style>
</head>
<body lang="DE-CH" link="blue" vlink="purple" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;mso-fareast-language:EN-US">Hi<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;mso-fareast-language:EN-US">The limit of 2^24-1 makes somehow sense as you normally expect FLOOR(FLT(x)) = x<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;mso-fareast-language:EN-US">As the mantissa of a REAL is only 24 bits, all REALs larger than 2^24 are not exact:<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;mso-fareast-language:EN-US">As r := 2000000000.0 and r := 2000000189.0 have the same binary representation, FLOOR would return to all REALs in between the same value.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US">br<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US">Jörg<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal" style="margin-bottom:12.0pt"><b><span style="font-size:12.0pt;color:black">Von:
</span></b><span style="font-size:12.0pt;color:black">Oberon <oberon-bounces@lists.inf.ethz.ch> im Auftrag von Hans Klaver <hklaver@dds.nl><br>
<b>Datum: </b>Montag, 16. </span><span lang="EN-US" style="font-size:12.0pt;color:black">Januar 2023 um 13:13<br>
<b>An: </b>ETH Oberon and related systems <oberon@lists.inf.ethz.ch><br>
<b>Betreff: </b>[Oberon] Upper limit of FLOOR<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">Hi all,<br>
<br>
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: </span><a href="https://lists.inf.ethz.ch/pipermail/oberon/2020/015013.html)"><span lang="EN-US" style="font-size:11.0pt">https://lists.inf.ethz.ch/pipermail/oberon/2020/015013.html)</span></a><span lang="EN-US" style="font-size:11.0pt">.<br>
<br>
Some other Oberon-07 compilers (e.g. OBNC) do not have this limit. <br>
<br>
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.<br>
<br>
So why this limit? Does anyone have an opinion on this?<br>
<br>
If you would like to test these limits, you can use procedure TestRealIO.FltFloor which can be found here:
</span><a href="https://github.com/hansklav/Oberon-REAL-IO/blob/main/TestRealIO.Mod"><span lang="EN-US" style="font-size:11.0pt">https://github.com/hansklav/Oberon-REAL-IO/blob/main/TestRealIO.Mod</span></a><span lang="EN-US" style="font-size:11.0pt"><br>
<br>
Regards,<br>
<br>
Hans Klaver<br>
<br>
--<br>
Oberon@lists.inf.ethz.ch mailing list for ETH Oberon and related systems<br>
</span><a href="https://lists.inf.ethz.ch/mailman/listinfo/oberon"><span lang="EN-US" style="font-size:11.0pt">https://lists.inf.ethz.ch/mailman/listinfo/oberon</span></a><span lang="EN-US" style="font-size:11.0pt"><o:p></o:p></span></p>
</div>
</div>
</body>
</html>