abap中ceil和floor函数的区别?

发布于 11-23 18:51 字数 42 浏览 0 评论 0原文

我是abap的新手,请告诉我abap中ceil和floor函数的使用。

I'm newbie to abap, please let me know ,the use of ceil and floor function in abap.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

老旧海报2024-11-30 18:51:31

为了补充 Hyperboreus 的答案,严格来说这不是 ABAP 问题,因为上限和下限函数也是其他语言中包含的通用数学函数。

您可以使用以下 ABAP 代码亲自尝试一下,以实际了解:

data: v type p decimals 1.
data: c type i.
data: f type i.

v = '8.2'.

c = ceil( v ).
f = floor( v ).
write: c, f.

To add to Hyperboreus' answer, this is strictly speaking not an ABAP question, as the ceiling and floor functions are generic mathematical functions included in other languages too.

You can try it for yourself with the following ABAP code to get a hands-on understanding:

data: v type p decimals 1.
data: c type i.
data: f type i.

v = '8.2'.

c = ceil( v ).
f = floor( v ).
write: c, f.
小嗷兮2024-11-30 18:51:31

不幸的是,我对 abap 一无所知,但 ceil 和 floot 通常定义如下:

float 值的下限是下一个最低整数。

浮点值的上限是下一个最大整数。

示例:

ceil (4.1) = 5
floor (4.1) = 4

Unfortunatly I do not know a thing about abap, but ceil and floot are generally defined as follows:

The floor of a float value is the next lowest integer.

The ceiling of a float value is the next highest integer.

Exempli gratia:

ceil (4.1) = 5
floor (4.1) = 4
西瑶2024-11-30 18:51:31

FLOOR 返回最接近的最小整数
CEIL 返回最接近的最大整数

FLOOR returns the nearest Smallest integer
CEIL returns the nearest Largest Interger

小梨窩很甜2024-11-30 18:51:31

CEIL 的意思是将数字向上舍入 - 到上限...
FLOOR 的含义是将数字向下舍入 - 为 flowr...

如前所述:
例如。值 4.1 将是:

地板-> 4.0
天花板-> 5.0

CEIL has the meaning of rounding the number up - to the ceiling...

FLOOR has the meaning of rounding the number down - to floowr...

as previously answered:
eg. value 4.1 will be:

floor -> 4.0
ceil -> 5.0

你没皮卡萌2024-11-30 18:51:31

ceil 返回最小整数值。

floor 返回最大整数值。

示例: 适用于所有数值数据类型的数学函数

DATA n TYPE p DECIMALS 2.
DATA m TYPE p DECIMALS 2 VALUE '-5.55'.
n = abs( m ).  WRITE:  'ABS: ', n.
n = sign( m ). WRITE: / 'SIGN: ', n.
n = ceil( m ). WRITE: / 'CEIL: ', n.
n = floor( m ). WRITE: / 'FLOOR:', n.
n = trunc( m ). WRITE: / 'TRUNC:', n.
n = frac( m ). WRITE: / 'FRAC: ', n.
The output appears as follows:
ABS: 5.55
SIGN:  1.00-
CEIL:  5.00-
FLOOR: 6.00-
TRUNC: 5.00-
FRAC:  0.55-

更多详细信息请点击下面的链接。

单击此处

ceil is return Smallest integer value.

floor is return Largest integer value.

Example: Mathematical functions for all Numeric Data Types

DATA n TYPE p DECIMALS 2.
DATA m TYPE p DECIMALS 2 VALUE '-5.55'.
n = abs( m ).  WRITE:  'ABS: ', n.
n = sign( m ). WRITE: / 'SIGN: ', n.
n = ceil( m ). WRITE: / 'CEIL: ', n.
n = floor( m ). WRITE: / 'FLOOR:', n.
n = trunc( m ). WRITE: / 'TRUNC:', n.
n = frac( m ). WRITE: / 'FRAC: ', n.
The output appears as follows:
ABS: 5.55
SIGN:  1.00-
CEIL:  5.00-
FLOOR: 6.00-
TRUNC: 5.00-
FRAC:  0.55-

More Details Click on below link.

Click Here

橘虞初梦2024-11-30 18:51:31

不仅在ABAP中,任何编程语言如C、C++、JAVA都遵循相同的概念。

     The Floor of 2.31 is 2 
     The Ceiling of 2.31 is 3
     The Floor of 5 is 5 
     The Ceiling of 5 is 5

Not only in ABAP any programming language like C, C++, JAVA follows same concept.

     The Floor of 2.31 is 2 
     The Ceiling of 2.31 is 3
     The Floor of 5 is 5 
     The Ceiling of 5 is 5
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文