1
0
mirror of https://github.com/danog/math.git synced 2024-11-27 04:14:40 +01:00

Add __toString() to the BigNumber interface

This commit is contained in:
Benjamin Morel 2015-06-20 11:01:46 +02:00
parent ade40b841b
commit 2619c02fd6
4 changed files with 16 additions and 5 deletions

View File

@ -805,9 +805,7 @@ class BigDecimal implements BigNumber, \Serializable
}
/**
* Returns a string representation of this number.
*
* @return string
* {@inheritdoc}
*/
public function __toString()
{

View File

@ -638,7 +638,7 @@ class BigInteger implements BigNumber, \Serializable
}
/**
* @return string
* {@inheritdoc}
*/
public function __toString()
{

View File

@ -8,6 +8,8 @@ namespace Brick\Math;
interface BigNumber
{
/**
* Converts this number to a BigInteger.
*
* @return BigInteger
*
* @throws ArithmeticException If this number cannot be safely converted to a BigInteger.
@ -15,6 +17,8 @@ interface BigNumber
public function toBigInteger();
/**
* Converts this number to a BigDecimal.
*
* @return BigDecimal
*
* @throws ArithmeticException If this number cannot be safely converted to a BigDecimal.
@ -22,7 +26,16 @@ interface BigNumber
public function toBigDecimal();
/**
* Converts this number to a BigRational.
*
* @return BigRational
*/
public function toBigRational();
/**
* Returns a string representation of this number.
*
* @return string
*/
public function __toString();
}

View File

@ -457,7 +457,7 @@ class BigRational implements BigNumber, \Serializable
}
/**
* @return string
* {@inheritdoc}
*/
public function __toString()
{