The BcMath\Number class

(PHP 8 >= 8.4.0)

Einführung

A class for an arbitrary precision number. These objects support overloaded arithmetic and comparison operators.

Hinweis: This class is not affected by the bcmath.scale INI directive set in php.ini.

Hinweis: The behavior of an overloaded operator is the same as specifying null for the scale parameter on the corresponding method.

Klassenbeschreibung

namespace BcMath;
final readonly class Number implements Stringable {
/* Eigenschaften */
public string $value;
public int $scale;
/* Methoden */
public function __construct(string|int $num)
public function add(BcMath\Number|string|int $num, ?int $scale = null): BcMath\Number
public function ceil(): BcMath\Number
public function compare(BcMath\Number|string|int $num, ?int $scale = null): int
public function div(BcMath\Number|string|int $num, ?int $scale = null): BcMath\Number
public function divmod(BcMath\Number|string|int $num, ?int $scale = null): array
public function floor(): BcMath\Number
public function mod(BcMath\Number|string|int $num, ?int $scale = null): BcMath\Number
public function mul(BcMath\Number|string|int $num, ?int $scale = null): BcMath\Number
public function pow(BcMath\Number|string|int $exponent, ?int $scale = null): BcMath\Number
public function powmod(BcMath\Number|string|int $exponent, BcMath\Number|string|int $modulus, ?int $scale = null): BcMath\Number
public function round(int $precision = 0, RoundingMode $mode = RoundingMode::HalfAwayFromZero): BcMath\Number
public function __serialize(): array
public function sqrt(?int $scale = null): BcMath\Number
public function sub(BcMath\Number|string|int $num, ?int $scale = null): BcMath\Number
public function __toString(): string
public function __unserialize(array $data): void
}

Eigenschaften

value
A string representation of an arbitrary precision number.
scale
The scale value currently set on the object. For objects resulting from calculations, this value is automatically computed and set, unless the scale parameter was set in the calculation method.

Inhaltsverzeichnis