Artifacts Associated With Ticket b8e9a9a97f0d8be1
Ticket change [7f055435ec] (rid 169936) by anonymous on 2019-03-08 23:00:38:
- assignee initialized to: "nobody"
- closer initialized to: "nobody"
- cmimetype initialized to: "text/plain"
- comment initialized to:
It seems the number 52 is not handled correctly. See the math example below. 52 * 0.001 = 0.052000000000000005 0.52 * 0.01 = 0.005200000000000001 I can reproduce this issue in Tcl 8.6.8 for Windows and Tcl 8.5.9 for Windows. (bin) 1 % expr 1 + 3 4 (bin) 2 % expr 52 + 3 55 (bin) 3 % expr 52 * 0.01 0.52 (bin) 4 % expr 52 * 0.001 0.052000000000000005 (bin) 5 % expr 0.52 * 0.01 0.005200000000000001
- foundin initialized to: "Tcl 8.6.8 for Windows"
- is_private initialized to: "0"
- login: "anonymous"
- priority initialized to: "5 Medium"
- private_contact initialized to: "69a9682e5af36190bd20b47267a61c36b8a00759"
- resolution initialized to: "None"
- severity initialized to: "Critical"
- status initialized to: "Open"
- submitter initialized to: "anonymous"
- subsystem initialized to: "48. Number Handling"
- title initialized to: "expr 52 * 0.001 = 0.052000000000000005"
- type initialized to: "Bug"
Ticket change [045f68dc9d] (rid 169937) by anonymous on 2019-03-08 23:23:49:
- comment changed to:
It seems tcl needs to consider how to handle math correctly. See the math example below. It will mess up the results in most of the cases, as long as the user does some simple math. 52 * 0.001 = 0.052000000000000005 0.52 * 0.01 = 0.005200000000000001 0.1 + 0.2 = 0.30000000000000004 I can reproduce this issue in Tcl 8.6.8 for Windows and Tcl 8.5.9 for Windows. (bin) 1 % expr 1 + 3 4 (bin) 2 % expr 52 + 3 55 (bin) 3 % expr 52 * 0.01 0.52 (bin) 4 % expr 52 * 0.001 0.052000000000000005 (bin) 5 % expr 0.52 * 0.01 0.005200000000000001 (bin) 8 % expr 0.1 + 0.2 0.30000000000000004
- login: "anonymous"
- mimetype: "text/plain"
- comment changed to:
Ticket change [8f6be2c87a] (rid 169938) by anonymous on 2019-03-08 23:34:41:
- comment changed to:
It seems tcl needs to consider how to handle math correctly. See the math example below. It will mess up the results in most of the cases, as long as the user does some simple math. We know it is a floating point number problem for computer and many computer languages. But it is still good to have a better solution. 52 * 0.001 = 0.052000000000000005 0.52 * 0.01 = 0.005200000000000001 0.1 + 0.2 = 0.30000000000000004 I can reproduce this issue in Tcl 8.6.8 for Windows and Tcl 8.5.9 for Windows. (bin) 1 % expr 1 + 3 4 (bin) 2 % expr 52 + 3 55 (bin) 3 % expr 52 * 0.01 0.52 (bin) 4 % expr 52 * 0.001 0.052000000000000005 (bin) 5 % expr 0.52 * 0.01 0.005200000000000001 (bin) 8 % expr 0.1 + 0.2 0.30000000000000004
- login: "anonymous"
- mimetype: "text/plain"
- comment changed to:
Ticket change [751e75aef2] (rid 169939) by anonymous on 2019-03-08 23:47:17:
- comment changed to:
It seems tcl needs to consider how to handle math correctly. See the math example below. It will mess up the results in most of the cases, as long as the user does some simple math. We know it is a floating point number problem for computer and many computer languages. But it is still good to have a better solution than "set tcl_precision 12". 52 * 0.001 = 0.052000000000000005 0.52 * 0.01 = 0.005200000000000001 0.1 + 0.2 = 0.30000000000000004 I can reproduce this issue in Tcl 8.6.8 for Windows and Tcl 8.5.9 for Windows. (bin) 1 % expr 1 + 3 4 (bin) 2 % expr 52 + 3 55 (bin) 3 % expr 52 * 0.01 0.52 (bin) 4 % expr 52 * 0.001 0.052000000000000005 (bin) 5 % expr 0.52 * 0.01 0.005200000000000001 (bin) 8 % expr 0.1 + 0.2 0.30000000000000004
- login: "anonymous"
- mimetype: "text/plain"
- comment changed to:
Ticket change [83c335ae7c] (rid 170005) by bll on 2019-03-11 06:35:57:
- icomment:
Seems to be right. format is your friend. bll-tecra:bll$ cat t.c #include <stdio.h> #include <stdlib.h> main () { double a = 0.1; double b = 0.2; printf ("%.20g\n", a + b); } bll-tecra:bll$ ./t 0.30000000000000004441 - login: "bll"
- mimetype: "text/plain"
- icomment:
Ticket change [25d7113c25] (rid 170079) by jan.nijtmans on 2019-03-12 20:42:26:
- closedate changed to: "2458555.36281054"
- closer changed to: "jan.nijtmans"
- icomment: "Normal behavior, so closing as "invalid""
- login: "jan.nijtmans"
- mimetype: "text/plain"
- resolution changed to: "Invalid"
- status changed to: "Closed"