[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: MSVC fails to compile floor.c with -fp:strict
From: |
Bruno Haible |
Subject: |
Re: MSVC fails to compile floor.c with -fp:strict |
Date: |
Tue, 13 Mar 2012 23:59:10 +0100 |
User-agent: |
KMail/4.7.4 (Linux/3.1.0-1.2-desktop; KDE/4.7.4; x86_64; ; ) |
Michael Goffioul wrote:
> Same problem occurs in cbrt.c and cbrtf.c.
Fixed. No other occurrences of this problem found so far.
2012-03-13 Bruno Haible <address@hidden>
Avoid compilation errors with MSVC option -fp:strict.
* lib/cbrt.c: Use MSVC specific pragma fenv_access.
* lib/cbrtf.c: Likewise.
Reported by Michael Goffioul <address@hidden>.
--- lib/cbrt.c.orig Tue Mar 13 23:55:56 2012
+++ lib/cbrt.c Tue Mar 13 23:55:34 2012
@@ -22,6 +22,12 @@
/* Specification. */
#include <math.h>
+/* MSVC with option -fp:strict refuses to compile constant initializers that
+ contain floating-point operations. Pacify this compiler. */
+#ifdef _MSC_VER
+# pragma fenv_access (off)
+#endif
+
/* Code based on glibc/sysdeps/ieee754/dbl-64/s_cbrt.c. */
#define CBRT2 1.2599210498948731648 /* 2^(1/3) */
--- lib/cbrtf.c.orig Tue Mar 13 23:55:56 2012
+++ lib/cbrtf.c Tue Mar 13 23:55:35 2012
@@ -22,6 +22,12 @@
/* Specification. */
#include <math.h>
+/* MSVC with option -fp:strict refuses to compile constant initializers that
+ contain floating-point operations. Pacify this compiler. */
+#ifdef _MSC_VER
+# pragma fenv_access (off)
+#endif
+
/* Code based on glibc/sysdeps/ieee754/flt-32/s_cbrtf.c. */
#define CBRT2 1.2599210498948731648 /* 2^(1/3) */