xref: /third_party/musl/libc-test/src/math/gen/prev.c
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /third_party/musl/libc-test/src/math/gen/
1570af302Sopenharmony_ci#include <stdio.h>
2570af302Sopenharmony_ci#include <stdlib.h>
3570af302Sopenharmony_ci#include <errno.h>
4570af302Sopenharmony_ci#include <math.h>
5570af302Sopenharmony_ci
6570af302Sopenharmony_ciint main(int argc, char *argv[])
7570af302Sopenharmony_ci{
8570af302Sopenharmony_ci	int i;
9570af302Sopenharmony_ci	float f;
10570af302Sopenharmony_ci	double d;
11570af302Sopenharmony_ci	long double ld;
12570af302Sopenharmony_ci	char *eptr;
13570af302Sopenharmony_ci
14570af302Sopenharmony_ci	for (i = 1; i < argc; i++) {
15570af302Sopenharmony_ci		errno = 0;
16570af302Sopenharmony_ci		f = strtof(argv[i], &eptr);
17570af302Sopenharmony_ci		f = nextafterf(f, -INFINITY);
18570af302Sopenharmony_ci		printf("%a  (*eptr:%d errno:%d)\n", f, *eptr, errno);
19570af302Sopenharmony_ci		errno = 0;
20570af302Sopenharmony_ci		d = strtod(argv[i], &eptr);
21570af302Sopenharmony_ci		d = nextafter(d, -INFINITY);
22570af302Sopenharmony_ci		printf("%a  (*eptr:%d errno:%d)\n", d, *eptr, errno);
23570af302Sopenharmony_ci		errno = 0;
24570af302Sopenharmony_ci		ld = strtold(argv[i], &eptr);
25570af302Sopenharmony_ci		ld = nextafterl(ld, -INFINITY);
26570af302Sopenharmony_ci		printf("%La  (*eptr:%d errno:%d)\n", ld, *eptr, errno);
27570af302Sopenharmony_ci	}
28570af302Sopenharmony_ci	return 0;
29570af302Sopenharmony_ci}
30

Indexes created Thu Nov 07 10:32:03 CST 2024