Gentlemen, Can you please help me understand why this calculation is coming out to be wrong? I was expecting int (42435.3408/411.9936) as 103. Perl prints the result is 103 but when used int function on the result it is getting 102!! Here is the code to reproduce the issue... $i = (42435.3408/411.9936); $j = $i; $k = int $j; $l = int(103); print "$i, $j, $k, $l\n"; It prints 103, 103, 102, 103 Should the value of $l be 103? If I use pragma integer (use integer;) at the top then all varaibles are showing 103. I wanted it to be 103 without having to explicitly 'rounding'. Thanks for the help. -Anju

In reply to Why the Integer part of this calculation is 102? by alokam

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.