[Oberon] real math
felix.friedrich at inf.ethz.ch
Tue Nov 11 17:15:45 CET 2014
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.
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.
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
On 11.11.2014 15:50, Yaroslav Romanchenko wrote:
> 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.
> MODULE M1;
> PROCEDURE Do*;
> r: REAL;
> r := 480 / 100 * 100;
> StdLog.Int(ENTIER(r * 1000000));
> END Do;
> END M1.
> Same result as BlackBox returned in commercial Embarcadero RAD Studio
> using type corresponding single type.
> Cheers, SAGE
> Oberon at lists.inf.ethz.ch mailing list for ETH Oberon and related systems
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Oberon