Every story and comment from the Hacker News API, in a layout borrowed from 2001.
A comment on WTFJS?. Parent comment
0.1 + 0.2 == 0.3 => false
According to "The Ruby Programming Language", all languages that use IEEE-754 floating-point numbers have this problem.
In Ruby you can get around this by using BigDecimal.
>> require 'bigdecimal'
=> true
>> require 'bigdecimal/util'
>> 0.1.to_d + 0.2.to_d == 0.3.to_d
There are no comments on this comment yet.
0.1 + 0.2 == 0.3 => false
According to "The Ruby Programming Language", all languages that use IEEE-754 floating-point numbers have this problem.
In Ruby you can get around this by using BigDecimal.
>> require 'bigdecimal'
=> true
>> require 'bigdecimal/util'
=> true
>> 0.1.to_d + 0.2.to_d == 0.3.to_d
=> true