[Oberon] Assumed issue in the Lola-2 compiler

Chris Burrows chris at cfbsoftware.com
Tue Apr 16 13:17:44 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 8:15 PM
> To: oberon at lists.inf.ethz.ch
> Subject: Re: [Oberon] Assumed issue in the Lola-2 compiler
> 
> I have to correct my last post. My mathematical skills are obviously
> a bit rusty.
> 
> >> Oberon in contrast to C/C++ requires y and r to be >= 0 (y=0 is
> not
> >> forbidden)
> This is not fully correct since 0 <= r < y requires y to be greater
> than zero. So in Oberon a DIV or MOD by zero is not allowed. Only r=0
> is allowed. But the rest should be right (hopefully). Sorry for that.
> 

You beat me to it ;-) Unfortunately the rest is not right either.

Be aware first of all that my previous post was incorrect. The original case
was:

(-1) DIV 16 (which does equal -1)

I incorrectly restated this in my previous post as:

-1 DIV 16 

Which is quite different. In Oberon, this is equivalent to -(1 DIV 16)
(which does equal 0). Apologies for the confusion.

For more examples of the usage of DIV and MOD refer to Section 7.1 "The Type
INTEGER" in the document "Programming in Oberon (a Tutorial)" which you can
download from Wirth's website:

https://people.inf.ethz.ch/wirth/Oberon/index.html

For even more details of the issues involved Wirth commented on DIV and MOD
in a letter dated January 17, 1986 which was published in Issue #5 of Modus
News, the Newsletter for the Modula-2 Users Association. You can download a
copy from my website:

http://www.cfbsoftware.com/Modula2/Modus.aspx

When you download the extracts look for Issue #5: Letter on DIV, MOD, /, and
REM, Niklaus Wirth

Regards,
Chris Burrows

CFB Software
http://www.astrobe.com





More information about the Oberon mailing list