IV. Funzioni Matematiche BCMath a precisione arbitraria

Introduzione

Per la matematica a precisione arbitraria PHP offre il Binary Calculator che supporta numeri di qualsiasi dimensione e precisione, rappresentati da stringhe;

Requisiti

Dalla versione 4.0.4 del PHP, libbcmath è inclusa nella distribuzione. Non c'è bisogno di altre librerie esterne per questa estensione.

Installazione

In PHP 4, 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.

The windows version of PHP has built in support for this extension. You do not need to load any additional extension in order to use these functions.

Configurazione Runtime

Il comportamento di queste funzioni è influenzato dalle impostazioni di php.ini.

Tabella 1. BC math configuration options

NameDefaultChangeable
bcmath.scale0PHP_INI_ALL
For further details and definition of the PHP_INI_* constants see ini_set().

Here is a short explanation of the configuration directives.

bcmath.scale integer

Number of decimal digits for all bcmath functions.

Resource Type

Questa estensione non definisce alcun tipo di risorsa.

Costanti Predefinite

Questa estensione non definisce alcuna costante.

Sommario
bcadd -- Somma due numeri a precisione arbitraria
bccomp -- Confronta due numeri a precisione arbitraria
bcdiv -- Divide due numeri a precisione arbitraria
bcmod --  Ricava il modulo di un numero a precisione arbitraria
bcmul -- Moltiplica due numeri a precisione arbitraria
bcpow --  Effettua l'elevamento a potenza
bcpowmod --  Effettua l'elevamento a potenza, iapplicando quindi il modulo.
bcscale --  Imposta il valore di precisione di default per tutte le funzioni matematich BCMath
bcsqrt --  Ottiene la radice quadrata di un numero a precisione arbitraria
bcsub --  Sottrae un numero a precisione arbitraria da un altro