RE :Update: Actually, %.{$var}f doesn't do any trick except to produce an "Invalid conversion in printf..." warning. But the syntax is correct in the OPed example code: printf( "%.${dig}f", $num );
works for me in :
perl 5, version 20, subversion 2 (v5.20.2) built for x86_64-linux-gnu-thread-multi (with 101 registered patches)
Doesn't throw any warnings.
And sorry for the obviously FAQ however I was surprised that the data changed as I had not done any mathematical calculation on it just stored it and asked for some of it back. However I have obviously specified it is a numerical value by using printf.
Oh and I have now read " What Every Programmer Should Know About Floating-Point Arithmetic."
Consider me (somewhat) enlightened (on this topic).
and when I get a minute I will look at Math::BigFloat:
Many thanks
Cleggy
In reply to Re^2: Why do I get random numbers?
by Cleggy
in thread Why do I get random numbers?
by Cleggy
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |