Пример #1
0
 /**
  * Floor arbitrary precision number
  *
  * @param Number\Number|string      $operand
  * @param Number\PositiveNumber|int $precision
  *
  * @return string the result as a string.
  */
 public function flooring($operand, $precision = 0)
 {
     if (!$operand instanceof Number\NumberInterface) {
         $operand = Number\Number::create($operand);
     }
     if (!$precision instanceof Number\NumberInterface) {
         $precision = Number\PositiveNumber::create($precision);
     }
     return Command\Flooring::process($operand, $precision)->getValue();
 }
Пример #2
0
 /**
  * Rounding provider
  *
  * @return array
  */
 public function roundingProvider()
 {
     return array(array(Number\Number::create('10.544'), Number\PositiveNumber::create(2), Number\Number::create('10.54')), array(Number\Number::create('-10.544'), Number\PositiveNumber::create(2), Number\Number::create('-10.54')), array(Number\Number::create('10.545'), Number\PositiveNumber::create(2), Number\Number::create('10.55')), array(Number\Number::create('10.444444'), Number\PositiveNumber::create(0), Number\Number::create('10')), array(Number\Number::create('10.488888'), Number\PositiveNumber::create(0), Number\Number::create('10')), array(Number\Number::create('10.588888'), Number\PositiveNumber::create(0), Number\Number::create('11')), array(Number\Number::create('10.000000'), Number\PositiveNumber::create(6), Number\Number::create('10.000000')), array(Number\Number::create('10.0000555'), Number\PositiveNumber::create(6), Number\Number::create('10.000056')), array(Number\Number::create('10.000055565'), Number\PositiveNumber::create(8), Number\Number::create('10.00005557')));
 }