mirror of
https://github.com/php/php-src.git
synced 2025-08-20 01:14:28 +02:00
Fix #78238: BCMath returns "-0"
There is no negative zero in the decimal system, so we must suppress the sign. Closes GH-7250.
This commit is contained in:
parent
8f97f82e35
commit
bcb89c75ec
5 changed files with 32 additions and 3 deletions
|
@ -40,7 +40,7 @@
|
|||
/* In some places we need to check if the number NUM is zero. */
|
||||
|
||||
char
|
||||
bc_is_zero (bc_num num)
|
||||
bc_is_zero_for_scale (bc_num num, int scale)
|
||||
{
|
||||
int count;
|
||||
char *nptr;
|
||||
|
@ -49,7 +49,7 @@ bc_is_zero (bc_num num)
|
|||
if (num == BCG(_zero_)) return TRUE;
|
||||
|
||||
/* Initialize */
|
||||
count = num->n_len + num->n_scale;
|
||||
count = num->n_len + scale;
|
||||
nptr = num->n_value;
|
||||
|
||||
/* The check */
|
||||
|
@ -60,3 +60,9 @@ bc_is_zero (bc_num num)
|
|||
else
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
char
|
||||
bc_is_zero (bc_num num)
|
||||
{
|
||||
return bc_is_zero_for_scale(num, num->n_scale);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue