News for hackers. Stuff that matters.
Re:0.3 - 0.2 == 0.2 - 0.1 is falsy. Which language gets this... by draegtun on Friday October 05, 2012 @06:11AM (#4616278)
Perl6 gets it right:

  $ perl6
  > (0.3 - 0.2) == (0.2 - 0.1)
  True
Because Perl6 use Rationals by default:

  > (0.3 - 0.2).perl
  1/10
To get it to work in perl5 you need to use bigrat pragma:

  $ re.pl
  > (0.3 - 0.2) == (0.2 - 0.1)
  
  > use bigrat;
  > (0.3 - 0.2) == (0.2 - 0.1)
  1
I think Clojure is another language that uses Rationals by default.

There are no comments on this comment yet.