[Oberon] real math

Yaroslav Romanchenko tobject at bk.ru
Tue Nov 11 16:10:37 CET 2014


Type REAL has 7-8 significant digits according to different documentation for programming languages.
So, situation, described by Zdenek is not the case that affected by this limitation.
To see the limits, modify the Zdenek's example a bit (in BlackBox environment, for example).
This variant still returns correct result (we see that 8 digits are correct):
MODULE M1;
IMPORT
StdLog;
PROCEDURE Do*;
VAR
r: REAL;
BEGIN
r := 12345678 / 100 * 100;
StdLog.Int(ENTIER(r * 1000000));
StdLog.Ln;
END Do;
BEGIN
END M1.
Output: 12345678000000  --- It seems,  BlackBox StdLog.Int() capable of printing 64-bit integers, as this example works fine.
Then, lets add the '9' to our number... and we will get error, caused by REAL type limitations.
For 123456789 the output will be 123456788999999

---
Cheers, SAGE
http://sage.com.ua/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://lists.inf.ethz.ch/pipermail/oberon/attachments/20141111/53bdc9fb/attachment.html 


More information about the Oberon mailing list