Overview

Namespaces

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

Classes

  • AbstractRationalType
  • GMPRationalType
  • RationalType
  • RationalTypeFactory
  • Overview
  • Namespace
  • Class
  • Tree

Class GMPRationalType

A rational number (i.e a fraction) This is the GMP type.

chippyash\Type\AbstractType implements chippyash\Type\Interfaces\TypeInterface
Extended by chippyash\Type\AbstractMultiValueType
Extended by chippyash\Type\Number\Rational\AbstractRationalType implements chippyash\Type\Interfaces\RationalTypeInterface, chippyash\Type\Interfaces\NumericTypeInterface
Extended by chippyash\Type\Number\Rational\GMPRationalType implements chippyash\Type\Interfaces\GMPInterface
Namespace: chippyash\Type\Number\Rational
Located at Number/Rational/GMPRationalType.php
Methods summary
public
# __construct( chippyash\Type\Number\GMPIntType $num, chippyash\Type\Number\GMPIntType $den, chippyash\Type\BoolType $reduce = null )

Construct new GMP rational

Construct new GMP rational

Parameters

$num
numerator
$den
denominator
$reduce
-optional: default = true

Overrides

chippyash\Type\AbstractMultiValueType::__construct()
public integer|float
# 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|float
integer|float

Overrides

chippyash\Type\AbstractMultiValueType::get()
public array
# gmp( )

Return the value of number as a gmp resource, object or array of same

Return the value of number as a gmp resource, object or array of same

Returns

array
[numerator, denominator]

Implementation of

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

Return number as GMPIntType number. Will return floor(n/d)

Return number as GMPIntType number. Will return floor(n/d)

Returns

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

Implementation of

chippyash\Type\Interfaces\GMPInterface::asGMPIntType()
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 IntTypes

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

Returns

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

Implementation of

chippyash\Type\Interfaces\GMPInterface::asGMPRational()
public chippyash\Type\Number\Rational\RationalType
# asRational( )

Return number as native Rational number. NB, numerator and denominator will be caste as IntTypes

Return number as native Rational number. NB, numerator and denominator will be caste as IntTypes

Returns

chippyash\Type\Number\Rational\RationalType
\chippyash\Type\Number\Rational\RationalType

Overrides

chippyash\Type\Number\Rational\AbstractRationalType::asRational()
Methods inherited from chippyash\Type\Number\Rational\AbstractRationalType
__toString(), abs(), asComplex(), asFloatType(), asIntType(), denominator(), getAsNativeType(), isInteger(), negate(), numerator()
Methods inherited from chippyash\Type\AbstractMultiValueType
__clone(), __invoke(), set()
Chippyash Strong Types API documentation generated by ApiGen 2.8.0