跳至内容

MathRound

MathRound

四舍五入一个双精度浮点数或这类数组到指定的小数位。

四舍五入一个双精度浮点数到指定小数位的版本:

double  MathRound(
   const double   x,          // 数值
   const int      digits      // 小数位数
   )

返回值

: 最接近x参数的数字,其小数位数等于数位。

四舍五入一个双精度浮点数组到指定小数位的版本。结果输出到一个新数组。

bool  MathRound(
   const double&  array[],    // 数值数组
   int            digits,     // 小数位数
   double&        result[]    // 结果数组
   )

返回值

: 如果成功返回true,否则返回false。

四舍五入一个双精度浮点数组到指定小数位的版本。结果输出到原数组。

bool  MathRound(
   double&        array[],    // 数值数组
   int            digits      // 小数位数
   )

返回值

: 如果成功返回true,否则返回false。

参数

x

[in] 四舍五入的双精度浮点数。

digits

[in] 返回值的小数位数。

array[]

[in] 四舍五入的双精度浮点数组。

array[]

[out] 输出值数组。

result[]

[out] 输出值数组。