请输入您要查询的百科知识:

 

词条 ceiling
释义

将参数Number向上舍入(沿绝对值增大的方向)为最接近的 significance 的倍数。例如,如果您不愿意使用像“分”这样的零钱,而所要购买的商品价格为 $4.42,可以用公式 =CEILING(4.42,0.1) 将价格向上舍入为以“角”表示。

CEILING(number,significance)

参数:

Number 待舍入的数值。

Significance 基数。

说明:

如果参数为非数值型,CEILING 返回错误值 #VALUE!。

无论数字符号如何,都按远离 0 点方向舍入。如果数字已经为 Significance 的倍数,则不进行舍入。

如果 Number 和 Significance 符号不同,CEILING 返回错误值 #NUM!

C# 例子

double[] values = {7.03, 7.64, 0.12, -0.12, -7.1, -7.6};

Console.WriteLine(" Value Ceiling Floor\");

foreach (double value in values) Console.WriteLine("{0,7} {1,16} {2,14}", value, Math.Ceiling(value), Math.Floor(value));

// The example displays the following output to the console:

// Value Ceiling Floor

//

// 7.03 8 7

// 7.64 8 7

// 0.12 1 0

// -0.12 0 -1

// -7.1 -7 -8

// -7.6 -7 -8

随便看

 

百科全书收录4421916条中文百科知识,基本涵盖了大多数领域的百科知识,是一部内容开放、自由的电子版百科全书。

 

Copyright © 2004-2023 Cnenc.net All Rights Reserved
更新时间:2025/2/27 14:51:37