示例#1
0
 /**
  * @param string|int|float|\Enimiste\Math\VO\IntegerNumber $value
  *
  * @return \Enimiste\Math\VO\FloatNumber
  */
 function as_integer_number($value)
 {
     if ($value instanceof \Enimiste\Math\VO\IntegerNumber) {
         return $value;
     } elseif ($value instanceof \Enimiste\Math\VO\FloatNumber) {
         return new \Enimiste\Math\VO\IntegerNumber($value->__toString());
     } else {
         return new \Enimiste\Math\VO\IntegerNumber($value);
     }
 }
示例#2
0
 /**
  * @test
  * @dataProvider is_int_values
  */
 public function is_int_values_test($i, $expected)
 {
     $this->assertEquals($expected, IN::isInt($i));
 }
示例#3
0
文件: Number.php 项目: enimiste/math
 /**
  * Check if this number is less than the given value
  *
  * @param string|int|float|Number $other
  *
  * @param int                     $scale
  *
  * @return bool
  */
 public function lt($other, $scale = null)
 {
     if (!$other instanceof Number) {
         if (!is_numeric($other)) {
             return false;
         } elseif (IntegerNumber::isInt($other)) {
             $other = new IntegerNumber($other);
         } else {
             $other = new FloatNumber($other, is_null($scale) ? FloatNumber::PRECISION : $scale);
         }
     }
     return $this->_lt($other);
 }