Skip to content

Commit e3fa32c

Browse files
committed
Added removing fraction trailing zeros
1 parent fbe76fc commit e3fa32c

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

ext/bcmath/libbcmath/src/str2num.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,13 @@ static bool bc_scientific_notation_str2num(
142142
exponent_ptr++;
143143
}
144144

145+
if (fractional_end != NULL) {
146+
/* Skip fraction trailing zeros. This is rare, so don't do bulk processing. */
147+
while (fractional_end[-1] == '0') {
148+
fractional_end--;
149+
}
150+
}
151+
145152
const char *integer_end = integer_ptr + digits;
146153

147154
size_t str_scale = fractional_end - fractional_ptr;

0 commit comments

Comments
 (0)