summaryrefslogtreecommitdiff
path: root/src/stdlib/strtold.c
blob: 40ecc122abdcfb3389df3fac7d0255efb636e0fb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include <stdlib.h>
#include "floatscan.h"
#include "stdio_impl.h"

long double strtold(const char *s, char **p)
{
	FILE f = {
		.buf = (void *)s, .rpos = (void *)s,
		.rend = (void *)-1, .lock = -1
	};
	off_t cnt;
	long double y = __floatscan(&f, -1, 2, 1, &cnt);
	if (p) *p = (char *)s + cnt;
	return y;
}