<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div>Rob</div><div><br></div><div>It depends on the version of Oberon you're looking at.</div><div><br></div><div>In Oberon-2 there are five numeric types forming a hierarchy</div><div><span style="background-color: rgba(255, 255, 255, 0);"> LONGREAL >= REAL >= LONGINT >= INTEGER >= SHORTINT.</span></div><div> The division operator / always results in a real type:</div><div> If one operand is LONGREAL the result is LONGREAL, in all other cases the result is REAL.</div><div> 480 / 100 results in 4.8 (REAL) 480.D0 / 100 results in 4.8 (LONGREAL)</div><div><br></div><div>In Oberon-07 that's different.</div><div> Numeric types don't build a hierarchy and the operands of / have to have the same type.</div><div> 480 / 100 results in 4 (INTEGER) 480. / 100. result in 4.8 (REAL)<br><br>br, Jörg</div><div><br>Am 12.11.2014 um 02:18 schrieb rob solomon <<a href="mailto:drrob106@verizon.net">drrob106@verizon.net</a>>:<br><br></div><blockquote type="cite"><div>
<meta content="text/html; charset=windows-1252" http-equiv="Content-Type">
Not knowing much about oberon, but I have use modula-2 for many
years. I have one observation.<br>
<br>
r := 480 / 100 * 100;<br>
<br>
In modula-2, this line would not be allowed, as it is doing integer
arithmetic, getting an integer result, and they trying to assign
this integer result to a real number.<br>
<br>
Is oberon less type-strict? Is oberon more like C and Fortran in
this way?<br>
<br>
<br>
<br>
<div class="moz-cite-prefix">On 11/11/2014 11:15 AM, Felix Friedrich
wrote:<br>
</div>
<blockquote cite="mid:54623631.7060205@inf.ethz.ch" type="cite">
<meta content="text/html; charset=windows-1252" http-equiv="Content-Type">
<div class="moz-cite-prefix">Dear all,<br>
<br>
with respect to the differences you observe I would like to
point out that the variant of the underlying hardware and
compiler also play an important role. In addition to the
floating point standard. And also in addition to possible
compiler optimisations.<br>
<br>
Example: one compiler (e.g. older AOS compiler) may still emit
code for the FPU, which internally works with 80 bit precision.
The results are only truncated to 32 bit when writing back to a
general purpose register. So no loss of precision during
expression computation. On newer machines the same task is
usually computed on the SSE unit with 32-bit precision and the
precision is lost during computation already.<br>
<br>
So, there is nothing wrong with any of the implementations but
there are just implementation specific differences. Still, the
principles of "What Every Computer Scientist Should Know About
Floating-Point Arithmetic" do apply.<br>
<br>
Best regards<br>
Felix <br>
<br>
<br>
<br>
<br>
On 11.11.2014 15:50, Yaroslav Romanchenko wrote:<br>
</div>
<blockquote cite="mid:1415717428.950375192@f120.i.mail.ru" type="cite">
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
<p><br>
How many right suggestions. But... anyway something wrong with
real math in Oberon implementation, because same example in
BlackBox returns yet another result expected by Zdenek.</p>
<p>Code:<br data-mce-bogus="1">
</p>
<p>MODULE M1;<br>
<br>
IMPORT<br>
StdLog;<br>
<br>
PROCEDURE Do*;<br>
VAR<br>
r: REAL;<br>
BEGIN<br>
r := 480 / 100 * 100;<br>
StdLog.Int(ENTIER(r * 1000000));<br>
StdLog.Ln;<br>
END Do;<br>
<br>
BEGIN<br>
END M1.<br data-mce-bogus="1">
</p>
<p>Output:<br data-mce-bogus="1">
</p>
<p>480000000<br data-mce-bogus="1">
</p>
<p>Same result as BlackBox returned in commercial Embarcadero
RAD Studio using type corresponding single type.<br>
<br>
---<br>
Cheers, SAGE<br>
<a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://sage.com.ua/">http://sage.com.ua/</a><br>
</p>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">--
<a moz-do-not-send="true" class="moz-txt-link-abbreviated" href="mailto:Oberon@lists.inf.ethz.ch">Oberon@lists.inf.ethz.ch</a> mailing list for ETH Oberon and related systems
<a moz-do-not-send="true" class="moz-txt-link-freetext" href="https://lists.inf.ethz.ch/mailman/listinfo/oberon">https://lists.inf.ethz.ch/mailman/listinfo/oberon</a>
</pre>
</blockquote>
<br>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">--
<a class="moz-txt-link-abbreviated" href="mailto:Oberon@lists.inf.ethz.ch">Oberon@lists.inf.ethz.ch</a> mailing list for ETH Oberon and related systems
<a class="moz-txt-link-freetext" href="https://lists.inf.ethz.ch/mailman/listinfo/oberon">https://lists.inf.ethz.ch/mailman/listinfo/oberon</a>
</pre>
</blockquote>
<br>
</div></blockquote><blockquote type="cite"><div><span>--</span><br><span><a href="mailto:Oberon@lists.inf.ethz.ch">Oberon@lists.inf.ethz.ch</a> mailing list for ETH Oberon and related systems</span><br><span><a href="https://lists.inf.ethz.ch/mailman/listinfo/oberon">https://lists.inf.ethz.ch/mailman/listinfo/oberon</a></span><br></div></blockquote></body></html>