From: Mark Campbell Date: 2012-04-14T05:55:50+09:00 Subject: Why doesn't Fixnum#to_d exist? --e0cb4efe358472d99a04bd95b23d Content-Type: text/plain; charset=UTF-8 http://stdlib.rubyonrails.org/libdoc/bigdecimal/rdoc/index.html > String# > to_d ... to BigDecimal > > Float# > to_d ... to BigDecimal > > Rational# > to_d ... to BigDecimal These all exist... why not for Fixnum#to_d? Right now I'm having to write a mixin on Fixnum, something like this: class Fixnum def to_d BigDecimal(self.to_s) end end The above code is *very* similar to what has been written for Float and String. Is there a reason why this doesn't exist on Fixnum? I'm currently using 1.8.7. --e0cb4efe358472d99a04bd95b23d Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
http://stdlib.rubyonrails.org/libdoc/bigdecimal/rdoc/index.html

> =C2=A0String#
> =C2=A0 =C2=A0to_d= =C2=A0 =C2=A0 =C2=A0... to BigDecimal
>
> =C2=A0Float#
> =C2=A0 =C2=A0to_d =C2= =A0 =C2=A0 =C2=A0... to BigDecimal
>
> =C2=A0Rati= onal#
> =C2=A0 =C2=A0to_d =C2=A0 =C2=A0 =C2=A0... to BigDecima= l

These all exist... why not for Fixnum#to_d? Righ= t now I'm having to write a mixin on Fixnum, something like this:

class Fixnum
=C2=A0 def =C2=A0to_d
= =C2=A0 =C2=A0 BigDecimal(self.to_s)
=C2=A0 end
end

The above code is *very* similar to what has been writ= ten for Float and String.

Is there a reason why this doesn't exist on Fixnum?= I'm currently using 1.8.7.
--e0cb4efe358472d99a04bd95b23d--