/** * @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); } }
/** * @test * @dataProvider is_int_values */ public function is_int_values_test($i, $expected) { $this->assertEquals($expected, IN::isInt($i)); }
/** * 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); }