Remember that even though you initialized $a with 38071.63, the
internal number is stored in binary, not BCD, and .63 is an irrational
number as far as binary is concerned.  It just all depends on
where your perl was compiled, what math libraries are being used, and
how they represent their floating point numbers.<br>
<br>
Alternatives:<br>
<br>
1) If you're after two base-ten digits of precision you could mult by
100, round up, then compare.&nbsp; This is covered in section 2.3.3 of
Perl Cookbook, 2nd edition.<br>
<br>
2) Look at some of the better known perl math classes (Math::BigInt and Math::BigFloat come to mind).<br>
<br>
-Bill<br>
<br>
<br><br><div><span class="gmail_quote">On 9/13/05, <b class="gmail_sendername">HCoyote</b> &lt;<a href="mailto:hcoyote@ghostar.ath.cx">hcoyote@ghostar.ath.cx</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
On Mon, Sep 12, 2005 at 10:46:23AM -0500, David Bluestein II wrote:<br>&gt; Okay, I've seen this before and have a question how to avoid it.<br>&gt;<br>&gt; I take two variables:<br>&gt;<br>&gt; $a= 38071.63;<br>&gt; $b = $i + $j; # Where $i + $j =&gt; 
38071.63<br>&gt;<br>&gt; print &quot;$a : $b&quot;; # results in 38071.63 : 38071.63<br>&gt;<br>&gt; Yet if I do:<br>&gt;<br>&gt; if ($a == $b) {<br>&gt; print &quot;Equal&quot;;<br>&gt; } else {<br>&gt; print &quot;Not equal&quot;;
<br>&gt; }<br>&gt;<br>&gt; I get a &quot;Not equal&quot;.<br>&gt;<br>&gt; If I subtract ($b-$a) the result is 7.27595761418343e-12. How do I get<br>&gt; Perl to ignore this &quot;noise&quot; which comes from someplace?<br>
<br>I suggest a new computer. :-)<br><br>I can't get this to do the same thing on any system I test on.&nbsp;&nbsp;Does it happen only one<br>one system for you or is it consistently the same number?&nbsp;&nbsp;Does it change depending on<br>
your choice of $i and $j?<br><br><br>Travis<br>_______________________________________________<br>Austin mailing list<br><a href="mailto:Austin@pm.org">Austin@pm.org</a><br><a href="http://mail.pm.org/mailman/listinfo/austin">
http://mail.pm.org/mailman/listinfo/austin</a><br></blockquote></div><br>