Class Zend_Locale_Math

Description

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.

  • copyright: Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
  • license: New BSD License

Located in /Locale/Math.php (line 35)


	
			
Direct descendents
Class Description
 class Zend_Locale_Math_PhpMath Utility class for proxying math function to bcmath functions, if present, otherwise to PHP builtin math operators, with limited detection of overflow conditions.
Variable Summary
 static mixed $add
 static mixed $comp
 static mixed $div
 static mixed $mod
 static mixed $mul
 static mixed $pow
 static mixed $scale
 static mixed $sqrt
 static mixed $sub
 static mixed $_bcmathDisabled
Method Summary
 static void isBcmathDisabled ()
 static string normalize (integer $value)
 static void round ( $op1, [ $precision = 0])
Variables
static mixed $add = 'bcadd' (line 40)
  • access: public
static mixed $comp = 'bccomp' (line 45)
  • access: public
static mixed $div = 'bcdiv' (line 44)
  • access: public
static mixed $mod = 'bcmod' (line 47)
  • access: public
static mixed $mul = 'bcmul' (line 43)
  • access: public
static mixed $pow = 'bcpow' (line 42)
  • access: public
static mixed $scale = 'bcscale' (line 48)
  • access: public
static mixed $sqrt = 'bcsqrt' (line 46)
  • access: public
static mixed $sub = 'bcsub' (line 41)
  • access: public
static mixed $_bcmathDisabled = false (line 38)
  • access: public
Methods
static isBcmathDisabled (line 50)
  • access: public
static void isBcmathDisabled ()
static normalize (line 120)

Normalizes an input to standard english notation Fixes a problem of BCMath with setLocale which is PHP related

  • return: Normalized string without BCMath problems
  • access: public
static string normalize (integer $value)
  • integer $value: Value to normalize
static round (line 65)

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);

  • access: public
static void round ( $op1, [ $precision = 0])
  • $op1
  • $precision

Documentation generated on Sun, 27 May 2007 23:25:43 -0700 by phpDocumentor 1.3.2