linux:perl:perl向上取整
1. 利用POSIX模块处理 向下/向上取整
use POSIX; POSIX::ceil(3.14) => 4 #向上取整 POSIX::floor(3.14) => 3 # 向下取整, 等同于 int(3.14)
2. 利用Math::Round 做四舍五入
use Math::Round; my $num = 45.4; my $round = Math::Round($num);
linux/perl/perl向上取整.txt · 最后更改: 2023/03/17 10:12 由 127.0.0.1