No!

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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.