SHOW:
|
|
- or go back to the newest paste.
1 | # ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux] | |
2 | require 'bigdecimal' | |
3 | ||
4 | 10000.times do | |
5 | - | b = BigDecimal.new(1000+Random.rand(5000)) / 100 |
5 | + | # _sometimes_ raises TypeError: #<Class:0x000000277a3a38> can't be coerced into BigDecimal |
6 | - | # b.class => BigDecimal |
6 | + | (BigDecimal.new('1001.10')**0.75).floor |
7 | - | (b**0.75).floor # _sometimes_ raises TypeError: #<Class:0x000000277a3a38> can't be coerced into BigDecimal |
7 | + | putc '.' |
8 | end |