lessphp
lessphp copied to clipboard
round(number,precision) : Precision value throws Error
Hi, in v0.4.0 the round-function [lib_round($arg)] has no precision management included. Two arguments [ex. round(33.33333, 2)] creating an error. Documentation says that is possible.
Source:
protected function lib_round($arg) {
$value = $this->assertNumber($arg);
return array("number", round($value), $arg[2]);
}
Fix:
protected function lib_round($arg) {
if($arg[0] == "list") {
$values = $arg[2];
$precision = $this->assertNumber($values[1]);
$value = $this->assertNumber($values[0]);
return array("number", round($value,$precision), $values[0][2]);
} else {
$value = $this->assertNumber($arg);
return array("number", round($value), $arg[2]);
}
}