Zend Framework
LICENSE
This source file is subject to the new BSD license that is bundled with this package in the file LICENSE.txt. It is also available through the world-wide-web at this URL: http://framework.zend.com/license/new-bsd If you did not receive a copy of the license and are unable to obtain it through the world-wide-web, please send an email to license@zend.com so we can send you a copy immediately.
Utility class for proxying math function to bcmath functions, if present, otherwise to PHP builtin math operators, with limited detection of overflow conditions.
Sampling of PHP environments and platforms suggests that at least 80% to 90% support bcmath. Thus, this file should be as light as possible.
$_bcmathDisabled = 'false'
Details $add = 'array'
Details $comp = 'array'
Details $div = 'array'
Details $mod = 'array'
Details $mul = 'array'
Details $pow = 'array'
Details $scale = 'bcscale'
Details $sqrt = 'array'
Details $sub = 'array'
DetailsAdd(
string $op1, string $op2, integer $scale
=
null
)
:
stringBCAdd - fixes a problem of BCMath and exponential numbers
DetailsComp(
string $op1, string $op2, integer $scale
=
null
)
:
stringBCComp - fixes a problem of BCMath and exponential numbers
DetailsDiv(
string $op1, string $op2, integer $scale
=
null
)
:
stringBCDiv - fixes a problem of BCMath and exponential numbers
DetailsMod(
string $op1, string $op2
)
:
stringBCMod - fixes a problem of BCMath and exponential numbers
DetailsMul(
string $op1, string $op2, integer $scale
=
null
)
:
stringBCMul - fixes a problem of BCMath and exponential numbers
DetailsPow(
string $op1, string $op2, integer $scale
=
null
)
:
stringBCPow - fixes a problem of BCMath and exponential numbers
DetailsSqrt(
string $op1, integer $scale
=
null
)
:
stringBCSqrt - fixes a problem of BCMath and exponential numbers
DetailsSub(
string $op1, string $op2, integer $scale
=
null
)
:
stringBCSub - fixes a problem of BCMath and exponential numbers
Detailsexponent(
integer $value, integer $scale
=
null
)
:
stringChanges exponential numbers to plain string numbers Fixes a problem of BCMath with numbers containing exponents
Detailsfloatalize(
string $value
)
:
Convert a scientific notation to float Additionally fixed a problem with PHP <= 5.2.x with big integers
DetailsisBcmathDisabled(
)
:
Detailslocalize(
integer $value
)
:
stringLocalizes an input from standard english notation Fixes a problem of BCMath with setLocale which is PHP related
Detailsnormalize(
integer $value
)
:
stringNormalizes an input to standard english notation Fixes a problem of BCMath with setLocale which is PHP related
Detailsround(
$op1, $precision
=
0
)
:
Surprisingly, the results of this implementation of round() prove better than the native PHP round(). For example, try: round(639.795, 2); round(267.835, 2); round(0.302515, 5); round(0.36665, 4); then try: Zend_Locale_Math::round('639.795', 2);
Details