[sup-talk] Util - Fixnum num_digits is wrong

William Morgan wmorgan-sup at masanjin.net
Sat Dec 8 17:13:47 EST 2007


Excerpts from Shot (Piotr Szotkowski)'s message of Mon Dec 03 02:52:10 -0800 2007:
> Math.log and Float#/ returning Floats means the above approach is
> prone to the IEEE 754 representation inaccuracy.
> 
> Wouldn’t the below make more sense?
> 
> class Fixnum
>   def num_digits base = 10
>     to_s(base).size
>   end
> end

Yes, but not as much as simply deleting the method. :)

-- 
William <wmorgan-sup at masanjin.net>


More information about the sup-talk mailing list