Skip to content
This repository has been archived by the owner on Dec 27, 2023. It is now read-only.

Commit

Permalink
Improved documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
castarco committed Jan 25, 2014
1 parent f6c7c59 commit 59fb468
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 15 deletions.
29 changes: 15 additions & 14 deletions src/Decimal.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ final class Decimal

/**
* Private constructor
* @param integer $scale
*/
private function __construct($value, $scale)
{
Expand All @@ -57,7 +58,7 @@ private function __clone()
* Returns a "Positive Infinite" object
* @return Decimal
*/
public static function getPositiveInfinite ()
public static function getPositiveInfinite()
{
if (self::$pInf === null) {
self::$pInf = new Decimal('INF', 0);
Expand All @@ -70,7 +71,7 @@ public static function getPositiveInfinite ()
* Returns a "Negative Infinite" object
* @return Decimal
*/
public static function getNegativeInfinite ()
public static function getNegativeInfinite()
{
if (self::$nInf === null) {
self::$nInf = new Decimal('-INF', 0);
Expand Down Expand Up @@ -251,9 +252,9 @@ public static function fromDecimal(Decimal $decValue, $scale = null)

/**
* Adds two Decimal objects
* @param BigNumber $b
* @param Decimal $b
* @param integer $scale
* @return BigNumber
* @return Decimal
*/
public function add(Decimal $b, $scale = null)
{
Expand All @@ -279,9 +280,9 @@ public function add(Decimal $b, $scale = null)

/**
* Subtracts two BigNumber objects
* @param BigNumber $b
* @param Decimal $b
* @param integer $scale
* @return BigNumber
* @return Decimal
*/
public function sub(Decimal $b, $scale = null)
{
Expand All @@ -307,9 +308,9 @@ public function sub(Decimal $b, $scale = null)

/**
* Multiplies two BigNumber objects
* @param BigNumber $b
* @param Decimal $b
* @param integer $scale
* @return BigNumber
* @return Decimal
*/
public function mul(Decimal $b, $scale = null)
{
Expand Down Expand Up @@ -339,9 +340,9 @@ public function mul(Decimal $b, $scale = null)
* integer division because it rounds the
* last digit in order to minimize the error.
*
* @param BigNumber $b
* @param Decimal $b
* @param integer $scale
* @return BigNumber
* @return Decimal
*/
public function div(Decimal $b, $scale = null)
{
Expand All @@ -352,7 +353,7 @@ public function div(Decimal $b, $scale = null)
} elseif ($this->isZero()) {
return self::fromDecimal($this, $scale);
} elseif ($this->isInfinite()) {

if ($b->isInfinite()) {
throw new \DomainException("Infinite divided by Infinite is not allowed.");
} elseif ($b->isPositive()) {
Expand Down Expand Up @@ -545,7 +546,7 @@ public function isInfinite()

/**
* Equality comparison between this object and $b
* @param BigNumber $b
* @param Decimal $b
* @param integer $scale
* @return boolean
*/
Expand Down Expand Up @@ -573,7 +574,7 @@ public function equals(Decimal $b, $scale = null)
/**
* $this > $b : returns 1 , $this < $b : returns -1 , $this == $b : returns 0
*
* @param IComparableNumber $b
* @param Decimal $b
* @return integer
*/
public function comp(Decimal $b, $scale = null)
Expand Down Expand Up @@ -791,7 +792,7 @@ private static function compute2NRoot($base, $index, $out_scale)
* @param mixed $value
* @param integer $scale
*/
private static function paramsValidation ($value, $scale)
private static function paramsValidation($value, $scale)
{
if ($value === null) {
throw new \InvalidArgumentException('$value must be a non null number');
Expand Down
2 changes: 1 addition & 1 deletion tests/Infinite/InfiniteSubTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public function testInfiniteSub()
$catched = true;
}
$this->assertTrue($catched);

$catched = false;
try {
$nInf->sub($nInf);
Expand Down

0 comments on commit 59fb468

Please sign in to comment.