Math_Integer
[ class tree: Math_Integer ] [ index: Math_Integer ] [ all elements ]

Class: Math_IntegerOp

Source Location: /Math_Integer-0.9.0/Math/IntegerOp.php

Class Overview


Class implementing operations on Math_Integer objects. If available it will use the GMP or BCMATH libraries. Will default to the standard PHP integer representation otherwise.


Author(s):

Version:

  • 0.9

Methods


Inherited Variables

Inherited Methods


Class Details

[line 36]
Class implementing operations on Math_Integer objects. If available it will use the GMP or BCMATH libraries. Will default to the standard PHP integer representation otherwise.

The operations are implemented as static methods of the class.



[ Top ]


Method Detail

abs   [line 342]

object Math_Integer &abs( &$int1, object Math_Integer $int1)

Returns the absolute value of a Math_Integer number
  • Return: on success, PEAR_Error otherwise
  • Access: public

Parameters:

object Math_Integer   $int1   — 
   &$int1   — 

[ Top ]

add   [line 133]

object Math_Integer &add( &$int1, &$int2, object Math_Integer $int1, object Math_Integer $int2)

Add two Math_Integer objects: $i1 + $i2
  • Return: on success, PEAR_Error otherwise
  • Access: public

Parameters:

object Math_Integer   $int1   — 
object Math_Integer   $int2   — 
   &$int1   — 
   &$int2   — 

[ Top ]

compare   [line 273]

mixed &compare( &$int1, &$int2, object Math_Integer $int1, object Math_Integer $int2)

Compare two Math_Integer objects.

if $i1 > $i2, returns +1, if $i1 == $i2, returns +0, if $i1 < $i2, returns -1,

  • Return: and integer on success, PEAR_Error otherwise
  • See: Math_IntegerOp::sign
  • Access: public

Parameters:

object Math_Integer   $int1   — 
object Math_Integer   $int2   — 
   &$int1   — 
   &$int2   — 

[ Top ]

div   [line 193]

object Math_Integer &div( &$int1, &$int2, object Math_Integer $int1, object Math_Integer $int2)

Divide two Math_Integer objects: $i1 / $i2
  • Return: on success, PEAR_Error otherwise
  • Access: public

Parameters:

object Math_Integer   $int1   — 
object Math_Integer   $int2   — 
   &$int1   — 
   &$int2   — 

[ Top ]

gcd   [line 254]

mixed &gcd( &$int1, &$int2, object Math_Integer $int1, object Math_Integer $int2)

Calculates the GCD of 2 Math_Integer objects
  • Return: and integer on success, PEAR_Error otherwise
  • See: Math_IntegerOp::sign
  • Access: public

Parameters:

object Math_Integer   $int1   — 
object Math_Integer   $int2   — 
   &$int1   — 
   &$int2   — 

[ Top ]

isEven   [line 72]

mixed isEven( &$int, object Math_Integer $int1)

Checks if the Math_Integer object is even
  • Return: TRUE if Math_Integer object is even, FALSE if it is not, PEAR_Error on error.
  • Access: public

Parameters:

object Math_Integer   $int1   — 
   &$int   — 

[ Top ]

isInteger   [line 45]

boolean isInteger( &$int, object Math_Integer $int1)

Checks if the given parameter is a Math_Integer object
  • Return: TRUE if parameter is an instance of Math_Integer, FALSE otherwise
  • Access: public

Parameters:

object Math_Integer   $int1   — 
   &$int   — 

[ Top ]

isNegative   [line 102]

mixed isNegative( &$int, object Math_Integer $int1)

Checks if the Math_Integer object is negative
  • Return: TRUE if Math_Integer object is negative, FALSE if it is not, PEAR_Error on error.
  • Access: public

Parameters:

object Math_Integer   $int1   — 
   &$int   — 

[ Top ]

isOdd   [line 57]

mixed isOdd( &$int, object Math_Integer $int1)

Checks if the Math_Integer object is Odd
  • Return: TRUE if Math_Integer object is odd, FALSE if it is not, PEAR_Error on error.
  • Access: public

Parameters:

object Math_Integer   $int1   — 
   &$int   — 

[ Top ]

isPositive   [line 87]

mixed isPositive( &$int, object Math_Integer $int1)

Checks if the Math_Integer object is positive
  • Return: TRUE if Math_Integer object is positive, FALSE if it is not, PEAR_Error on error.
  • Access: public

Parameters:

object Math_Integer   $int1   — 
   &$int   — 

[ Top ]

isZero   [line 117]

mixed isZero( &$int, object Math_Integer $int1)

Checks if the Math_Integer object is zero
  • Return: TRUE if Math_Integer object is zero, FALSE if it is not, PEAR_Error on error.
  • Access: public

Parameters:

object Math_Integer   $int1   — 
   &$int   — 

[ Top ]

mod   [line 213]

object Math_Integer &mod( &$int1, &$int2, object Math_Integer $int1, object Math_Integer $int2)

Calculate the modulus of $i1 and $i2: $i1 % $i2
  • Return: on success, PEAR_Error otherwise
  • Access: public

Parameters:

object Math_Integer   $int1   — 
object Math_Integer   $int2   — 
   &$int1   — 
   &$int2   — 

[ Top ]

mul   [line 173]

object Math_Integer &mul( &$int1, &$int2, object Math_Integer $int1, object Math_Integer $int2)

Multiply two Math_Integer objects: $i1 * $i2
  • Return: on success, PEAR_Error otherwise
  • Access: public

Parameters:

object Math_Integer   $int1   — 
object Math_Integer   $int2   — 
   &$int1   — 
   &$int2   — 

[ Top ]

negate   [line 304]

object Math_Integer &negate( &$int1, object Math_Integer $int1)

Returns the negative of a Math_Integer number: -1 * $i1
  • Return: on success, PEAR_Error otherwise
  • Access: public

Parameters:

object Math_Integer   $int1   — 
   &$int1   — 

[ Top ]

pow   [line 233]

object Math_Integer &pow( &$int1, &$int2, object Math_Integer $int1, object Math_Integer $int2)

Raise $i1 to the $i2 exponent: $i1^$i2
  • Return: on success, PEAR_Error otherwise
  • Access: public

Parameters:

object Math_Integer   $int1   — 
object Math_Integer   $int2   — 
   &$int1   — 
   &$int2   — 

[ Top ]

sign   [line 290]

mixed &sign( &$int1, object Math_Integer $int1)

Returns the sign of a Math_Integer number

if $i1 > 0, returns +1, if $i1 == 0, returns +0, if $i1 < 0, returns -1,

  • Return: and integer on success, PEAR_Error otherwise
  • Access: public

Parameters:

object Math_Integer   $int1   — 
   &$int1   — 

[ Top ]

sqrt   [line 323]

object Math_Integer &sqrt( &$int1, object Math_Integer $int1)

Returns the (integer) square root of a Math_Integer number
  • Return: on success, PEAR_Error otherwise
  • Access: public

Parameters:

object Math_Integer   $int1   — 
   &$int1   — 

[ Top ]

sub   [line 153]

object Math_Integer &sub( &$int1, &$int2, object Math_Integer $int1, object Math_Integer $int2)

Substract two Math_Integer objects: $i1 - $i2
  • Return: on success, PEAR_Error otherwise
  • Access: public

Parameters:

object Math_Integer   $int1   — 
object Math_Integer   $int2   — 
   &$int1   — 
   &$int2   — 

[ Top ]


Documentation generated on Mon, 11 Mar 2019 15:39:15 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.