summaryrefslogtreecommitdiffstats
path: root/winsup/mingw/include/math.h
diff options
context:
space:
mode:
authorDanny Smith <dannysmith@users.sourceforge.net>2006-06-12 22:22:18 +0000
committerDanny Smith <dannysmith@users.sourceforge.net>2006-06-12 22:22:18 +0000
commita4c5a5dc71f7f545137dd26565484d573ac7d2ba (patch)
tree8ddbe1ed889baf71f4946dd6bd90c8e2041652b2 /winsup/mingw/include/math.h
parenta91cc828ccea75e24b254d1214f1f61b0cc8bdfa (diff)
downloadcygnal-a4c5a5dc71f7f545137dd26565484d573ac7d2ba.tar.gz
cygnal-a4c5a5dc71f7f545137dd26565484d573ac7d2ba.tar.bz2
cygnal-a4c5a5dc71f7f545137dd26565484d573ac7d2ba.zip
* include/math.h (HUGE_VAL): Define as builtin if __GNUC__ >= 3.3,
else global library variable. (HUGEVALF): Likewise; (HUGEVALL): Likewise. (INFINITY): Likewise. (NAN): LiKewise.
Diffstat (limited to 'winsup/mingw/include/math.h')
-rw-r--r--winsup/mingw/include/math.h22
1 files changed, 19 insertions, 3 deletions
diff --git a/winsup/mingw/include/math.h b/winsup/mingw/include/math.h
index 1bd9b16c3..0da7869ba 100644
--- a/winsup/mingw/include/math.h
+++ b/winsup/mingw/include/math.h
@@ -101,6 +101,10 @@ extern "C" {
* NOTE: The CRTDLL version uses _HUGE_dll instead.
*/
+#if __MINGW_GNUC_PREREQ(3, 3)
+#define HUGE_VAL __builtin_huge_val()
+#else
+
#ifndef __DECLSPEC_SUPPORTED
#ifdef __MSVCRT__
@@ -124,6 +128,8 @@ __MINGW_IMPORT double _HUGE_dll;
#endif
#endif /* __DECLSPEC_SUPPORTED */
+#endif /* __MINGW_GNUC_PREREQ(3, 3) */
+
struct _exception
{
@@ -283,10 +289,20 @@ _CRTIMP int __cdecl _set_SSE2_enable (int);
#if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) \
|| !defined __STRICT_ANSI__ || defined __cplusplus
-#define HUGE_VALF 0x1.0p255f
-#define HUGE_VALL 0x1.0p32767L
+#if __MINGW_GNUC_PREREQ(3, 3)
+#define HUGE_VALF __builtin_huge_valf()
+#define HUGE_VALL __builtin_huge_vall()
+#define INFINITY __builtin_inf()
+#define NAN __builtin_nan("")
+#else
+#extern const float __INFF;
+#define HUGE_VALF __INFF
+#extern const long double __INFL;
+#define HUGE_VALL __INFL
#define INFINITY HUGE_VALF
-#define NAN (HUGE_VALF - HUGE_VALF)
+extern const double __QNAN;
+#define NAN __QNAN
+#endif /* __MINGW_GNUC_PREREQ(3, 3) */
/* 7.12.3.1 */
/*