Litipk\BigNumbers\Decimal::fromInteger PHP Méthode

fromInteger() public static méthode

public static fromInteger ( integer $intValue ) : Decimal
$intValue integer
Résultat Decimal
    public static function fromInteger($intValue)
    {
        self::paramsValidation($intValue, null);
        if (!is_int($intValue)) {
            throw new InvalidArgumentTypeException(['int'], is_object($intValue) ? get_class($intValue) : gettype($intValue), '$intValue must be of type int');
        }
        return new static((string) $intValue, 0);
    }

Usage Example

 public function testNegativeNumbers()
 {
     $this->assertFalse(Decimal::fromInteger(-1)->isZero());
     $this->assertFalse(Decimal::fromFloat(-1.0)->isZero());
     $this->assertFalse(Decimal::fromFloat(-0.1)->isZero());
     $this->assertFalse(Decimal::fromString('-1')->isZero());
 }
All Usage Examples Of Litipk\BigNumbers\Decimal::fromInteger