Tcl Source Code

View Ticket
Login
Ticket UUID: cb7aac6f2c145538476e01df27213e2d2e9bc384
Title: Alternate float format %#.0f returns "0." for "0.0"
Type: Bug Version: trunk
Submitter: oehhar Created on: 2015-08-31 09:09:27
Subsystem: 16. Commands A-H Assigned To: dgp
Priority: 5 Medium Severity: Minor
Status: Open Last Modified: 2020-11-16 14:23:27
Resolution: None Closed By: nobody
    Closed on:
Description:

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

User Comments: oehhar added on 2020-11-16 14:23:27:

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

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


dkf added on 2015-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.)


oehhar added on 2015-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.


oehhar added on 2015-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.