(PHP 8 >= 8.4.0)
A class for an arbitrary precision number. These objects support overloaded arithmetic and comparison operators.
Note: This class is not affected by the bcmath.scale INI directive set in php.ini.
Note: The behavior of an overloaded operator is the same as specifying
nullfor thescaleparameter on the corresponding method.
public add(BcMath\Number|string|int $num, ?int $scale = null): BcMath\Number
public ceil(): BcMath\Number
public compare(BcMath\Number|string|int $num, ?int $scale = null): int
public div(BcMath\Number|string|int $num, ?int $scale = null): BcMath\Number
public divmod(BcMath\Number|string|int $num, ?int $scale = null): array
public floor(): BcMath\Number
public mod(BcMath\Number|string|int $num, ?int $scale = null): BcMath\Number
public mul(BcMath\Number|string|int $num, ?int $scale = null): BcMath\Number
public pow(BcMath\Number|string|int $exponent, ?int $scale = null): BcMath\Number
public powmod(BcMath\Number|string|int $exponent, BcMath\Number|string|int $modulus, ?int $scale = null): BcMath\Number
public round(int $precision = 0, RoundingMode $mode = RoundingMode::HalfAwayFromZero): BcMath\Number
public __serialize(): array
public sqrt(?int $scale = null): BcMath\Number
public sub(BcMath\Number|string|int $num, ?int $scale = null): BcMath\Number
public __toString(): string
public __unserialize(array $data): void}
scale parameter was set in the calculation method.
© 1997–2025 The PHP Documentation Group
Licensed under the Creative Commons Attribution License v3.0 or later.
https://www.php.net/manual/en/class.bcmath-number.php