Overview
| Artifact ID: | c27113cc102e658f532571518aa5b1d76a501386 |
|---|---|
| Ticket: | 2015452fffffffffffffffffffffffffffffffff
Negative integer division is wrong if there is a remainder |
| User & Date: | karll on 2008-07-10 22:27:41 |
Changes
- assignee changed to: "dkf"
- cmimetype changed to: "text/plain"
- comment changed to:
If I divide a negative integer by an integer and there is a remainder, Tcl will round the result downward. This has been replicated on Mac and FreeBSD. tclsh8.4 % expr -501/500 -2 % expr -1000001/1000000 -2 Let's try a C program to see if I am crazy. $ cat foo.c main() { int i = -86401 / 86400; printf("%d\n", i); } $ cc foo.c $ ./a.out -1 It works as expected. - foundin changed to: "obsolete: 8.4.19"
- is_private changed to: "0"
- priority changed to: "9 Immediate"
- resolution changed to: "None"
- status changed to: "Open"
- submitter changed to: "karll"
- subsystem changed to: "16. Commands A-H"
- title changed to:
Negative integer division is wrong if there is a remainder
- type changed to: "Bug"