Ruby 1.8 BigDecimal -


i remember words said matz: ruby 1.8 dead soon. have no option. here, using ruby 1.8.7. big decimal behaving differently compare later version of ruby.

for example:

ree-1.8.7-2011.12 :001 > require 'bigdecimal'  => true  ree-1.8.7-2011.12 :002 > b=bigdecimal('0.0')  => #<bigdecimal:9ce7148,'0.0',4(8)>  ree-1.8.7-2011.12 :003 > b  => #<bigdecimal:9ce7148,'0.0',4(8)>  ree-1.8.7-2011.12 :004 > b==0  => true  ree-1.8.7-2011.12 :005 > [b,b,0,0].uniq  => [#<bigdecimal:9ce7148,'0.0',4(8)>, #<bigdecimal:9ce7148,'0.0',4(8)>] #integer 0 removed ree-1.8.7-2011.12 :008 > [b,b,0,0].uniq.uniq  => [#<bigdecimal:9ce7148,'0.0',4(8)>]  #applying 2 times uniq gives desired result given array 

is there patch fix issue? sorry don't have option upgrade ruby. help? thank you.

you might try https://github.com/marcandre/backports, claims provide "the latest features of ruby backported older versions". didn't see in there regarding bigdecimal, @ glance, knows might using internally. i've used before arrays, it's @ least worth shot.


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -