A literal number with a decimal point in it becomes a Float, e.g.
irb(main):002:0> 3.0.class
=> Float
Is there a way to make a literal like '3.0' become something else,
e.g. a BigDecimal, automatically?
···
--
KM
A literal number with a decimal point in it becomes a Float, e.g.
irb(main):002:0> 3.0.class
=> Float
Is there a way to make a literal like '3.0' become something else,
e.g. a BigDecimal, automatically?
--
KM
Hi,
In message "Re: Class of numeric literals" on Thu, 12 Apr 2007 00:50:07 +0900, KM <km@xacrasis.netx> writes:
A literal number with a decimal point in it becomes a Float, e.g.
irb(main):002:0> 3.0.class
=> FloatIs there a way to make a literal like '3.0' become something else,
e.g. a BigDecimal, automatically?
I'm sorry but no. It would make the language flexible but fragile.
matz.