source: asp3_tinet_ecnl_rx/trunk/musl-1.1.18/src/stdlib/strtod.c@ 337

Last change on this file since 337 was 337, checked in by coas-nagasima, 6 years ago

ASP3版ECNLを追加

  • Property svn:eol-style set to native
  • Property svn:mime-type set to text/x-csrc;charset=UTF-8
File size: 857 bytes
Line 
1#include <stdlib.h>
2#include "shgetc.h"
3#include "floatscan.h"
4#include "stdio_impl.h"
5#include "libc.h"
6
7static long double strtox(const char *s, char **p, int prec)
8{
9 FILE f = {
10 .buf = (void *)s, .rpos = (void *)s,
11 .rend = (void *)-1, .lock = -1
12 };
13 shlim(&f, 0);
14 long double y = __floatscan(&f, prec, 1);
15 off_t cnt = shcnt(&f);
16 if (p) *p = cnt ? (char *)s + cnt : (char *)s;
17 return y;
18}
19
20float strtof(const char *restrict s, char **restrict p)
21{
22 return strtox(s, p, 0);
23}
24
25double strtod(const char *restrict s, char **restrict p)
26{
27 return strtox(s, p, 1);
28}
29
30long double strtold(const char *restrict s, char **restrict p)
31{
32 return strtox(s, p, 2);
33}
34
35weak_alias(strtof, strtof_l);
36weak_alias(strtod, strtod_l);
37weak_alias(strtold, strtold_l);
38weak_alias(strtof, __strtof_l);
39weak_alias(strtod, __strtod_l);
40weak_alias(strtold, __strtold_l);
Note: See TracBrowser for help on using the repository browser.