跳到主要内容

CEILING_PRECISE

返回向上舍入到最接近的整数或最接近的基数倍数的数字。无论数字的符号如何,都始终向上舍入。

语法

expression.CEILING_PRECISE(arg1, arg2);

expression - 表示 ApiWorksheetFunction 类的变量。

参数

名称必需/可选数据类型默认值描述
arg1必需ApiRange | ApiName | number要向上舍入的值。
arg2可选ApiRange | ApiName | number要向上舍入到的基数的倍数。如果省略,则使用默认值 1。如果设置为零,函数返回 0。

返回值

number

示例

此示例演示如何返回向上舍入到最接近的整数或最接近的基数倍数的数字。无论数字的符号如何,都始终向上舍入。

// How to round a number up precisely.

// Use function to round a negative or positive number up the nearest integer or to the nearest multiple of significance.

let worksheet = Api.GetActiveSheet();
let func = Api.WorksheetFunction;
worksheet.GetRange("A1").SetValue(func.CEILING_PRECISE(-6.7, 2));