[英]what's wrong with my formula?
I'm making a function which returns the body fat composition from below algorithm: 我正在制作一个从以下算法返回人体脂肪成分的函数:
495/(1.0324-0.19077(LOG(waist-neck))+0.15456(LOG(height)))-450 // for men
495/(1.29579-0.35004(LOG(waist+hip-neck))+0.22100(LOG(height)))-450 // for women
I convert it into java language as below: 我将其转换为Java语言,如下所示:
495/((1.0324f-(0.19077f*(Math.log(_waist-_neck)))+0.15456f*(Math.log(_height))))-450 // for men
and the values are: 值是:
_height = 70.86f; // 180cm & 70in
_waist = 35.43f; // 90cm & 35in
_neck = 19.68f; // 50cm & 19in
// values are converted from centimeter
in my way, it returns -25.125 But in http://www.calculator.net/body-fat-calculator.html site, which already is using this algorithm (see below the converter), I put theses values it returns 10.3 以我的方式,它返回-25.125,但是在http://www.calculator.net/body-fat-calculator.html网站中,该网站已经在使用此算法(请参见转换器下方),我将这些值返回10.3
what is my wrong? 我怎么了 is there any thing lost in my nested formula?? 我的嵌套公式中有什么丢失的东西吗?
The formula expects the input in centimeters, not inches, and uses base-10 logarithm: 该公式期望输入的单位是厘米,而不是英寸,并使用以10为底的对数:
@Test
public void formula() throws Exception
{
float _height = 180;
float _waist = 90;
float _neck = 50;
double fat = 495/(1.0324f-(0.19077f*(Math.log10(_waist-_neck)))+0.15456f*(Math.log10(_height)))-450;
System.out.println(fat);
}
Output 产量
10.31526981020346 10.31526981020346
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.