使用 math.h 或 cmath 头文件中的函数,对于 int 类型的变量 x,表达式 fabs(x) 和 sqrt(x * x) 的结果总是近似相等的。
math.h
cmath
int
x
fabs(x)
sqrt(x * x)
正确 √
错误 ×