mirror of
https://github.com/apache/nuttx.git
synced 2026-08-05 14:19:03 +00:00
solve:
almost the Hexadecimal string string->float
such as:
code:float num;
const char *s= "0x123p32lala";
char *p;
num=strtof(s,&p);
printf("num is %f\n",num);
printf("str is %s\n",p);
output:num is 1249835483136.000000
str is lala
but if the input number is much big;
like:
code:const char *s2= "0x999999p100";
num=strtof(s2,&p);
printf("num is %f\n",num);
printf("str is %s\n",p);
corrent : num is 12760587998944832242938906880669384704.000000
real: num is 12760587998944800000000000000000000000.000000
it didn't have enough precision
|
||
|---|---|---|
| .. | ||
| Kconfig | ||
| lib_abort.c | ||
| lib_abs.c | ||
| lib_aligned_alloc.c | ||
| lib_atexit.c | ||
| lib_atof.c | ||
| lib_atoi.c | ||
| lib_atol.c | ||
| lib_atoll.c | ||
| lib_bsearch.c | ||
| lib_checkbase.c | ||
| lib_cxa_atexit.c | ||
| lib_div.c | ||
| lib_exit.c | ||
| lib_getprogname.c | ||
| lib_itoa.c | ||
| lib_labs.c | ||
| lib_ldiv.c | ||
| lib_llabs.c | ||
| lib_lldiv.c | ||
| lib_mblen.c | ||
| lib_mbstowcs.c | ||
| lib_mbtowc.c | ||
| lib_mkdtemp.c | ||
| lib_mkstemp.c | ||
| lib_mktemp.c | ||
| lib_onexit.c | ||
| lib_openpty.c | ||
| lib_posix_memalign.c | ||
| lib_ptsname.c | ||
| lib_ptsnamer.c | ||
| lib_qsort.c | ||
| lib_rand.c | ||
| lib_realpath.c | ||
| lib_srand.c | ||
| lib_strtod.c | ||
| lib_strtof.c | ||
| lib_strtol.c | ||
| lib_strtold.c | ||
| lib_strtoll.c | ||
| lib_strtoul.c | ||
| lib_strtoull.c | ||
| lib_unlockpt.c | ||
| lib_valloc.c | ||
| lib_wcstombs.c | ||
| lib_wctomb.c | ||
| Make.defs | ||