Just bumped into this problem.

Some calculations seem to make a number become a "hidden" real number instead of an integer. The number prints as an integer, but after a substraction with another integer, the result is a real.

```#!/usr/bin/perl

use strict; use warnings;

my (\$x1, \$x2) = (256080, 258160);
my \$diff      = \$x2 - \$x1;

print "x1=\$x1, x2=\$x2, diff=\$diff\n"; # OK

\$x2 = 1000*240 + 1000*18 + 1000*( 4/25 );
\$diff = \$x2 - \$x1;
print "x1=\$x1, x2=\$x2, diff=\$diff\n"; # Also OK

\$x2 = 1000 * ( 4*60 + 18 + 4/25 );
\$diff = \$x2 - \$x1;
print "x1=\$x1, x2=\$x2, diff=\$diff\n"; # \$x2 is integer, but \$diff is real!
```

The output is:

```x1=256080, x2=258160, diff=2080
x1=256080, x2=258160, diff=2080
x1=256080, x2=258160, diff=2080.00000000003```

Or the short one-liner version: perl -e '\$x1=256080; \$x2 = 1000 * ( 4*60 + 18 + 4/25 ); \$diff=\$x2-\$x1; print "x1=\$x1, x2=\$x2, diff=\$diff, Perl=\$^V\n";'

I tried this on Perl versions v5.14.2, v5.18.2 and v5.20.2 with the same result. It is disconcerting that \$x2 prints as "258160", but becomes something else when used in a substraction.

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

• Are you posting in the right place? Check out Where do I post X? to know for sure.
• Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
• Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
• Want more info? How to link or or How to display code and escape characters are good places to start.