Tcl Source Code

Artifact [691918817f]
Login

Artifact 691918817fafa400a065c7c1a112ef92a18b2bce:

Attachment "a4numbers_bug.tcl" to ticket [1382287fff] added by thippler 2005-12-16 16:39:40.
# Since a4 a new string to number conversion technique has been introduced.
# This new behaviour (or it's side effects) can lead to severe program failures.
# The question is, can it be considered valid for "string is double" to return 0
# (false) while shimmering the Tcl_Obj in question to "double"?

#
# Example1:
# String rep and internal rep out of sync
#

# deliberately setting x to something not convertible to double
set x "17fishes"

#
# New string to number conversions in a4 leads to erronious behaviour here
#
set r [string is double $x]
# $r == 0, as expected, but the internal rep is shimmered to "double"
set r [string is double $x]
# $r == 1


#
# Example2:
# Inherently the same as Example1 but with (invalid) octal numbers
#

set x 0810; # invalid octal number
set r [string is double $x]
# $r == 0
set r [string is double $x]
# $r == 1