Skip to content
Tcl Source Code View Ticket
Login

View Ticket

[expr], [string is double] disagree

Closed / Fixed523537ffffffffffffffffffffffffffffffffffCreated 25 years agoUpdated 22 years ago
Descriptionplain2002-02-27 19:05:32
% set a 1.5
1.5
% set b 0x1.8p0
0x1.8p0
% expr {$a == $b}
0
% lsort -real [list $a $b]
1.5 0x1.8p0
% expr {$a == $b}
1
% expr {$a + 0}
1.5
% expr {$b + 0}
can't use non-numeric string as operand of "+"
% string is double $a
1
% string is double $b
1

At issue is whether or not "hexadecimal
floating-point literals" are recognized
by Tcl as valid floating point values.

As more C libraries become C99 compliant, their
strtod() will recognize these, but other parts
of Tcl do not.  Tcl should make one choice or
the other and be consistent about it.

One answer would be to force pre-C99 behavior
by detecting C99 behavior with configure and
linking in compat/strtod.c if it is found.
mdejongplain2002-06-07 06:12:32
Logged In: YES 
user_id=90858

Umm, I am not really sure what to do about this
one. Does someone else want to take the lead on
this?
dgpplain2002-06-07 21:19:24
Logged In: YES 
user_id=80530

I'll take it.  Will assign it back when I have a patch
for you to evaluate.
dgpplain2004-07-13 21:22:08
Logged In: YES 
user_id=80530

See TIP 132.
dgpplain2005-03-16 23:41:49
Logged In: YES 
user_id=80530

confirmed the candidate
TIP 132 implementation fixes
this bug.  Assign to kennykb
for closing when TIP 132 goes
final.
kennykbplain2005-05-11 02:09:22
Logged In: YES 
user_id=99768

TIP #132 now final; closing the bug.
Log in (anonymous is fine) to add a comment.