summaryrefslogtreecommitdiff
path: root/src/stdlib/strtod.c
diff options
context:
space:
mode:
authorJakob Kaivo <jkk@ung.org>2019-03-06 20:00:13 -0500
committerJakob Kaivo <jkk@ung.org>2019-03-06 20:00:13 -0500
commit7039de6a6731437647bf6f1c3b480766872ac077 (patch)
tree91b046242226997677af0e9ec64522e8a80caf68 /src/stdlib/strtod.c
parent813c3440d19d8bbbe8987013d9d7160454327faf (diff)
begin work on a common string-to-floating-point implementation
Diffstat (limited to 'src/stdlib/strtod.c')
-rw-r--r--src/stdlib/strtod.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/stdlib/strtod.c b/src/stdlib/strtod.c
index 4420b02e..ba6c9636 100644
--- a/src/stdlib/strtod.c
+++ b/src/stdlib/strtod.c
@@ -1,18 +1,23 @@
#include <stdlib.h>
+#include "ctype.h"
#include "errno.h"
+#include "float.h"
+#include "math.h"
/** convert string to floating-point **/
double strtod(const char * restrict nptr, char ** restrict endptr)
{
- (void)nptr; (void)endptr;
- /* TODO */
+ double ret = 0.0;
+ double max = DBL_MAX;
+ double min = DBL_MIN;
+ double inf = INFINITY;
+ double nan = NAN;
+ double huge = HUGE_VAL;
- if (0) {
- errno = ERANGE; /* converted value out of range */
- }
+ #include "_strtod.h"
- return 0.0;
+ return ret;
}
/***