pkarashchenko commented on code in PR #7724: URL: https://github.com/apache/nuttx/pull/7724#discussion_r1037573738
########## libs/libc/stdlib/lib_strtod.c: ########## @@ -188,8 +227,17 @@ double strtod(FAR const char *str, FAR char **endptr) /* Process an exponent string */ - if (*p == 'e' || *p == 'E') + if ((p10 == 10. && (*p == 'e' || *p == 'E')) + || (p10 == 16. && (*p == 'p' || *p == 'P'))) { + /* if the Hexadecimal system */ + + if (p10 == 16.) + { + exponent *= 4; + p10 = 2.0; Review Comment: ```suggestion p10 = 2.; ``` Just to follow the same style ########## libs/libc/stdlib/lib_strtof.c: ########## @@ -142,16 +174,24 @@ float strtof(FAR const char *str, FAR char **endptr) break; } + p10 = 10.0f; number = 0.0F; Review Comment: ```suggestion number = 0.0f; ``` ########## libs/libc/stdlib/lib_strtod.c: ########## @@ -140,16 +172,24 @@ double strtod(FAR const char *str, FAR char **endptr) break; } + p10 = 10.; number = 0.; exponent = 0; num_digits = 0; num_decimals = 0; + /* Process optional 0x prefix */ + + if (*p == '0' && tolower(*(p + 1)) == 'x') + { + p += 2; + p10 = 16.; Review Comment: ```suggestion p10 = 16.; ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org