mirror of
https://github.com/danog/math.git
synced 2025-01-22 21:51:22 +01:00
Rename BigDecimal::dividedAndRemainder() to quotientAndRemainder()
This is consistent with the naming of the BigInteger method.
This commit is contained in:
parent
38a6b8c342
commit
271b619453
@ -407,7 +407,7 @@ final class BigDecimal extends BigNumber implements \Serializable
|
|||||||
*
|
*
|
||||||
* @throws DivisionByZeroException If the divisor is zero.
|
* @throws DivisionByZeroException If the divisor is zero.
|
||||||
*/
|
*/
|
||||||
public function divideAndRemainder($that)
|
public function quotientAndRemainder($that)
|
||||||
{
|
{
|
||||||
$that = BigDecimal::of($that);
|
$that = BigDecimal::of($that);
|
||||||
|
|
||||||
|
@ -1251,16 +1251,16 @@ class BigDecimalTest extends AbstractTestCase
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dataProvider providerDivideAndRemainder
|
* @dataProvider providerQuotientAndRemainder
|
||||||
*
|
*
|
||||||
* @param string $dividend The dividend.
|
* @param string $dividend The dividend.
|
||||||
* @param string $divisor The divisor.
|
* @param string $divisor The divisor.
|
||||||
* @param string $quotient The expected quotient.
|
* @param string $quotient The expected quotient.
|
||||||
* @param string $remainder The expected remainder.
|
* @param string $remainder The expected remainder.
|
||||||
*/
|
*/
|
||||||
public function testDivideAndRemainder($dividend, $divisor, $quotient, $remainder)
|
public function testQuotientAndRemainder($dividend, $divisor, $quotient, $remainder)
|
||||||
{
|
{
|
||||||
list ($q, $r) = BigDecimal::of($dividend)->divideAndRemainder($divisor);
|
list ($q, $r) = BigDecimal::of($dividend)->quotientAndRemainder($divisor);
|
||||||
|
|
||||||
$this->assertBigDecimalEquals($quotient, $q);
|
$this->assertBigDecimalEquals($quotient, $q);
|
||||||
$this->assertBigDecimalEquals($remainder, $r);
|
$this->assertBigDecimalEquals($remainder, $r);
|
||||||
@ -1269,7 +1269,7 @@ class BigDecimalTest extends AbstractTestCase
|
|||||||
/**
|
/**
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function providerDivideAndRemainder()
|
public function providerQuotientAndRemainder()
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
['1', '123', '0', '1'],
|
['1', '123', '0', '1'],
|
||||||
@ -1341,9 +1341,9 @@ class BigDecimalTest extends AbstractTestCase
|
|||||||
/**
|
/**
|
||||||
* @expectedException \Brick\Math\Exception\DivisionByZeroException
|
* @expectedException \Brick\Math\Exception\DivisionByZeroException
|
||||||
*/
|
*/
|
||||||
public function testDivideAndRemainderByZeroThrowsException()
|
public function testQuotientAndRemainderOfZeroThrowsException()
|
||||||
{
|
{
|
||||||
BigDecimal::of(1.2)->divideAndRemainder(0);
|
BigDecimal::of(1.2)->quotientAndRemainder(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user