If you are assigning a decimal floating point numeric value to a variable in the code, just put it in there like you would do it on a calculator.
On the calculator keypad, to multiply 0000.7 x 4, I don't put in 0000.7 x 4 or even 00.7 x 4 - I would put just .7 x 4 or at most 0.7 x 4 and be done with it. That works for Perl variable assignment.
Extra leading zero's past what is required messes thing up!
But that only happens in an explicit assignment in the actual code - not when a variable is read from a file.
This octal stuff is legacy stuff, the halt instruction on one computer I worked was 063077 (octal) - as near I as remember - octal math is very rare nowadays, but the legacy exists and will continue to exist (e.g. Unix permission masks). It normally has no place in Perl math assignments.
If you make an explicit assignment like $x =0.7876543, don't code it as $x =00.7876543
No special care is needed when reading from a file.
In reply to Re^5: Perl with precision
by Marshall
in thread Perl with precision
by AlienSpaces
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |