Modulo Bug?
monarch_dodra
monarchdodra at gmail.com
Fri Sep 7 06:20:35 PDT 2012
On Saturday, 11 August 2012 at 18:54:09 UTC, Thiez wrote:
> A few extra instructions (a CMOV followed by ADD should
> suffice, yes?) seems like a small price to pay if it can
> prevent bugs. Why hasn't the Python-modulo been made the
> default back when D was designed? The ever-so-slightly more
> efficient C-modulo could be provided in a library. Of course
> it's way too late to change it now...
According to TDPL regarding integral math: "Anything that
compiles in both C and D WILL produce the same results".
Anything less would make porting code a nightmare.
=>It is absolutely not conceivable to change "%" semantics'.
However, D *could* provide the "Mathematician's Modulo" operator,
either as a library functionality, or as a new operator.
I guess there hasn't been "a strong need" yet.
More information about the Digitalmars-d
mailing list