diff --git a/src/BigDecimal.php b/src/BigDecimal.php index d5a76ab..191ea26 100644 --- a/src/BigDecimal.php +++ b/src/BigDecimal.php @@ -447,7 +447,7 @@ final class BigDecimal extends BigNumber implements \Serializable $guess = $this->quotient($two); while (true) { $last = $guess; - $guess = $this->quotient($guess)->add($guess)->quotient($two); + $guess = $this->quotient($guess)->plus($guess)->quotient($two); // (($n / $guess) + $guess) / 2; if($last->compareTo($guess) == 0) { break; diff --git a/tests/BigDecimalTest.php b/tests/BigDecimalTest.php index 22dd8c4..5c8aa5a 100644 --- a/tests/BigDecimalTest.php +++ b/tests/BigDecimalTest.php @@ -1372,7 +1372,7 @@ class BigDecimalTest extends AbstractTestCase public function testsqrt() { - $this->assertSame(BigDecimal::of(625)->sqrt(), BigDecimal::of(25)); + $this->assertSame(BigDecimal::of(625)->sqrt()->compareTo(25), 0); } /**