math: regenerate all math tests
[libc-test] / src / math / gen / tof.c
diff --git a/src/math/gen/tof.c b/src/math/gen/tof.c
new file mode 100644 (file)
index 0000000..eeec5aa
--- /dev/null
@@ -0,0 +1,25 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+
+int main(int argc, char *argv[])
+{
+       int i;
+       float f;
+       double d;
+       long double ld;
+       char *eptr;
+
+       for (i = 1; i < argc; i++) {
+               errno = 0;
+               f = strtof(argv[i], &eptr);
+               printf("%.42f  (*eptr:%d errno:%d)\n", f, *eptr, errno);
+               errno = 0;
+               d = strtod(argv[i], &eptr);
+               printf("%.42f  (*eptr:%d errno:%d)\n", d, *eptr, errno);
+               errno = 0;
+               ld = strtold(argv[i], &eptr);
+               printf("%.42Lf  (*eptr:%d errno:%d)\n", ld, *eptr, errno);
+       }
+       return 0;
+}