BcMath\Number クラス

はじめに

任意精度数値のクラスです。 このオブジェクトは、オーバーロードされた 算術演算子, 比較演算子 をサポートしています。

注意: このクラスは、php.iniで設定された bcmath.scale INI ディレクティブの影響を受けません。

注意: オーバーロードされた演算子の動作は、対応するメソッドで scale パラメータに null を指定した場合と同じです。

クラス概要

BcMath
final readonly Number
implements Stringable
/* プロパティ */
public string $value;
public int $scale;
/* メソッド */
public BcMath\Number::__construct(stringint $num)
public BcMath\Number BcMath\Number::add(BcMath\Numberstringint $num, intnull $scale = null)
public BcMath\Number BcMath\Number::ceil()
public int BcMath\Number::compare(BcMath\Numberstringint $num, intnull $scale = null)
public BcMath\Number BcMath\Number::div(BcMath\Numberstringint $num, intnull $scale = null)
public array BcMath\Number::divmod(BcMath\Numberstringint $num, intnull $scale = null)
public BcMath\Number BcMath\Number::floor()
public BcMath\Number BcMath\Number::mod(BcMath\Numberstringint $num, intnull $scale = null)
public BcMath\Number BcMath\Number::mul(BcMath\Numberstringint $num, intnull $scale = null)
public BcMath\Number BcMath\Number::pow(BcMath\Numberstringint $exponent, intnull $scale = null)
public BcMath\Number BcMath\Number::powmod(BcMath\Numberstringint $exponent, BcMath\Numberstringint $modulus, intnull $scale = null)
public BcMath\Number BcMath\Number::round(int $precision = 0, RoundingMode $mode = RoundingMode::HalfAwayFromZero)
public array BcMath\Number::__serialize()
public BcMath\Number BcMath\Number::sqrt(intnull $scale = null)
public BcMath\Number BcMath\Number::sub(BcMath\Numberstringint $num, intnull $scale = null)
public string BcMath\Number::__toString()
public void BcMath\Number::__unserialize(array $data)

プロパティ

value
任意精度数値の文字表現。
scale
オブジェクトに設定されているスケールの値。 計算メソッドで明示的に scale パラメータが設定されていない場合、 この値は自動的に計算されて設定されます。
目次