MathAbs 函数原型: double MathAbs(double value)
这是非常简单的函数,返回绝对值(数字模块)。它的意思是,如果你使用了负数,则会得到一个正数结果。使用示例:
- int a=-10;
- double b=-20.0;
- double c=7.0;
- a=MathAbs(a); // now a is equal to 10
- b=MathAbs(b); // now b is equal to 20.0
- c=MathAbs(c); // the value of c will not change, for it was positive
复制代码
|