-
Notifications
You must be signed in to change notification settings - Fork 21
Closed
Description
Looks like i have found a bug. signum() for zero expected to be a zero. But, it is returns 1.
decimal support | enabled
decimal version | 1.1.0
libmpdec version | 2.4.2
Test code:
$a = new Decimal(0);
print_r($a);
echo 'isZero? ', var_export($a->isZero(), true), "\n";
echo 'signum: ', $a->signum(), "\n";
$a = new Decimal(1);
print_r($a);
echo 'isZero? ', var_export($a->isZero(), true), "\n";
echo 'signum: ', $a->signum(), "\n";
$a = new Decimal(-1);
print_r($a);
echo 'isZero? ', var_export($a->isZero(), true), "\n";
echo 'signum: ', $a->signum(), "\n";
Output:
Decimal\Decimal Object
(
[value] => 0
[precision] => 28
)
isZero? true
signum: 1
Decimal\Decimal Object
(
[value] => 1
[precision] => 28
)
isZero? false
signum: 1
Decimal\Decimal Object
(
[value] => -1
[precision] => 28
)
isZero? false
signum: -1
Metadata
Metadata
Assignees
Labels
No labels