mirror of
https://github.com/fastfloat/fast_float.git
synced 2025-12-06 16:56:57 +08:00
fix for the parse_number_string
This commit is contained in:
parent
f7d5037a4f
commit
6b22957188
@ -396,8 +396,8 @@ parse_number_string(UC const *p, UC const *pend,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
} else if (digit_count ==
|
} else if (digit_count == 0) {
|
||||||
0) { // we must have encountered at least one integer!
|
// We must have encountered at least one integer!
|
||||||
return report_parse_error<UC>(p, parse_error::no_digits_in_mantissa);
|
return report_parse_error<UC>(p, parse_error::no_digits_in_mantissa);
|
||||||
}
|
}
|
||||||
// We have now parsed the integer and the fraction part of the mantissa.
|
// We have now parsed the integer and the fraction part of the mantissa.
|
||||||
@ -407,8 +407,7 @@ parse_number_string(UC const *p, UC const *pend,
|
|||||||
bool neg_exp = false;
|
bool neg_exp = false;
|
||||||
if (p != pend) {
|
if (p != pend) {
|
||||||
UC const *location_of_e;
|
UC const *location_of_e;
|
||||||
if (chars_format_t(options.format & chars_format::scientific) ||
|
if (chars_format_t(options.format & chars_format::scientific)) {
|
||||||
chars_format_t(options.format & chars_format::fixed)) {
|
|
||||||
switch (*p) {
|
switch (*p) {
|
||||||
case UC('e'):
|
case UC('e'):
|
||||||
case UC('E'):
|
case UC('E'):
|
||||||
@ -485,13 +484,11 @@ parse_number_string(UC const *p, UC const *pend,
|
|||||||
exp_number = -exp_number;
|
exp_number = -exp_number;
|
||||||
}
|
}
|
||||||
answer.exponent += exp_number;
|
answer.exponent += exp_number;
|
||||||
}
|
} else if (chars_format_t(options.format & chars_format::scientific) &&
|
||||||
#ifndef FASTFLOAT_ONLY_POSITIVE_C_NUMBER_WO_INF_NAN
|
!chars_format_t(options.format & chars_format::fixed)) {
|
||||||
else if (chars_format_t(options.format & detail::basic_fortran_fmt)) {
|
// If it scientific and not fixed, we have to bail out.
|
||||||
// In Fortran the number in exponent part is mandatory.
|
|
||||||
return report_parse_error<UC>(p, parse_error::missing_exponential_part);
|
return report_parse_error<UC>(p, parse_error::missing_exponential_part);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// We parsed all parts of the number, let's save progress.
|
// We parsed all parts of the number, let's save progress.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user