DIV negative divisor

Programming language questions
Post Reply
User avatar
Ivan Denisov
Posts: 362
Joined: Tue Sep 17, 2013 12:21 am
Location: Krasnoyarsk, Russia

DIV negative divisor

Post 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.
cfbsoftware
Posts: 55
Joined: Wed Sep 18, 2013 10:06 pm
Contact:

Re: DIV negative divisor

Post 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).
Josef Templ
Posts: 262
Joined: Tue Sep 17, 2013 6:50 am

Re: DIV negative divisor

Post 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
Post Reply