Skip to content

Commit

Permalink
Deprecate doubleValue() in favor of floatValue()
Browse files Browse the repository at this point in the history
  • Loading branch information
thekid committed Mar 25, 2022
1 parent f6ad9a8 commit acdd5dc
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 38 deletions.
1 change: 1 addition & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ XP Math changelog

## ?.?.? / ????-??-??

* Deprecated doubleValue() in favor of floatValue() - @thekid
* Merged PR #3: Comparison and equality - @thekid

## 9.0.2 / 2022-03-25
Expand Down
58 changes: 27 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,29 +15,26 @@ API: BigInt

```php
public class math.BigInt extends math.BigNum {

public math.BigInt __construct(string $in)

protected static string bytesOf(var $n)

public math.BigNum add(var $other)
public math.BigNum subtract(var $other)
public math.BigNum multiply(var $other)
public math.BigNum divide(var $other)
public math.BigNum add0(var $other)
public math.BigNum subtract0(var $other)
public math.BigNum multiply0(var $other)
public math.BigNum divide0(var $other)
public math.BigNum power(var $other)
public math.BigNum modulo(var $other)
public math.BigNum bitwiseAnd(var $other)
public math.BigNum bitwiseOr(var $other)
public math.BigNum bitwiseXor(var $other)
public math.BigNum shiftRight(var $shift)
public math.BigNum shiftLeft(var $shift)
public math.BigInt __construct(int|float|string|parent $in)

public math.BigNum add(int|float|string|parent $other)
public math.BigNum subtract(int|float|string|parent $other)
public math.BigNum multiply(int|float|string|parent $other)
public math.BigNum divide(int|float|string|parent $other)
public math.BigNum add0(int|float|string|parent $other)
public math.BigNum subtract0(int|float|string|parent $other)
public math.BigNum multiply0(int|float|string|parent $other)
public math.BigNum divide0(int|float|string|parent $other)
public math.BigNum power(int|float|string|parent $other)
public math.BigNum modulo(int|float|string|parent $other)
public math.BigNum bitwiseAnd(int|float|string|parent $other)
public math.BigNum bitwiseOr(int|float|string|parent $other)
public math.BigNum bitwiseXor(int|float|string|parent $other)
public math.BigNum shiftRight(int|float|string|parent $shift)
public math.BigNum shiftLeft(int|float|string|parent $shift)
public int byteValue()
public int intValue()
public int doubleValue()
public float floatValue()
}
```

Expand All @@ -46,20 +43,19 @@ API: BigFloat

```php
public class math.BigFloat extends math.BigNum {
protected var math.BigNum::$num

public math.BigFloat __construct(string $in)
public math.BigFloat __construct(int|float|string|parent $in)

public math.BigNum add(var $other)
public math.BigNum subtract(var $other)
public math.BigNum multiply(var $other)
public math.BigNum divide(var $other)
public math.BigNum power(var $other)
public math.BigNum add(int|float|string|parent $other)
public math.BigNum subtract(int|float|string|parent $other)
public math.BigNum multiply(int|float|string|parent $other)
public math.BigNum divide(int|float|string|parent $other)
public math.BigNum power(int|float|string|parent $other)
public math.BigFloat ceil()
public math.BigFloat floor()
public math.BigFloat round([int $precision= 0])
public bool equals(lang.Generic $cmp)
public int compare(int|float|string|parent $other, ?int $precision= null)
public bool equals(int|float|string|parent $other, ?int $precision= null)
public int intValue()
public int doubleValue()
public float floatValue()
}
```
14 changes: 7 additions & 7 deletions src/main/php/math/BigNum.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,16 @@ public abstract function multiply($other);
*/
public abstract function divide($other);

/**
* Returns an integer representing this bignum
*
* @return int
*/
public function intValue() { return (int)substr($this->num, 0, strcspn($this->num, '.')); }
/** Returns an integer representing this bignum */
public function intValue(): int { return (int)$this->num; }

/** Returns an float representing this bignum */
public function floatValue(): float { return (float)$this->num; }

/**
* Returns a double representing this bignum
* Returns a float representing this bignum
*
* @deprecated Use floatValue() instead
* @return double
*/
public function doubleValue() { return (double)$this->num; }
Expand Down

0 comments on commit acdd5dc

Please sign in to comment.