# New Ticket Created by  Zefram 
# Please include the string:  [perl #128820]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org/Ticket/Display.html?id=128820 >


> 1180591620717411303424e0 == 1180591620717409992704e0
True
> 1180591620717411303424e0 === 1180591620717409992704e0
True

Say what?  These are distinct Num values, differing by 10 ulp.
These literals work fine in other contexts:

> my $a = 1180591620717411303424e0
1.18059162071741e+21
> my $b = 1180591620717409992704e0
1.18059162071741e+21
> $a.Int
1180591620717411303424
> $b.Int
1180591620717409992704
> $a == $b
False
> $a === $b
False

== and === give the right result when applied to $a and $b as here, or
when applied to declared constants ("constant \A = 118...").  They also
work fine when comparing a variable against a literal.  They go wrong when
applied directly to two literal expressions.  They also go wrong with some
more complex expressions that bring in both values as literals, such as if
both sides are multiplied by 1.0e0 or by a variable containing that value.

-zefram

Reply via email to