如何总结正在进行的编程 [英] How to round up in progress programming

查看:50
本文介绍了如何总结正在进行的编程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为 MRP 程序编写报告,其中包含我计算订购数量的字段.如果是小数点,我需要把数字四舍五入.

I am writing a report for an MRP program and it contains a field I calculate for the quantity to order. I need to round the number up if it is a decimal point.

例如:2.33 需要四舍五入为 3,依此类推.

For example: 2.33 needs to be rounded up to 3 and so on.

我试过了

oder = round(order,0).

但这只会让我得到 2.00我需要将该数字四舍五入为下一个整数.

but that just get me 2.00 I need that number to be rounded up to the next whole number.

推荐答案

function roundUp returns integer ( x as decimal ):

  if x = truncate( x, 0 ) then
    return integer( x ).
   else
    return integer( truncate( x, 0 ) + 1 ).

end.

display roundUp( 2.33 ).

这篇关于如何总结正在进行的编程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆