API Documentation

Locale/Math.php

Includes Classes 
category
Zend
copyright
Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
license
http://framework.zend.com/license/new-bsd New BSD License
package
Zend_Locale
version
$Id: Math.php 21179 2010-02-23 21:59:42Z matthew $
Classes
Zend_Locale_Math

Description

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.

Zend_Locale_Math

category
Zend
copyright
Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
license
http://framework.zend.com/license/new-bsd New BSD License
package
Zend_Locale
Properties
$_bcmathDisabled
$add
$sub
$pow
$mul
$div
$comp
$sqrt
$mod
$scale
Methods
isBcmathDisabled
round
floatalize
normalize
localize
exponent
Add
Sub
Pow
Mul
Div
Sqrt
Mod
Comp

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.

Properties

$_bcmathDisabled

 $_bcmathDisabled = 'false'

Details

visibility
public
default
false
final
false
static
true

$add

 $add = 'array'

Details

visibility
public
default
array
final
false
static
true

$comp

 $comp = 'array'

Details

visibility
public
default
array
final
false
static
true

$div

 $div = 'array'

Details

visibility
public
default
array
final
false
static
true

$mod

 $mod = 'array'

Details

visibility
public
default
array
final
false
static
true

$mul

 $mul = 'array'

Details

visibility
public
default
array
final
false
static
true

$pow

 $pow = 'array'

Details

visibility
public
default
array
final
false
static
true

$scale

 $scale = 'bcscale'

Details

visibility
public
default
bcscale
final
false
static
true

$sqrt

 $sqrt = 'array'

Details

visibility
public
default
array
final
false
static
true

$sub

 $sub = 'array'

Details

visibility
public
default
array
final
false
static
true

Methods

Add

Add( string $op1, string $op2, integer $scale = null ) : string

BCAdd - fixes a problem of BCMath and exponential numbers

Arguments
$op1
string
$op2
string
$scale
integer
Output
string
Details
visibility
public
final
false
static
true

Comp

Comp( string $op1, string $op2, integer $scale = null ) : string

BCComp - fixes a problem of BCMath and exponential numbers

Arguments
$op1
string
$op2
string
$scale
integer
Output
string
Details
visibility
public
final
false
static
true

Div

Div( string $op1, string $op2, integer $scale = null ) : string

BCDiv - fixes a problem of BCMath and exponential numbers

Arguments
$op1
string
$op2
string
$scale
integer
Output
string
Details
visibility
public
final
false
static
true

Mod

Mod( string $op1, string $op2 ) : string

BCMod - fixes a problem of BCMath and exponential numbers

Arguments
$op1
string
$op2
string
Output
string
Details
visibility
public
final
false
static
true

Mul

Mul( string $op1, string $op2, integer $scale = null ) : string

BCMul - fixes a problem of BCMath and exponential numbers

Arguments
$op1
string
$op2
string
$scale
integer
Output
string
Details
visibility
public
final
false
static
true

Pow

Pow( string $op1, string $op2, integer $scale = null ) : string

BCPow - fixes a problem of BCMath and exponential numbers

Arguments
$op1
string
$op2
string
$scale
integer
Output
string
Details
visibility
public
final
false
static
true

Sqrt

Sqrt( string $op1, integer $scale = null ) : string

BCSqrt - fixes a problem of BCMath and exponential numbers

Arguments
$op1
string
$scale
integer
Output
string
Details
visibility
public
final
false
static
true

Sub

Sub( string $op1, string $op2, integer $scale = null ) : string

BCSub - fixes a problem of BCMath and exponential numbers

Arguments
$op1
string
$op2
string
$scale
integer
Output
string
Details
visibility
public
final
false
static
true

exponent

exponent( integer $value, integer $scale = null ) : string

Changes exponential numbers to plain string numbers Fixes a problem of BCMath with numbers containing exponents

Arguments
$value
integer
Value to erase the exponent
$scale
integer
(Optional) Scale to use
Output
string
Details
visibility
public
final
false
static
true

floatalize

floatalize( string $value ) :

Convert a scientific notation to float Additionally fixed a problem with PHP <= 5.2.x with big integers

Arguments
$value
string
Details
visibility
public
final
false
static
true

isBcmathDisabled

isBcmathDisabled( ) :
Details
visibility
public
final
false
static
true

localize

localize( integer $value ) : string

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

Arguments
$value
integer
Value to normalize
Output
string
Normalized string without BCMath problems
Details
visibility
public
final
false
static
true

normalize

normalize( integer $value ) : string

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

Arguments
$value
integer
Value to normalize
Output
string
Normalized string without BCMath problems
Details
visibility
public
final
false
static
true

round

round(  $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);

Arguments
$op1
$precision
Details
visibility
public
final
false
static
true
Documentation was generated by DocBlox.