DIV negative divisor

Programming language questions

DIV negative divisor

Postby Ivan Denisov » Sat Jun 30, 2018 6:45 am

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.
User avatar
Ivan Denisov
 
Posts: 227
Joined: Tue Sep 17, 2013 12:21 am
Location: Krasnoyarsk, Russia

Re: DIV negative divisor

Postby cfbsoftware » Sat Jun 30, 2018 7:20 am

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

Re: DIV negative divisor

Postby Josef Templ » Sun Jul 01, 2018 6:29 am

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


Return to Component Pascal

Who is online

Users browsing this forum: No registered users and 0 guests

cron