new floating point parser/converter
[musl] / src / stdlib / strtold.c
1 #include <stdlib.h>
2 #include "floatscan.h"
3 #include "stdio_impl.h"
4
5 long double strtold(const char *s, char **p)
6 {
7         FILE f = {
8                 .buf = (void *)s, .rpos = (void *)s,
9                 .rend = (void *)-1, .lock = -1
10         };
11         off_t cnt;
12         long double y = __floatscan(&f, -1, 2, 1, &cnt);
13         if (p) *p = (char *)s + cnt;
14         return y;
15 }