Skip to content

Instantly share code, notes, and snippets.

@clemens
Created November 23, 2011 15:14
Show Gist options
  • Save clemens/1388927 to your computer and use it in GitHub Desktop.
Save clemens/1388927 to your computer and use it in GitHub Desktop.
Ruby 1.9.3 BigDecimal bug?
>> require 'bigdecimal'
=> true
>> require 'bigdecimal/util'
=> true
>> BigDecimal('40.30') == 40.3
=> true
>> BigDecimal('40.90') == 40.9
=> true
>> BigDecimal('40.10') == 40.1
=> true
>> BigDecimal('49.10') == 49.1
=> true
>> BigDecimal('69.10') == 69.1
=> false
# WTF?!
@clemens
Copy link
Author

clemens commented Nov 23, 2011

Oh, I see. :(

On the positive side: They've finally added to_d to BigDecimal itself (!) and Integer. I used to have to monkeypatch these ... :)

Anyway, thanks for the hints – I'll fix that some other way, then, I guess.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment