Esempio n. 1
0
 /**
  * Create an instance of an Integer adapter
  *
  * @param mixed $number
  * @static
  * @access public
  * @throws AdapterSupportException
  * @return AdapterInterface
  */
 public static function factory($number)
 {
     // Use GMP if we can... its MUCH faster
     if (Number::isGmpAvailable()) {
         return Gmp::factory($number);
     } elseif (Number::isBcMathAvailable()) {
         return BcMath::factory($number);
     }
     // TODO: Fall back to native?
     throw new AdapterSupportException();
 }
Esempio n. 2
0
 /**
  * @expectedException Mathematician\Exception\OutOfTypeRangeException
  */
 public function testToIntegerStrictFailsOutOfRangeLow()
 {
     Gmp::factory('-99999999999999999999')->toInteger();
 }