diff options
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_view/helpers/number_helper.rb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/actionpack/lib/action_view/helpers/number_helper.rb b/actionpack/lib/action_view/helpers/number_helper.rb index 9dc47272b0..7b3751de46 100644 --- a/actionpack/lib/action_view/helpers/number_helper.rb +++ b/actionpack/lib/action_view/helpers/number_helper.rb @@ -459,7 +459,8 @@ module ActionView raise ArgumentError, ":units must be a Hash or String translation scope." end.keys.map{|e_name| DECIMAL_UNITS.invert[e_name] }.sort_by{|e| -e} - number_exponent = Math.log10(number).floor + number_exponent = 0 + number_exponent = Math.log10(number).floor if number != 0 display_exponent = unit_exponents.find{|e| number_exponent >= e } number /= 10 ** display_exponent |