POSIX

POSIX 表示 可移植操作系统接口(Portable Operating System Interface ,缩写为 POSIX ),POSIX标准定义了操作系统应该为应用程序提供的接口标准,是IEEE为要在各种UNIX操作系统上运行的软件而定义的一系列API标准的总称, POSIX标准意在期望获得 源代码 级别的 软件可移植性 。换句话说,为一个POSIX兼容的操作系统编写的程序,应该可以在任何其它的POSIX操作系统(即使是来自另一个厂商)上编译执行。
工作需要的函数:
ceil(): This is identical to the C function  ceil() , returning the smallest integer value greater than or equal to the given numerical argument. 
ceil():向上取整,返回大于或者等于指定表达式的最小整数

floor():This is identical to the C function floor() , returning the largest integer value less than or equal to the numerical argument.
floor(x),有时候也写做Floor(x),其功能是“向下取整”,或者说“向下舍入”,即取不大于x的最大整数(与“ 四舍五入”不同,下取整是直接去掉小数部分)。

#!/usr/bin/perl -w

use POSIX;

my $num=5.8;

print(" ceil of 5.6 = ".ceil($num)."\n");
print("floor of 5.6 = ".ceil($num)."\n");

zl@zl-ubuntu:~/perl/POSIX$ perl ceil_floor.pl
 ceil of 5.6 = 6
floor of 5.6 = 6
zl@zl-ubuntu:~/perl/POSIX$ 

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值