\PHPExcel_Calculation_MathTrig

PHPExcel_Calculation_MathTrig

Copyright (c) 2006 - 2015 PHPExcel

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA

Summary

Methods
Properties
Constants
ATAN2()
CEILING()
COMBIN()
EVEN()
FACT()
FACTDOUBLE()
FLOOR()
GCD()
INT()
LCM()
LOG_BASE()
MDETERM()
MINVERSE()
MMULT()
MOD()
MROUND()
MULTINOMIAL()
ODD()
POWER()
PRODUCT()
QUOTIENT()
RAND()
ROMAN()
ROUNDUP()
ROUNDDOWN()
SERIESSUM()
SIGN()
SQRTPI()
SUBTOTAL()
SUM()
SUMIF()
SUMIFS()
SUMPRODUCT()
SUMSQ()
SUMX2MY2()
SUMX2PY2()
SUMXMY2()
TRUNC()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
factors()
romanCut()
No private properties found
N/A

Methods

ATAN2()

ATAN2(float  $xCoordinate = null, float  $yCoordinate = null) : float

ATAN2

This function calculates the arc tangent of the two variables x and y. It is similar to calculating the arc tangent of y ÷ x, except that the signs of both arguments are used to determine the quadrant of the result. The arctangent is the angle from the x-axis to a line containing the origin (0, 0) and a point with coordinates (xCoordinate, yCoordinate). The angle is given in radians between -pi and pi, excluding -pi.

Note that the Excel ATAN2() function accepts its arguments in the reverse order to the standard PHP atan2() function, so we need to reverse them here before calling the PHP atan() function.

Excel Function: ATAN2(xCoordinate,yCoordinate)

Parameters

float $xCoordinate

The x-coordinate of the point.

float $yCoordinate

The y-coordinate of the point.

Returns

float —

The inverse tangent of the specified x- and y-coordinates.

CEILING()

CEILING(float  $number, float  $significance = null) : float

CEILING

Returns number rounded up, away from zero, to the nearest multiple of significance. For example, if you want to avoid using pennies in your prices and your product is priced at $4.42, use the formula =CEILING(4.42,0.05) to round prices up to the nearest nickel.

Excel Function: CEILING(number[,significance])

Parameters

float $number

The number you want to round.

float $significance

The multiple to which you want to round.

Returns

float —

Rounded Number

COMBIN()

COMBIN(integer  $numObjs, integer  $numInSet) : integer

COMBIN

Returns the number of combinations for a given number of items. Use COMBIN to determine the total possible number of groups for a given number of items.

Excel Function: COMBIN(numObjs,numInSet)

Parameters

integer $numObjs

Number of different objects

integer $numInSet

Number of objects in each combination

Returns

integer —

Number of combinations

EVEN()

EVEN(float  $number) : integer

EVEN

Returns number rounded up to the nearest even integer. You can use this function for processing items that come in twos. For example, a packing crate accepts rows of one or two items. The crate is full when the number of items, rounded up to the nearest two, matches the crate's capacity.

Excel Function: EVEN(number)

Parameters

float $number

Number to round

Returns

integer —

Rounded Number

FACT()

FACT(float  $factVal) : integer

FACT

Returns the factorial of a number. The factorial of a number is equal to 123... number.

Excel Function: FACT(factVal)

Parameters

float $factVal

Factorial Value

Returns

integer —

Factorial

FACTDOUBLE()

FACTDOUBLE(float  $factVal) : integer

FACTDOUBLE

Returns the double factorial of a number.

Excel Function: FACTDOUBLE(factVal)

Parameters

float $factVal

Factorial Value

Returns

integer —

Double Factorial

FLOOR()

FLOOR(float  $number, float  $significance = null) : float

FLOOR

Rounds number down, toward zero, to the nearest multiple of significance.

Excel Function: FLOOR(number[,significance])

Parameters

float $number

Number to round

float $significance

Significance

Returns

float —

Rounded Number

GCD()

GCD() : integer

GCD

Returns the greatest common divisor of a series of numbers. The greatest common divisor is the largest integer that divides both number1 and number2 without a remainder.

Excel Function: GCD(number1[,number2[, ...]])

Returns

integer —

Greatest Common Divisor

INT()

INT(float  $number) : integer

INT

Casts a floating point value to an integer

Excel Function: INT(number)

Parameters

float $number

Number to cast to an integer

Returns

integer —

Integer value

LCM()

LCM() : integer

LCM

Returns the lowest common multiplier of a series of numbers The least common multiple is the smallest positive integer that is a multiple of all integer arguments number1, number2, and so on. Use LCM to add fractions with different denominators.

Excel Function: LCM(number1[,number2[, ...]])

Returns

integer —

Lowest Common Multiplier

LOG_BASE()

LOG_BASE(float  $number = null, float  $base = 10) : float

LOG_BASE

Returns the logarithm of a number to a specified base. The default base is 10.

Excel Function: LOG(number[,base])

Parameters

float $number

The positive real number for which you want the logarithm

float $base

The base of the logarithm. If base is omitted, it is assumed to be 10.

Returns

float

MDETERM()

MDETERM(array  $matrixValues) : float

MDETERM

Returns the matrix determinant of an array.

Excel Function: MDETERM(array)

Parameters

array $matrixValues

A matrix of values

Returns

float

MINVERSE()

MINVERSE(array  $matrixValues) : array

MINVERSE

Returns the inverse matrix for the matrix stored in an array.

Excel Function: MINVERSE(array)

Parameters

array $matrixValues

A matrix of values

Returns

array

MMULT()

MMULT(array  $matrixData1, array  $matrixData2) : array

MMULT

Parameters

array $matrixData1

A matrix of values

array $matrixData2

A matrix of values

Returns

array

MOD()

MOD(integer  $a = 1, integer  $b = 1) : integer

MOD

Parameters

integer $a

Dividend

integer $b

Divisor

Returns

integer —

Remainder

MROUND()

MROUND(float  $number, integer  $multiple) : float

MROUND

Rounds a number to the nearest multiple of a specified value

Parameters

float $number

Number to round

integer $multiple

Multiple to which you want to round $number

Returns

float —

Rounded Number

MULTINOMIAL()

MULTINOMIAL() : float

MULTINOMIAL

Returns the ratio of the factorial of a sum of values to the product of factorials.

Returns

float

ODD()

ODD(float  $number) : integer

ODD

Returns number rounded up to the nearest odd integer.

Parameters

float $number

Number to round

Returns

integer —

Rounded Number

POWER()

POWER(float  $x, float  $y = 2) : float

POWER

Computes x raised to the power y.

Parameters

float $x
float $y

Returns

float

PRODUCT()

PRODUCT() : float

PRODUCT

PRODUCT returns the product of all the values and cells referenced in the argument list.

Excel Function: PRODUCT(value1[,value2[, ...]])

Returns

float

QUOTIENT()

QUOTIENT() : float

QUOTIENT

QUOTIENT function returns the integer portion of a division. Numerator is the divided number and denominator is the divisor.

Excel Function: QUOTIENT(value1[,value2[, ...]])

Returns

float

RAND()

RAND(integer  $min, integer  $max) : integer

RAND

Parameters

integer $min

Minimal value

integer $max

Maximal value

Returns

integer —

Random number

ROMAN()

ROMAN(  $aValue,   $style) 

Parameters

$aValue
$style

ROUNDUP()

ROUNDUP(float  $number, integer  $digits) : float

ROUNDUP

Rounds a number up to a specified number of decimal places

Parameters

float $number

Number to round

integer $digits

Number of digits to which you want to round $number

Returns

float —

Rounded Number

ROUNDDOWN()

ROUNDDOWN(float  $number, integer  $digits) : float

ROUNDDOWN

Rounds a number down to a specified number of decimal places

Parameters

float $number

Number to round

integer $digits

Number of digits to which you want to round $number

Returns

float —

Rounded Number

SERIESSUM()

SERIESSUM() : float

SERIESSUM

Returns the sum of a power series

Returns

float

SIGN()

SIGN(float  $number) : integer

SIGN

Determines the sign of a number. Returns 1 if the number is positive, zero (0) if the number is 0, and -1 if the number is negative.

Parameters

float $number

Number to round

Returns

integer —

sign value

SQRTPI()

SQRTPI(float  $number) : float

SQRTPI

Returns the square root of (number * pi).

Parameters

float $number

Number

Returns

float —

Square Root of Number * Pi

SUBTOTAL()

SUBTOTAL() : float

SUBTOTAL

Returns a subtotal in a list or database.

Returns

float

SUM()

SUM() : float

SUM

SUM computes the sum of all the values and cells referenced in the argument list.

Excel Function: SUM(value1[,value2[, ...]])

Returns

float

SUMIF()

SUMIF(  $aArgs, string  $condition,   $sumArgs = array()) : float

SUMIF

Counts the number of cells that contain numbers within the list of arguments

Excel Function: SUMIF(value1[,value2[, ...]],condition)

Parameters

$aArgs
string $condition

The criteria that defines which cells will be summed.

$sumArgs

Returns

float

SUMIFS()

SUMIFS() : float

SUMIFS

Counts the number of cells that contain numbers within the list of arguments

Excel Function: SUMIFS(value1[,value2[, ...]],condition)

Returns

float

SUMPRODUCT()

SUMPRODUCT() : float

SUMPRODUCT

Excel Function: SUMPRODUCT(value1[,value2[, ...]])

Returns

float

SUMSQ()

SUMSQ() : float

SUMSQ

SUMSQ returns the sum of the squares of the arguments

Excel Function: SUMSQ(value1[,value2[, ...]])

Returns

float

SUMX2MY2()

SUMX2MY2(array<mixed,mixed>  $matrixData1, array<mixed,mixed>  $matrixData2) : float

SUMX2MY2

Parameters

array<mixed,mixed> $matrixData1

Matrix #1

array<mixed,mixed> $matrixData2

Matrix #2

Returns

float

SUMX2PY2()

SUMX2PY2(array<mixed,mixed>  $matrixData1, array<mixed,mixed>  $matrixData2) : float

SUMX2PY2

Parameters

array<mixed,mixed> $matrixData1

Matrix #1

array<mixed,mixed> $matrixData2

Matrix #2

Returns

float

SUMXMY2()

SUMXMY2(array<mixed,mixed>  $matrixData1, array<mixed,mixed>  $matrixData2) : float

SUMXMY2

Parameters

array<mixed,mixed> $matrixData1

Matrix #1

array<mixed,mixed> $matrixData2

Matrix #2

Returns

float

TRUNC()

TRUNC(float  $value, integer  $digits) : float

TRUNC

Truncates value to the number of fractional digits by number_digits.

Parameters

float $value
integer $digits

Returns

float —

Truncated value

factors()

factors(  $value) 

Parameters

$value

romanCut()

romanCut(  $num,   $n) 

Parameters

$num
$n