Skip to content
Tcl Source Code Artifact [c27113cc10]
Login

Artifact [c27113cc10]

Artifact c27113cc102e658f532571518aa5b1d76a501386:

Ticket change [c27113cc10] - New ticket [2015452fffffffff|2015452fff] <i>Negative integer division is wrong if there is a remainder</i>. by karll on 2008-07-10 22:27:41.
D 2008-07-10T22:27:41
J assignee dkf
J cmimetype text/plain
J comment If\sI\sdivide\sa\snegative\sinteger\sby\san\sinteger\sand\sthere\sis\sa\sremainder,\sTcl\swill\sround\sthe\sresult\sdownward.\s\sThis\shas\sbeen\sreplicated\son\sMac\sand\sFreeBSD.\n\ntclsh8.4\n%\sexpr\s-501/500\n-2\n\n%\sexpr\s-1000001/1000000\n-2\n\nLet's\stry\sa\sC\sprogram\sto\ssee\sif\sI\sam\scrazy.\n\n$\scat\sfoo.c\n\nmain()\n{\n\s\s\s\sint\si\s=\s-86401\s/\s86400;\n\s\s\s\sprintf("%d\\n",\si);\n}\n\n$\scc\sfoo.c\n$\s./a.out\n-1\n\nIt\sworks\sas\sexpected.\n\n
J foundin obsolete:\s8.4.19
J is_private 0
J priority 9\sImmediate
J resolution None
J status Open
J submitter karll
J subsystem 16.\sCommands\sA-H
J title Negative\sinteger\sdivision\sis\swrong\sif\sthere\sis\sa\sremainder
J type Bug
K 2015452fffffffffffffffffffffffffffffffff
U karll
Z d8d521e2dbced79f9af73e58805d484a