bmi.go (245B)
1 package stats 2 3 import ( 4 "math" 5 ) 6 7 func BMI(height, weight float64) float64 { 8 if height > 0 { 9 return weight / math.Pow(height/100, 2) 10 } 11 12 return 0.0 13 } 14 15 func BodyFatWeight(weight, bodyFat float64) float64 { 16 return (weight * bodyFat) / 100 17 }