Page 1 of 1

DIV negative divisor

PostPosted: Sat Jun 30, 2018 6:45 am
by Ivan Denisov
There is the discussion in OberonCore board about the negative divisor.

Oberon-2 XDS compiler does not allow to use negative divisor:
https://forum.oberoncore.ru/viewtopic.p ... 95#p104595

IMHO, it is good to implement the same run-time exception handling for BlackBox.

Re: DIV negative divisor

PostPosted: Sat Jun 30, 2018 7:20 am
by cfbsoftware
No - not unless you are proposing a language change. The same rules do not apply to Component Pascal. The definition of DIV in Component Pascal is different from the definition of DIV in Oberon.

Component Pascal specifically allows negative divisors and gives examples of the behaviour. Oberon specifically excludes negative divisors. Refer to Paragraph 8.2.2 Arithmetic Operators in both the Component Pascal Language Report (last update October 2006) and The Programming Language Oberon (Revision 1.10.2013 / 3.5.2016).

Re: DIV negative divisor

PostPosted: Sun Jul 01, 2018 6:29 am
by Josef Templ
DIV with negative divisor is a rarely used feature.
In practice the difference to XDS-Oberon with respect to DIV/MOD will hardly be observed.

CP, as Chris pointed out, defines it in the language in a meaningful way
with simple equations connecting DIV and MOD.

There is not much value in changing that.

- Josef