Subject: octal/hex/float/decimal conversions???? - DN [1]


"Craig A. Goodman" <craig_goodman@non.hp.com> - 26 Apr 2000 - comp.lang.tcl

 I have discovered (thanks to Cameron Laird) that when I have a zero as
 the starting character in a string representing a numeric it is treated
 as an octal. i.e. 00000514 converts, using a [format "%d" $variable]
 command to 332 decimal. I put a 0x in the beginning of the string (i.e.
 0x0000000514) and it converts into 1300 decimal, as it should.

 NOW, I have a similar problem with a float string, I have the string
 3fa22435 which I want to convert to a float number (i.e. 6.54 or
 whatever). Is there anything I can add to the string to make it convert
 to a float such as the 0x added to the hex??? If not, how can I convert
 it???

Last modified
2000-07-20

(195.108.246.52)

Note: you are looking at
the snapshot of an old wiki
- much of this information
is likely to be very outdated