[Oberon] Assumed issue in the Lola-2 compiler
Chris Burrows
chris at cfbsoftware.com
Tue Apr 16 14:16:56 CEST 2019
> -----Original Message-----
> From: Oberon [mailto:oberon-bounces at lists.inf.ethz.ch] On Behalf Of
> rochus.keller at bluewin.ch
> Sent: Tuesday, 16 April 2019 9:09 PM
> To: oberon at lists.inf.ethz.ch
> Subject: Re: [Oberon] Assumed issue in the Lola-2 compiler
>
> @ Chris Burrows:
>
> Thanks for the clarifications.
>
> >> I incorrectly restated this in my previous post as: -1 DIV 16
> This is equal to "(-1) DIV 16" since the minus prefix associates with
> the one, not the whole expression, isn't it?
>
No. As I said, in Oberon -1 DIV 16 is NOT equal to (-1) DIV 16. It is equal
to -(1 DIV 16).
>
> Even with your clarifications I still consider it undecidable from
> the Oberon report whether "(-1) DIV 16" is zero or -1.
I don't see how you could come to that conclusion.
Let me try again:
q = x DIV y
so:
x = -1
y = 16
and you are suggesting that q can equal zero. If we assume that it does,
then:
x = q*y + r
becomes:
-1 = r.
That is not possible as 0 <= r < 16. Hence q *cannot* equal zero.
--------------------------------------------------------------
Now let's assume q = -1 which I claim it is.
x = q*y + r
becomes:
-1 = (-1 * 16) + r
Hence
r = 15 which *does* satisfy the condition 0 <= r < 16.
The definition in the Oberon Report is necessary and sufficient.
Regards,
Chris Burrows
CFB Software
http://www.astrobe.com
More information about the Oberon
mailing list