Truffleruby: ArgumentError comparing a BigDecimal to a Float

Created on 30 Aug 2019  路  2Comments  路  Source: oracle/truffleruby

As posted on gitter, I'm comparing a BigDecimal to a Float. No problems on MRI, error on TruffleRuby:

sum = BigDecimal("0")
10_000.times do
  sum = sum + BigDecimal("0.0001")
end
[sum, 1.1].min
# => #<BigDecimal:7f98c8868338,'0.1E1',9(18)> (MRI)
# ArgumentError: comparison of Float with 1.0 failed (TruffleRuby)
bug compatibility

Most helpful comment

This can be closed now. It works fine on master:

>> require 'bigdecimal'
=> true
>> sum = BigDecimal("0")
=> 0.0
>> 10_000.times do
?>       sum = sum + BigDecimal("0.0001")
>>   end
=> 10000
>> [sum, 1.1].min
=> 0.1e1

All 2 comments

This can be closed now. It works fine on master:

>> require 'bigdecimal'
=> true
>> sum = BigDecimal("0")
=> 0.0
>> 10_000.times do
?>       sum = sum + BigDecimal("0.0001")
>>   end
=> 10000
>> [sum, 1.1].min
=> 0.1e1

I verified, it's fixed in 20.0.0, but not in 19.3.0.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

deepj picture deepj  路  20Comments

eregon picture eregon  路  50Comments

jjyr picture jjyr  路  23Comments

thbar picture thbar  路  20Comments

eregon picture eregon  路  35Comments