Re: Round floats to N decimal places?
- From: karl_brodowsky@xxxxxxxxx
- Date: 27 Mar 2006 13:06:14 -0800
You should consider if you want to work with Float, Integer, BigDecimal
(which is some kind of LongFloat) or Rational. Using Float for
something that needs to be rounded regularly to a fixed number of
digits after the decimal point may or may not be the right way to go,
because it has some behaviour in terms of rounding which has to be
considered.
There is a RubyForge-project long-decimal (
http://rubyforge.org/projects/long-decimal/ ) which will be specialized
for doing calculations with a defined number of digits after the
decimal point. Maybe this will be useful for the kind of calculations
you are trying to do.
.
- References:
- Round floats to N decimal places?
- From: Pat Maddox
- Round floats to N decimal places?
- Prev by Date: IRB Core file ?
- Next by Date: Re: is -w really useful?
- Previous by thread: Re: Round floats to N decimal places?
- Next by thread: Is this a kind of design patterns?
- Index(es):
Relevant Pages
|