How does one print a maximum number of significant digits
past a decimal point? I thought sprintf("%.ng", val) would
do it.
It seems there may be a bug in %g.
sprintf("%.3g", 5.110) #=> 5.11
sprintf("%.3g", 55.110) #=> 55.1
sprintf("%.3g", 555.110) #=> 555
But
sprintf("%.3f", 5.110) #=> 5.110
sprintf("%.3f", 55.110) #=> 55.110
sprintf("%.3f", 555.110) #=> 555.110
Any ideas?
Thanks
=========================================================
Jim Freeze
jim / freeze.org
---------------------------------------------------------
No comment at this time.
http://www.freeze.org
=========================================================