Tcl Source Code

View Ticket
Login
Ticket UUID: 40f315bc23254916454748dce97ae62978ca9406
Title: [format %g] does not portably produce a Tcl number
Type: Bug Created on: 2014-10-22 12:41:49
Submitter: dgp Assigned to: kbk
Subsystem: 48. Number Handling Severity: Important
Priority: 8 Last modified: 2026-10-23 09:31:36
Status: Closed Closed by: serhiy.storchaka
Resolution: Fixed Closed on: 2026-10-23 09:31:36
Version: all
Description:
On Windows:

% expr [format %g [expr {1.0/0.0}]]
invalid character "#"
in expression "1.#INF"

Either we need to take control of [format]
so it stops producing renegade results like
this, or we need to expand our number parser
to recognize this string as a valid rep for
Inf.

Why o why o why o why....
User Comments:
serhiy.storchaka added on 2026-10-23 09:31:36:

With msvcrt.dll (e.g. MinGW builds), 8.6 still gave 1.#INF. Fixed on main and 9.0 by [185825858e], backported to 8.6 in [326e1bf923].