- or download this
use POSIX qw( ceil );
my $rounded = ceil($num*2)/2;
- or download this
use POSIX qw( ceil );
my $rounded = ($num>=0 ? +1 : -1) * ceil(abs($num)*2)/2;
- or download this
use POSIX qw( ceil floor );
my $rounded = ($num >= 0
? ceil($num*2)/2
: floor($num*2)/2
);