package require math::bigfloat
namespace import ::math::bigfloat::*
set foo [fromstr 317.22 4]
In 8.4.1.4 the following prints 317.220, but in 8.5 it prints 0.000.
set sr [todouble $foo]
puts [format "%6.2f" $sr]
If I convert the bigfloat to a string, then convert the string back to
a float using scan, as below, the result is 317.220 in 8.5 as well as
8.4.14.
set str [tostr $foo]
scan $str "%f" sr
puts [format "%6.2f" $sr]
Is this a bug in todouble in 8.5?
In tcl 8.4.14 both
todouble is a command in the math::bigfloat namespace so it might not
have been updated to the new 8.5 float stuff with tcl_precision=0 yet.
If you set ::tcl_precision it might fix it, but thats not recommended
for 8.5. Better file a bug for the bigfloat package at tcllib. (and
check if the error exists with the latest version).
Michael
I just tried the above using the latest ActiveTcl 8.5.2 and latest
tcllib in the teapot repository and get the 0.00 from the puts.