1570af302Sopenharmony_ci#include <stdio.h>
2570af302Sopenharmony_ci#include <stdlib.h>
3570af302Sopenharmony_ci#include <stdint.h>
4570af302Sopenharmony_ci#include <errno.h>
5570af302Sopenharmony_ci
6570af302Sopenharmony_ciint main(int argc, char *argv[])
7570af302Sopenharmony_ci{
8570af302Sopenharmony_ci	int i;
9570af302Sopenharmony_ci	union {float f; uint32_t i;} f;
10570af302Sopenharmony_ci	union {double f; uint64_t i;} d;
11570af302Sopenharmony_ci	union {long double f; struct {uint64_t m; uint16_t se;} i;} ld;
12570af302Sopenharmony_ci	char *eptr;
13570af302Sopenharmony_ci
14570af302Sopenharmony_ci	for (i = 1; i < argc; i++) {
15570af302Sopenharmony_ci		errno = 0;
16570af302Sopenharmony_ci		f.f = strtof(argv[i], &eptr);
17570af302Sopenharmony_ci		printf("0x%08x  (*eptr:%d errno:%d)\n", f.i, *eptr, errno);
18570af302Sopenharmony_ci		errno = 0;
19570af302Sopenharmony_ci		d.f = strtod(argv[i], &eptr);
20570af302Sopenharmony_ci		printf("0x%08x %08x  (*eptr:%d errno:%d)\n",
21570af302Sopenharmony_ci			(unsigned)(d.i>>32), (unsigned)d.i, *eptr, errno);
22570af302Sopenharmony_ci		errno = 0;
23570af302Sopenharmony_ci		ld.f = strtold(argv[i], &eptr);
24570af302Sopenharmony_ci		printf("0x%04x %08x %08x  (*eptr:%d errno:%d)\n",
25570af302Sopenharmony_ci			ld.i.se, (unsigned)(ld.i.m>>32), (unsigned)ld.i.m, *eptr, errno);
26570af302Sopenharmony_ci	}
27570af302Sopenharmony_ci	return 0;
28570af302Sopenharmony_ci}
29