|
2010-12-01
| ||
| 23:46 | • Closed ticket [3120139fff]: Tcl_PrintDouble not locale-safe plus 3 other cha... artifact: ab926aa644 user: kennykb | |
|
2010-11-29
| ||
| 04:35 | • Ticket [3120139fff]: 4 changes artifact: 0112bd5a0b user: nijtmans | |
|
2010-11-28
| ||
| 00:50 | • Add attachment double.patch to ticket [3120139fff] artifact: 80c7f4ac7f user: kennykb | |
| 00:50 | • Ticket [3120139fff] Tcl_PrintDouble not locale-safe status still Open with 4... artifact: 1acc652273 user: kennykb | |
| 00:49 | • Ticket [3120139fff]: 4 changes artifact: ef55c33a76 user: kennykb | |
|
2010-11-26
| ||
| 23:56 | • New ticket [3120139fff]. artifact: 265180d0e9 user: hobbs | |
Tcl_PrintDouble not locale-safe
Closed / Fixed3120139fffffffffffffffffffffffffffffffffCreated 16 years agoUpdated 16 years ago
Descriptionplain2010-11-26 23:56:14
If the locale is set up to not be LC_NUMERIC=C, Tcl_PrintDouble can give odd behavior. I am able to reproduce this by using a French regional locale (Control Panel -> Regional Locale and Settings), starting python with tkinter, where they have called locale.setlocale(locale.LC_ALL, '') but this could occur in other instances of Tcl embedded. When in this case, Tcl_PrintDouble can produce odd results: (arelle) 61 % expr 2-0.1 1,8999999999999999.0 (arelle) 62 % set tcl_precision 5 5 (arelle) 63 % expr 2-0.1 1,9.0 This is because the .0 tack-on is locale-ignorant.
kennykbplain2010-11-28 00:49:55
The attached patch is a complete rewrite of TclDoubleDigits, motivated largely by performance considerations. It exploits a number of important special cases to avoid hideously expensive mp_div operations; for all numbers less than 10**26, it requires no mp_div calls, and for numbers in that range that are at least 10**-3, it requires no bignum arithmetic at all. It is well tested only on Linux-x86 -- and no attempt has been made to tweak the build system to add the two additional needed libtommath files to the MacOSX build. It should be at least vetted on Windows (and the Mac build repaired and tested) before committing. It's a big enough change that I'm a little nervous about backporting it, and I welcome advice.
kennykbplain2010-11-28 00:50:46
File Added - 394576: double.patch
nijtmansplain2010-11-29 04:35:14
Well, I object to the NaN-tests (util-14.1 and 14.2), without a proper discussion, related to bug 3105247. The fact that those tests were missing here, implies that the formatting of funky NaN values was an oversight, and not an intended behavior. (For the numerical parser, TIP #249, I believe it was intentional but that's tested somewhere else). And those tests have no relation to this bug #3120139 Apart from that, this patch looks good. The function's name is TclDoubleDigits, but in the test cases it is refered as Tcl_DoubleDigits; Was it originally meant to be public?
kennykb Closed ticket [3120139fff].
[History diff]2010-12-01 23:46:50
Log in (anonymous is fine) to add a comment.
Attachments:
- double.patch [download] added by kennykb on 2010-11-28 00:50:46. [details]