On Fri, 20 Oct 2017 08:02:12 -0700, victor.a...@derpymail.org wrote:
> How to reproduce
> ----------------
> 
> perl6 -e 'my ($a, $b) = set(1e0), set(1e0 + 4e-15); say $a ~~ $b,
> $a.keys »≅« $b.keys'
> 
> Expected behavior
> -----------------
> 
> Prints `False(False)`.
> 
> Actual behavior
> ---------------
> 
> Prints `True(False)`.
> 
> This contradicts the documentation of the Setty ACCEPTS method:
> “Returns True if $other and self contain all the same elements, and no
> others.” The sets’ elements aren’t equal, or even approximately equal
> (≅), and yet ACCEPTS (~~) returns `True`.
> 
> Note that other set methods show similar behavior: `1e0 ⊖ (1e0 +
> 4e-15)` is the empty set, `set(1e0, 1e0 + 4e-15)` only has one
> element…
> 
> Version information
> -------------------
> 
> This is Rakudo version 2017.09 built on MoarVM version 2017.09.1
> implementing Perl 6.c.


By accident, I merged incorrect ticket… 

If you're fixing original issue, ignore the stuff about set()s…

For set() issue, it isn't to do with set()s but with .Str and .WHICH on a Num 
losing
a digit of precision. I see a couple of tickets[^1] for that issue already and I
recall dogbertt++ was trying to fix it awhile back.

    <Zoffix__> m: dd (1e0).Str, (1e0 + 4e-15).Str
    <camelia> rakudo-moar 765dd6944: OUTPUT: «"1"␤"1"␤»
    <Zoffix__> m: dd (1e0).WHICH, (1e0 + 4e-15).WHICH
    <camelia> rakudo-moar 765dd6944: OUTPUT: 
«ObjAt.new("Num|1")␤ObjAt.new("Num|1")␤»

[1] https://rt.perl.org/Ticket/Display.html?id=127201
[2] https://rt.perl.org/Ticket/Display.html?id=127184

Reply via email to