Litipk\BigNumbers\Decimal::fromInteger PHP Method

fromInteger() public static method

public static fromInteger ( integer $intValue ) : Decimal
$intValue integer
return 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

コード例 #1
0
 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