diff options
author | wmoxam <wesley.moxam@savvica.com> | 2009-08-07 17:52:08 -0400 |
---|---|---|
committer | Pratik Naik <pratiknaik@gmail.com> | 2009-08-08 02:05:10 +0100 |
commit | 98450fd168673c6bc698b3b2d3c264a9cd70a464 (patch) | |
tree | 23b145c31bb767c1851dabc65f26dc71561b8033 /actionpack/lib | |
parent | 43b406bdb0a747392f30d3da404da3aa6fb29776 (diff) | |
download | rails-98450fd168673c6bc698b3b2d3c264a9cd70a464.tar.gz rails-98450fd168673c6bc698b3b2d3c264a9cd70a464.tar.bz2 rails-98450fd168673c6bc698b3b2d3c264a9cd70a464.zip |
Fix number_to_precision rounding error [#2071 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_view/helpers/number_helper.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/actionpack/lib/action_view/helpers/number_helper.rb b/actionpack/lib/action_view/helpers/number_helper.rb index 999d5b34fc..897a7cc348 100644 --- a/actionpack/lib/action_view/helpers/number_helper.rb +++ b/actionpack/lib/action_view/helpers/number_helper.rb @@ -215,7 +215,7 @@ module ActionView delimiter ||= (options[:delimiter] || defaults[:delimiter]) begin - rounded_number = (Float(number) * (10 ** precision)).round.to_f / 10 ** precision + rounded_number = BigDecimal.new((Float(number) * (10 ** precision)).to_s).round.to_f / 10 ** precision number_with_delimiter("%01.#{precision}f" % rounded_number, :separator => separator, :delimiter => delimiter) |