lib/muflax/math.rb in muflax-0.5.1 vs lib/muflax/math.rb in muflax-0.5.2
- old
+ new
@@ -35,15 +35,15 @@
def choose k, n
Math.factorial(n) / (Math.factorial(k) * Math.factorial(n - k))
end
def mass_index coeff, mass, height, adjustment=1.0
- h /= 100.0 if (50..300).include? h # cm -> m auto-correction
+ height /= 100.0 if (50..300).include? height # cm -> m auto-correction
adjustment * (mass / (height ** coeff))
end
def mass_index_at coeff, index, height, adjustment=1.0
- h /= 100.0 if (50..300).include? h # cm -> m auto-correction
+ height /= 100.0 if (50..300).include? height # cm -> m auto-correction
index * (height ** coeff) / adjustment
end
def bmi m, h ; mass_index 2.0, m, h ; end
def bmi_adj m, h ; mass_index 2.5, m, h, 1.3 ; end