in reply to Re: Small Perl 6 discoveries II, Rats
in thread [Perl6] Small discoveries I, __DATA__

Alexander

--
Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)
  • Comment on Re^2: Small Perl 6 discoveries II, Rats

Replies are listed 'Best First'.
Re^3: Small Perl 6 discoveries II, Rats
by Anonymous Monk on Sep 27, 2017 at 19:05 UTC
    So the question becomes, why does perl6 print all those wrong digits?
    > perl5 -E 'say 1.111111111111111111111' 1.11111111111111 > perl6 -e 'say 1.111111111111111111111' 1.11111111111111111604544
      Are you trolling or what?

      Here Perl6 is 1000 times more accurate, it's just not lying to you about being arbitrarily precise. You will notice that 1.11111111111111 is three digits shorter than 1.11111111111111111 !

      And also:
      holli@605 ~ $ perl -e 'say "oops" unless 0.1 + 0.2 == 0.3' oops holli@605 ~ $ perl6 -e 'say "yeah" if 0.1 + 0.2 == 0.3' yeah


      holli

      You can lead your users to water, but alas, you cannot drown them.
        > perl5 -E 'say 3e-1 - .3' 0 > perl6 -e 'say 3e-1 - .3' 5.55111512312578e-17
      why does perl6 print all those wrong digits?

      There is a well-hidden message in the "wrong" digits. Click here and follow the links.

      Alexander

      --
      Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)
        Why the difference?
        > 111111111111111111111/1000000000000000000000 0.111111111111111 > .111111111111111111111 0.11111111111111111604544