Skip to main content

Name

ec_round — round away from zero

Synopsis

ec_round { number }

Description

ec_round rounds the given number to the nearest integer, but away from 0.

$a = 65.43;
$b = -41.65;
$c = 43;
$rounda = ec_round $a;
$roundb = ec_round $b;
$roundc = ec_round $c;
#rounda is 66.000000
#roundb is -42.000000
#roundc is 43.000000
Was this page helpful?