Skip to content

Commit 26aade4

Browse files
Fixed the comment
Co-authored-by: Gina Peter Banyard <girgias@php.net>
1 parent 1202500 commit 26aade4

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

ext/bcmath/libbcmath/src/round.c

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,14 @@ void bc_round(bc_num num, zend_long precision, zend_long mode, bc_num *result)
3939
bc_free_num(result);
4040

4141
/*
42-
* The following three cases result in an early return:
42+
* The following cases result in an early return:
4343
*
44-
* 1. When rounding to an integer part, when trying to round to a digit
45-
* larger than the num.
46-
* 2. If try to round to the finest digit of num or finer than that,
47-
* num is returned unchanged.
48-
* 3. If the fraction part is all 0 from the beginning or middle to the
49-
* end, the 0's are omitted and the number of digits in num is reduced.
50-
* In that case, may end up in the same situation as 2.
44+
* - When rounding to an integer part which is larger than the number
45+
* e.g. Rounding 21.123 to 3 digits before the decimal point.
46+
* - When rounding to a greater decimal precision then the number has, the number is unchanged
47+
* e.g. Rounding 21.123 to 4 digits after the decimal point.
48+
* - If the fractional part ends with zeros, the zeros are omitted and the number of digits in num is reduced.
49+
* Meaning we might end up in the previous case.
5150
*/
5251
if (precision < 0 && num->n_len <= (size_t) (-(precision + Z_L(1))) + 1) {
5352
*result = bc_copy_num(BCG(_zero_));

0 commit comments

Comments
 (0)