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$
ceil of 5.6 = 6
floor of 5.6 = 6
zl@zl-ubuntu:~/perl/POSIX$