Hacker News new | comments | show | ask | jobs | submit login

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.



Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | DMCA | Apply to YC | Contact

Search: