Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit f93b82a

Browse files
committedMar 16, 2025··
Added handling for scientific notation when there are no decimals
1 parent dfa260b commit f93b82a

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed
 

‎ext/bcmath/libbcmath/src/str2num.c

+1-5
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ bool bc_str2num(bc_num *num, const char *str, const char *end, size_t scale, siz
222222

223223
/* If a non-digit and non-decimal-point indicator is in the string, i.e. an invalid character */
224224
if (UNEXPECTED(!decimal_point && *ptr != '\0')) {
225-
goto fail;
225+
return bc_scientific_notation_str2num(num, str, end, integer_ptr, fractional_ptr, fractional_end, digits, full_scale);
226226
}
227227

228228
/* search and validate fractional end if exists */
@@ -311,8 +311,4 @@ bool bc_str2num(bc_num *num, const char *str, const char *end, size_t scale, siz
311311
zero:
312312
*num = bc_copy_num(BCG(_zero_));
313313
return true;
314-
315-
fail:
316-
*num = bc_copy_num(BCG(_zero_));
317-
return false;
318314
}

0 commit comments

Comments
 (0)
Please sign in to comment.