-1
我试过基于C一些计算,我的代码如下math.h方法工作不同?
#include <stdio.h>
#include <math.h>
int main(void)
{
float a = 1.8;
float b = 3.3;
float c = 1.5;
float d = 5.9;
float e = 2.6;
float result = a/(a + (abs(a - b)/(b + (pow(c, 5)/(e + (pow(d, 2)/(b + (pow(c, 3)/4))))))));
float result2 = a/(a + ((-1) * (a-b))/(b + ((c * c * c * c * c)/(e + ((d * d)/(b + ((c * c * c)/4)))))));
printf("Result = %.4f\n", result);
printf("Result2 = %.4f\n", result2);
system("pause");
return(0);
}
结果2是正确的结果。那么为什么结果和结果2是不同的?我在这里做错了什么?
可以共享成果 – Haris
'ABS(AB)'是!='(-1)*(AB)' – wrangler
@wrangler A和B的当前设置,是的,它等于 –