: <i>Negative integer division is wrong if there is a remainder</i> plus 7 other changes
by
.
D 2008-07-11T05:44:29
J closedate 2008-07-10T22:44:29
J closer msofer
J icomment Logged\sIn:\sYES\s\nuser_id=148712\nOriginator:\sNO\n\nThe\sproblem\sis\swith\sthe\sexpectation!\sThis\sis\sthe\sbehaviour\sby\sdesign.\n\nFrom\sthe\sexpr\sman\spage:\s"Multiply,\sdivide,\sremainder.\sNone\sof\sthese\soperators\smay\sbe\sapplied\sto\sstring\soperands,\sand\sremainder\smay\sbe\sapplied\sonly\sto\sintegers.\sThe\sremainder\swill\salways\shave\sthe\ssame\ssign\sas\sthe\sdivisor\sand\san\sabsolute\svalue\ssmaller\sthan\sthe\sdivisor."\n\nThe\sobserved\sbehaviour\sis\simplied\sby\sthis\sand\sgeneral\sidentity\sfor\sintegers\n\s\s\sa\s=\s(a/b)*b\s+\s(a%b)\n\nNote\sthat\sthe\sC\sstandard\smakes\sno\ssuch\spromises\sabout\sthe\ssign\sof\sthe\sremainder,\sdifferent\simplementations\smay\sgive\sdifferent\sresults.\n\nNote\salso\sthat\sthere\sis\sno\s"rounding",\sneither\sup\snor\sdown:\sthis\sis\sjust\sthe\sway\sthat\sinteger\sdivision\sis\sdefined.\n
J login msofer
J mimetype text/plain
J resolution Invalid
J status Pending
J username msofer
K 2015452fffffffffffffffffffffffffffffffff
U msofer
Z 4a3f7d2a283a97e962d01b814bc61876