Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2020-11-16
14:23 • Ticket [cb7aac6f2c] Alternate float format %#.0f returns "0." for &quo... artifact: 2f60de25c7 user: oehhar
2015-09-13
08:01 • Ticket [cb7aac6f2c]: 4 changes artifact: b8a18cbe1c user: dkf
2015-09-08
13:18 • Ticket [cb7aac6f2c]: 4 changes artifact: 9bfd2450f8 user: oehhar
13:12 • Ticket [cb7aac6f2c]: 4 changes artifact: 6c5023f554 user: oehhar
2015-08-31
11:07 • Ticket [cb7aac6f2c]: 4 changes artifact: db5beb3782 user: dkf
09:09 • New ticket [cb7aac6f2c]. artifact: f91d3ba7f8 user: oehhar

Alternate float format %#.0f returns "0." for "0.0"

Opencb7aac6f2c145538476e01df27213e2d2e9bc384Created 11 years agoUpdated 6 years ago
Descriptionwiki2015-08-31 09:09:27
I compiled the current trunk with VC6 and VC14 on Win 8.1 64 and got new test failures.

The test condition "eformat" is true on the VC14 compiled version and not on the VC6 compiled version.

This shows up new test errors, which fail on VC6 to, but don't show up as the tests are not executed (verified manualy in the console).

Specially the result "0." for %#.0f" puzzels me why I have chosen it as subject for the ticket.

The test errors are:

==== format-6.3 floating-point zeroes FAILED
==== Contents of test case:

    format "%#.4e %#.4f %#.4g" 0.0 0.0 0.0 0.0

---- Result was:
0.0000e+00 0.0000 0.0000
---- Result should have been (exact matching):
0.0000e+00 0.0000 0.000
==== format-6.3 FAILED

---- format-6.4 start
---- format-6.5 start


==== format-6.5 floating-point zeroes FAILED
==== Contents of test case:

    format "%#.0e %#.0f %#.0g" 0.0 0.0 0.0 0.0

---- Result was:
0.e+00 0. 0.0
---- Result should have been (exact matching):
0.e+00 0. 0.
==== format-6.5 FAILED

-Harald

dkf Ticket [cb7aac6f2c]: 4 changes [History diff]2015-08-31 11:07:12
oehharwiki2015-09-08 13:12:15

I have verified the two test cases on the VC6 compiled tcl manually. The issue is still there. They just don't show up as the tests are not executed.

oehharwiki2015-09-08 13:18:39

I have also tried it manualy on CentOS 6 with 8.5.7 and 8.6.4.

The bug is present on all platforms. E.g.

% format "%#.0f" 0.0
0.

Eventually this is ok, I don't know.

dkfhtml2015-09-13 08:01:42

This might be something where we just use libc to do the work, with the bug being there. (I vaguely remember that parts of the format code, particularly for complex formats, are like that.)

oehharwiki2020-11-16 14:23:27

Tested manually with tcl8.6.10, Win32bit ms-vc6:

% format "%#.0f" 0.0
0.

Log in (anonymous is fine) to add a comment.