Closed maska989 closed 1 year ago
The scanf()
implementation uses three functions strtof()
, strtod()
, strtold()
to read and convert float/double/long double values. So the root problem is not in scanf()
itself, but in the limited implementation of strtold()
which is common base to the other two functions.
strtoll()
, strtoul()
, .. strtold()
, strtod()
, strtof()
should be tested first as other functions like e.g. scanf()
, atoi()
, etc.. benefit from the implementation of the above-mentioned base functions so as not to "reinvent the wheel".
https://github.com/phoenix-rtos/libphoenix/blob/e913aa45b783bbc630dafac0ee36871a6a2324d9/stdio/scanf.c#L548 https://github.com/phoenix-rtos/libphoenix/blob/e913aa45b783bbc630dafac0ee36871a6a2324d9/stdio/scanf.c#L568-L580
So this also applies for issue https://github.com/phoenix-rtos/phoenix-rtos-project/issues/634 about: NaN
and INFinity
as strtold()
needs to support and for which strtold()
support should be tested first.
Yeah thanks for noticing that, there already is such test (https://github.com/phoenix-rtos/phoenix-rtos-tests/pull/135). We will add similar cases to it and update issue with the code to reproduce using strto* functions. Applies also for https://github.com/phoenix-rtos/phoenix-rtos-project/issues/634
@gerard5 I'm sorry for the lousy issue caused by a poorly selected available branch on libphoenix. Once again sorry for wasting time.
During scanf tests there was a problem reading floats in scientific notation
The problem occurs in an all-conversion specifier wich can handle that (%aAeEgGfF).
int main(void) { float test;
}