BC Extra is a library of functions that work in PHP's BC Math. BC Math allows arbitrary precision arithmetic on values represented as strings, but only includes basic mathematical functions. This library adds several additional functions:

• Factorial (x!)
• Natural log (ln x)
• Exponential (ex)
• Power-of (ax)
• Pi
• Sine
• Cosine
• Tangent
• Arcsine
• Arccosine
• Arctangent
• Random number (between 0 and 1)

## Manual

The functions of this library are pretty straight forward. Detailed documentation is available online, generated from the source code using phpDocumentor. The documentation can be recreated from the source if needed.

## From Marcos

### Brazil

#### August 16, 2017 at 6:32 PM

Hi Andrew!

First of all, thank you for sharing such a fantastic library. I've been working with high precise numbers in PHP for the last months, and your library is impressive fast when compared to other libraries with the same purpose. Congratulations!

I'm writing because I found some issues when computing the power of numbers using fractional exponents. The algorithm relies on the formula x ^ y = exp(y * log (x))  to calculate exponentiation. My guess is that the problem is related to estimating the scale needed for precisely computing the result up to a given scale.

I'm trying to fix it because the application I'm working on requires accurate results. If you have any guess about how to compute it, please let me know, it will help a lot.

Example:

// Expected: 310472657364304703.652201517571826032805777140298

// Result: 310472657364304703.652201517571826028599733563396

bcpow('9223372036854775807', '0.9223372036854775807', 25)

Thank you again.

- Marcos

## From Murat Karagöz

### Turkiye

#### August 02, 2018 at 3:01 AM

echo bcsin(90); gives  1.39    .It is wrong. It has to give 1            Secondly, write bcscale( \$scale + 5 );  right after function bccos() ,because it gives error.