[Oberon] Assumed issue in the Lola-2 compiler

rochus.keller at bluewin.ch rochus.keller at bluewin.ch
Mon Apr 15 16:13:14 CEST 2019


@ Paul Reed:

>> -1/16 is -0.0625 not 0.  (I agree there are indeed multiple 
>> integer solutions if you don't also add the range restriction on r.)

>From the language report we can conclude that the operators and result of DIV and MOD (i.e. x, y, q and r) are (algebraic) integers.
We can also assume that in the equation 'x = q*y + r' the multiplication and addition are proper mathematical operators.
Since the given equation uses mathematical operators we can expect that rounding also follows proper mathematical rules. Therefore the rational number -1/16 is rounded to the algebraic integer 0, which would be the mathematically proper solution of  q = x DIV y = ( x - r ) / y with x = -1 and y = 16.

But as mentioned: I have a viable solution which re-uses features of C to simulate the Oberon implementation.

Best 
R.K.


More information about the Oberon mailing list