summaryrefslogtreecommitdiff
path: root/src/math/nan.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/math/nan.c')
-rw-r--r--src/math/nan.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/math/nan.c b/src/math/nan.c
index bd0cbbc4..c0874e5f 100644
--- a/src/math/nan.c
+++ b/src/math/nan.c
@@ -1,11 +1,22 @@
# define TGSOURCE "nan.c"
#include "_tgmath.h"
#include <math.h>
+#include "string.h"
+#include "stdlib.h"
+
+#define strtodf strtof
+#define strtodl strtold
TYPE TGFN(nan)(const char *tagp)
{
- (void)tagp;
- return 0.0;
+ if (tagp) {
+ char ncharseq[strlen(tagp) + 6];
+ strcpy(ncharseq, "NAN(");
+ strcat(ncharseq, tagp);
+ strcat(ncharseq, ")");
+ return TGFN(strtod)(ncharseq, (char**)NULL);
+ }
+ return TGFN(strtod)("NAN", (char**)NULL);
}
/*