Введение
For arbitrary precision mathematics PHP offers the Binary Calculator which
supports numbers of any size and precision, represented as strings.
Требования
Since PHP 4.0.4, libbcmath is bundled with PHP. You don't need any
external libraries for this extension.
Установка
These functions are only available if PHP was
configured with --enable-bcmath.
In PHP 3, these functions are only available if PHP was not
configured with --disable-bcmath.
Версия PHP для
Windows имеет встроенную поддержку данного расширения. Это означает, что
для использования данных функций не требуется загрузка никаких
дополнительных расширений.
Настройка во время выполнения
Поведение этих функций зависит от установок в php.ini.
Таблица 20. BC math configuration options
| Name | Default | Changeable | Changelog |
|---|
| bcmath.scale | "0" | PHP_INI_ALL | |
Для подробного описания констант
PHP_INI_*, обратитесь к документации функции
ini_set().
Краткое разъяснение конфигурационных
директив.
-
bcmath.scale
integer
Number of decimal digits for all bcmath functions. See also
bcscale().
Типы ресурсов
Данное расширение не определяет никакие типы ресурсов.
Предопределенные константы
Данное расширение не определяет никакие константы.
Содержание
- bcadd — Add two arbitrary precision numbers
- bccomp — Compare two arbitrary precision numbers
- bcdiv — Divide two arbitrary precision numbers
- bcmod — Get modulus of an arbitrary precision number
- bcmul — Multiply two arbitrary precision number
- bcpow — Raise an arbitrary precision number to another
- bcpowmod — Raise an arbitrary precision number to another, reduced by a specified modulus
- bcscale — Set default scale parameter for all bc math functions
- bcsqrt — Get the square root of an arbitrary precision number
- bcsub — Subtract one arbitrary precision number from another