Modulo Bug?

Norbert Nemec Norbert at Nemec-online.de
Sat Aug 11 10:15:19 PDT 2012


On 11.08.2012 18:13, bearophile wrote:
> David:
>
>> Thanks! I thought modulo should alawys yield the same ... seems like I
>> was wrong ;)
>
> It's C design that's wrong.

And it's the processor design that makes it inefficient to correct it 
nowadays.

Python's definition of modulo is far more useful than C's. Implemented 
in machine code, however, it takes several additional commands because 
the integer division is hardwired to the C definition. I guess that 
hardware integer division in processors became popular only when C was 
already widely in use.



More information about the Digitalmars-d mailing list