Originally posted by Robert Milfajt
The global variable tcl_precision determines the number of significant digits that are retained when floating values are converted to strings (except that trailing zeroes are omitted). If tcl_precision is unset then 6 digits of precision are used. To retain all of the significant bits of an IEEE floating-point number set tcl_precision to 17; if a value is converted to string with 17 digits of precision and then converted back to binary for some later calculation, the resulting binary value is guaranteed to be identical to the original one.
$ hcitclhcitcl>echo $tcl_precision0hcitcl>expr 2.8/70.39999999999999997hcitcl>expr 1.0/30.3333333333333333hcitcl>set tcl_precision 1616hcitcl>expr 2.8/70.4hcitcl>expr 1.0/30.3333333333333333hcitcl>set tcl_precision 1717hcitcl>expr 2.8/70.39999999999999997hcitcl>expr 1.0/30.33333333333333331hcitcl>