summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2015-01-26 19:03:38 -0600
committerGregory Nutt <gnutt@nuttx.org>2015-01-26 19:03:38 -0600
commit5066ce663316b83889afba55a5c81ae91f6a3500 (patch)
tree74284e231e34dc7271484d92dc929dd089b49335
parent6461f948f2f57e6d434c33ace44ea25e70d4c3fb (diff)
downloadnuttx-5066ce663316b83889afba55a5c81ae91f6a3500.tar.gz
nuttx-5066ce663316b83889afba55a5c81ae91f6a3500.tar.bz2
nuttx-5066ce663316b83889afba55a5c81ae91f6a3500.zip
Add math library defines for nan functions. From Brennan Ashton.
-rw-r--r--apps/interpreters/micropython/micropython_main.c6
-rw-r--r--nuttx/include/nuttx/math.h8
2 files changed, 8 insertions, 6 deletions
diff --git a/apps/interpreters/micropython/micropython_main.c b/apps/interpreters/micropython/micropython_main.c
index 0d68e815b..f16c954e7 100644
--- a/apps/interpreters/micropython/micropython_main.c
+++ b/apps/interpreters/micropython/micropython_main.c
@@ -143,12 +143,6 @@ void do_str(FAR const char *src)
* Public Functions
****************************************************************************/
-float nanf(FAR const char *tagp)
-{
- (void)tagp;
- return 0;
-}
-
/****************************************************************************
* mp_import_stat
****************************************************************************/
diff --git a/nuttx/include/nuttx/math.h b/nuttx/include/nuttx/math.h
index 89223531e..40990352a 100644
--- a/nuttx/include/nuttx/math.h
+++ b/nuttx/include/nuttx/math.h
@@ -385,6 +385,14 @@ double trunc (double x);
long double truncl (long double x);
#endif
+#define nanf(x) ((float)(NAN))
+#ifdef CONFIG_HAVE_DOUBLE
+#define nan(x) ((double)(NAN))
+#endif
+#ifdef CONFIG_HAVE_LONG_DOUBLE
+#define nanl(x) ((long double)(NAN))
+#endif
+
#if defined(__cplusplus)
}
#endif