From 88dfe16d9536b8de4cc69bbe649131840bca9a2c Mon Sep 17 00:00:00 2001 From: Santiago Pastorino Date: Sun, 5 Sep 2010 10:06:09 -0300 Subject: [PATCH] Fix code style a bit --- actionpack/lib/action_view/helpers/number_helper.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/actionpack/lib/action_view/helpers/number_helper.rb b/actionpack/lib/action_view/helpers/number_helper.rb index 7b3751de46..98df5c169b 100644 --- a/actionpack/lib/action_view/helpers/number_helper.rb +++ b/actionpack/lib/action_view/helpers/number_helper.rb @@ -459,8 +459,7 @@ 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 = 0 - number_exponent = Math.log10(number).floor if number != 0 + number_exponent = number != 0 ? Math.log10(number).floor : 0 display_exponent = unit_exponents.find{|e| number_exponent >= e } number /= 10 ** display_exponent