MathAbs

函数返回特定数值的绝对值(绝对值)

double  MathAbs(
   double  value      // 数值
   );

参量

[in]  数值

返回值

双精度类型值多于或等于0

注释

取代MathAbs()函数,可以使用 fabs()。

 

示例:

//--- 输入参数
input int      InpValue = -10;   // 在这里输入任何值
 
//+------------------------------------------------------------------+
//| 脚本程序起始函数                                                   |
//+------------------------------------------------------------------+
void OnStart()
  {
//--- 获取输入中输入数字的绝对值
   uint abs_value=MathAbs(InpValue);
//--- 在日志中记录值
   PrintFormat("The entered value %d received the value %u after using the MathAbs() function",InpValue,abs_value);
  }