What is the difference between bcpow and pow?

Can someone explain to me if I should use bcpow () instead of pow () and why?

I understand that not all php installations have bcmath. Therefore, if I am writing an open source project and want to have as few dependencies / requirements as possible, I would prefer to use pow () in my code.

But what are the disadvantages of using pow () over bcpow ()?

+3
source share
3 answers

bcpow()is a BCMath library function with arbitrary math precision .

Guideline introduction:

For arbitrary math accuracy, PHP offers a binary calculator that supports numbers of any size and accuracy , represented as strings.


, pow() floats, ():

, ~ 1.8e308 14 (64- IEEE)


, pow() float (, , ); , bcpow().

+6

manual bc*

[...] PHP , , .

pow() , .

0

bcpow . .

0

Source: https://habr.com/ru/post/1795722/


All Articles