Overview

Namespaces

  • chippyash
    • Type
      • Exceptions
      • Interfaces
      • Number
        • Complex
        • Rational
      • String

Classes

  • FloatType
  • GMPIntType
  • IntType
  • NaturalIntType
  • WholeIntType
  • Overview
  • Namespace
  • Class
  • Tree

Class GMPIntType

Integer Type - for use with GMP extension

chippyash\Type\AbstractType implements chippyash\Type\Interfaces\TypeInterface
Extended by chippyash\Type\Number\IntType implements chippyash\Type\Interfaces\NumericTypeInterface
Extended by chippyash\Type\Number\GMPIntType implements chippyash\Type\Interfaces\GMPInterface
Namespace: chippyash\Type\Number
Located at Number/GMPIntType.php
Methods summary
public
# __construct( mixed $value )

Constructor - check for gmp support

Constructor - check for gmp support

Parameters

$value

Throws

chippyash\Type\Exceptions\GmpNotSupportedException
GmpNotSupportedException

Overrides

chippyash\Type\AbstractType::__construct()
public chippyash\Type\Number\GMPIntType
# negate( )

Negates the number

Negates the number

Returns

chippyash\Type\Number\GMPIntType
Fluent Interface

Overrides

chippyash\Type\Number\IntType::negate()
public chippyash\Type\Number\Complex\GMPComplexType
# asComplex( )

Return the number as a GMPComplex number i.e. n+0i

Return the number as a GMPComplex number i.e. n+0i

Returns

chippyash\Type\Number\Complex\GMPComplexType
\chippyash\Type\Number\Complex\GMPComplexType

Overrides

chippyash\Type\Number\IntType::asComplex()
public chippyash\Type\Number\Rational\GMPRationalType
# asRational( )

Return number as GMPRational number. NB, numerator and denominator will be caste as GMPIntTypes

Return number as GMPRational number. NB, numerator and denominator will be caste as GMPIntTypes

Returns

chippyash\Type\Number\Rational\GMPRationalType
\chippyash\Type\Number\Rational\GMPRationalType

Overrides

chippyash\Type\Number\IntType::asRational()
public chippyash\Type\Number\FloatType
# asFloatType( )

Return number as a FloatType number.

Return number as a FloatType number.

Returns

chippyash\Type\Number\FloatType
\chippyash\Type\Number\FloatType

Overrides

chippyash\Type\Number\IntType::asFloatType()
public chippyash\Type\Number\GMPIntType
# abs( )

Return the absolute value of the number

Return the absolute value of the number

Returns

chippyash\Type\Number\GMPIntType
\chippyash\Type\Number\GMPIntType

Overrides

chippyash\Type\Number\IntType::abs()
public array
# factors( )

Return all factors of this number (sorted) Returned factors are strings

Return all factors of this number (sorted) Returned factors are strings

Returns

array
[factor,factor, ...]

Overrides

chippyash\Type\Number\IntType::factors()
public array
# primeFactors( )

Return all prime factors of this number

Return all prime factors of this number

The keys (prime factors) will be strings The values (exponents will be integers

Adapted from http://www.thatsgeeky.com/2011/03/prime-factoring-with-php/

Returns

array
[primeFactor => exponent,...]

Overrides

chippyash\Type\Number\IntType::primeFactors()
public string
# __toString( )

Magic method - convert to string

Magic method - convert to string

Returns

string
string

Overrides

chippyash\Type\AbstractType::__toString()
public integer
# get( )

Get the value of the object typed properly as a PHP Native type

Get the value of the object typed properly as a PHP Native type

Returns

integer
integer

Overrides

chippyash\Type\AbstractType::get()
public GMP|resource
# gmp( )

Return the value of number as a gmp resource or object

Return the value of number as a gmp resource or object

Returns

GMP|resource
resource|gmp object

Implementation of

chippyash\Type\Interfaces\GMPInterface::gmp()
public chippyash\Type\Number\GMPIntType
# asGMPIntType( )

Return number as GMPIntType number.

Return number as GMPIntType number.

Returns

chippyash\Type\Number\GMPIntType
\chippyash\Type\Number\GMPIntType

Implementation of

chippyash\Type\Interfaces\GMPInterface::asGMPIntType()
public chippyash\Type\Number\IntType
# asIntType( )

Return number as IntType

Return number as IntType

Returns

chippyash\Type\Number\IntType
\chippyash\Type\Number\IntType

Overrides

chippyash\Type\Number\IntType::asIntType()
public chippyash\Type\Number\Complex\GMPComplexType
# asGMPComplex( )

Return the number as a GMPComplex number i.e. n+0i

Return the number as a GMPComplex number i.e. n+0i

Returns

chippyash\Type\Number\Complex\GMPComplexType
\chippyash\Type\Number\Complex\GMPComplexType

Implementation of

chippyash\Type\Interfaces\GMPInterface::asGMPComplex()
public chippyash\Type\Number\Rational\GMPRationalType
# asGMPRational( )

Return number as GMPRational number. NB, numerator and denominator will be caste as GMPIntTypes

Return number as GMPRational number. NB, numerator and denominator will be caste as GMPIntTypes

Returns

chippyash\Type\Number\Rational\GMPRationalType
\chippyash\Type\Number\Rational\GMPRationalType

Implementation of

chippyash\Type\Interfaces\GMPInterface::asGMPRational()
Methods inherited from chippyash\Type\AbstractType
__invoke(), set()
Chippyash Strong Types API documentation generated by ApiGen 2.8.0