Artifacts Associated With Ticket 2954959fffffffffffffffffffffffffffffffff
Ticket change [84de7b02fe] (rid 117634) by fridolin on 2010-02-19 13:43:08:
- assignee initialized to: "dgp"
- cmimetype initialized to: "text/plain"
- comment initialized to:
% expr abs(0.0) -0.0 Tcl version is 8.5.5, but it guess it's also in CVS (core-8-5-branch): tclBasic.c (abs function) 7437 if (d <= 0.0) { 7438 Tcl_SetObjResult(interp, Tcl_NewDoubleObj(-d)); 7439 } else { 7440 Tcl_SetObjResult(interp, objv[1]); 7441 } should be 7437 if (d < 0.0) { 7438 Tcl_SetObjResult(interp, Tcl_NewDoubleObj(-d)); 7439 } else { 7440 Tcl_SetObjResult(interp, objv[1]); 7441 } - foundin initialized to: "None"
- is_private initialized to: "0"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- status initialized to: "Open"
- submitter initialized to: "fridolin"
- subsystem initialized to: "48. Number Handling"
- title initialized to: "expr abs(0.0) is -0.0"
- type initialized to: "Bug"
Ticket change [7b4f9b6338] (rid 90496) by nijtmans on 2010-02-19 21:09:45:
- icomment:
Yes, this problem is in head as well. And the same for TCL_NUMBER_LONG. There the "<=" should be "<" as well. The effect is only the unnecessary creation of an object, but still.....
- login: "nijtmans"
- mimetype: "text/plain"
- username: "nijtmans"
- icomment:
Ticket change [90b5af6ca4] (rid 120497) by dgp on 2010-02-19 22:52:42:
- assignee changed to: "nijtmans"
- icomment:
Please fix. Thanks!
- login: "dgp"
- mimetype: "text/plain"
- username: "dgp"
Ticket change [d4034beb2f] (rid 123374) by nijtmans on 2010-02-20 06:39:06:
- icomment:
Turns out not that trivial to fix. See: also [Bug 1893815] tcl::mathfunc commands and non-canonical string reps
- login: "nijtmans"
- mimetype: "text/plain"
- username: "nijtmans"
- icomment:
Ticket change [f09bc8a449] (rid 109218) by nijtmans on 2010-02-21 15:59:05:
- icomment:
Fixed in HEAD, to be backported to 8.5 and 8.4
- login: "nijtmans"
- mimetype: "text/plain"
- username: "nijtmans"
- icomment:
Ticket change [7711fb6cb8] (rid 105699) by dkf on 2010-02-21 16:21:14:
- foundin changed to: "obsolete: 8.5.5"
- priority changed to: "7 High"
- resolution changed to: "Fixed"
Ticket change [7309fa5240] (rid 104975) by nijtmans on 2010-02-22 17:45:35:
- foundin changed to: "obsolete: 8.5.8"
- icomment:
Added some more tests, just to prove that the TCL_NUMBER_LONG was not quite right either. The problem is that in ieee floating point math, -0.0 == 0.0 gives true! This means that you cannot really distinguish -0.0 and 0.0 in floating point math. Looking at the test cases, the rule seems to be: - If the input looks negative, take the negative of the output and take that as a result. - otherwise, take the unchanged input. No, what looks negative? For example, -0.0 and -0 look negative, but really are not: they are both forms of zero! Still, we want to output resp. 0.0 and 0 in those cases. So, we need to distinguish between -0.0 and 0.0 (in the float case) and between 0 and -0 (in the long case). How do we do that. In the float case, we can use memcmp(). In the long case, I see no other way to look for ´-´ characters (if there is a string representation). Anyway, this way I could make all test cases pass. For 8.4 the story is a little bit different. The only 'mistake' was that abs(-0.0) returns -0.0, which is in fact correct, but not expected regarding the above rules. Numbers like 1e-324 result in an underflow immediately in 8.4, it seems not worth to fix that. But the abs(-0.0) case still can be fixed, therefore leaving this issue open.
- login: "nijtmans"
- mimetype: "text/plain"
- username: "nijtmans"
Ticket change [c4ffc3d912] (rid 111919) by dkf on 2010-02-22 21:50:55:
- icomment:
In the 'long' case, if you've got -0 then you're on a ones-complement machine and we no longer guarantee Tcl to work right. :-)
- login: "dkf"
- mimetype: "text/plain"
- username: "dkf"
- icomment:
Ticket change [93fe7b7ea7] (rid 105907) by nijtmans on 2010-02-22 22:06:23:
- icomment:
>In the 'long' case, if you've got -0 then you're on a ones-complement >machine and we no longer guarantee Tcl to work right. :-) What happened, is that: expr {abs(0x0)} --> 0 expr {abs(0x1)} --> 0x1 I would at least expect the two answers to have the same form.... That's what this fix is about in the "long" case - login: "nijtmans"
- mimetype: "text/plain"
- username: "nijtmans"
- icomment:
Ticket change [b7d72bd9b4] (rid 128866) by nijtmans on 2010-02-22 22:10:50:
- icomment:
Oh no, I meant ::tcl::mathfunc::abs 0x0 --> 0 (old output) 0x0 (new output) ::tcl::mathfunc::abs 0x1 --> 0x1 That's what this fix is about regarding longs in Tcl 8.5/8.6. In Tcl 8.4 there is no ::tcl::mathfunc::abs, so this is no issue.
- login: "nijtmans"
- mimetype: "text/plain"
- username: "nijtmans"
- icomment:
Ticket change [d04afddc44] (rid 113153) by nijtmans on 2010-02-23 07:00:21:
- closedate changed to: "2010-02-23T00:00:21"
- closer changed to: "nijtmans"
- icomment:
allow_comments - 1 Relevant test cases backported to Tcl 8.4 as well, and minor fix applied to tclExecute.c to make them all pass. DONE
- login: "nijtmans"
- mimetype: "text/plain"
- status changed to: "Closed"
- username: "nijtmans"