Commit ab1bdfa5 authored by Bruno Haible's avatar Bruno Haible

Avoid compilation errors with MSVC option -fp:strict.

* lib/floor.c: Use MSVC specific pragma fenv_access.
* lib/ceil.c: Likewise.
* lib/trunc.c: Likewise.
* lib/round.c: Likewise.
* lib/rint.c: Likewise.
* lib/fma.c: Likewise.
* lib/integer_length.c: Likewise.
* m4/round.m4 (gl_FUNC_ROUND): Likewise.
* m4/roundf.m4 (gl_FUNC_ROUNDF): Likewise.
* tests/test-floor2.c: Likewise.
* tests/test-floorf2.c: Likewise.
* tests/test-ceil2.c: Likewise.
* tests/test-ceilf2.c: Likewise.
* tests/test-trunc2.c: Likewise.
* tests/test-truncf2.c: Likewise.
Reported by Michael Goffioul <michael.goffioul@gmail.com>.
parent a21247c3
2012-02-28 Bruno Haible <bruno@clisp.org>
Avoid compilation errors with MSVC option -fp:strict.
* lib/floor.c: Use MSVC specific pragma fenv_access.
* lib/ceil.c: Likewise.
* lib/trunc.c: Likewise.
* lib/round.c: Likewise.
* lib/rint.c: Likewise.
* lib/fma.c: Likewise.
* lib/integer_length.c: Likewise.
* m4/round.m4 (gl_FUNC_ROUND): Likewise.
* m4/roundf.m4 (gl_FUNC_ROUNDF): Likewise.
* tests/test-floor2.c: Likewise.
* tests/test-floorf2.c: Likewise.
* tests/test-ceil2.c: Likewise.
* tests/test-ceilf2.c: Likewise.
* tests/test-trunc2.c: Likewise.
* tests/test-truncf2.c: Likewise.
Reported by Michael Goffioul <michael.goffioul@gmail.com>.
2012-02-27 Bruno Haible <bruno@clisp.org>
Tests for module 'sqrtl-ieee'.
......@@ -54,6 +54,12 @@
# define MINUS_ZERO L_(-0.0)
#endif
/* 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
/* 2^(MANT_DIG-1). */
static const DOUBLE TWO_MANT_DIG =
/* Assume MANT_DIG <= 5 * 31.
......
......@@ -42,6 +42,12 @@
# define L_(literal) literal##f
#endif
/* 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
/* 2^(MANT_DIG-1). */
static const DOUBLE TWO_MANT_DIG =
/* Assume MANT_DIG <= 5 * 31.
......
......@@ -66,6 +66,12 @@
#undef MIN
#define MIN(a,b) ((a) < (b) ? (a) : (b))
/* 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
/* It is possible to write an implementation of fused multiply-add with
floating-point operations alone. See
Sylvie Boldo, Guillaume Melquiond:
......
......@@ -25,6 +25,12 @@
#include "float+.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
#define NBITS (sizeof (unsigned int) * CHAR_BIT)
int
......
......@@ -53,6 +53,12 @@
# define MINUS_ZERO L_(-0.0)
#endif
/* 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
DOUBLE
RINT (DOUBLE x)
{
......
......@@ -64,6 +64,12 @@
# define MINUS_ZERO L_(-0.0)
#endif
/* 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
/* If we're being included from test-round2[f].c, it already defined names for
our round implementations. Otherwise, pick the preferred implementation for
this machine. */
......
......@@ -54,6 +54,12 @@
# define MINUS_ZERO L_(-0.0)
#endif
/* 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
/* 2^(MANT_DIG-1). */
static const DOUBLE TWO_MANT_DIG =
/* Assume MANT_DIG <= 5 * 31.
......
# round.m4 serial 13
# round.m4 serial 14
dnl Copyright (C) 2007, 2009-2012 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
......@@ -25,6 +25,9 @@ AC_DEFUN([gl_FUNC_ROUND],
AC_RUN_IFELSE([AC_LANG_SOURCE([[
#include <float.h>
#include <math.h>
#ifdef _MSC_VER
# pragma fenv_access (off)
#endif
int main()
{
/* 2^DBL_MANT_DIG. */
......
# roundf.m4 serial 14
# roundf.m4 serial 15
dnl Copyright (C) 2007-2012 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
......@@ -25,6 +25,9 @@ AC_DEFUN([gl_FUNC_ROUNDF],
AC_RUN_IFELSE([AC_LANG_SOURCE([[
#include <float.h>
#include <math.h>
#ifdef _MSC_VER
# pragma fenv_access (off)
#endif
int main()
{
/* 2^FLT_MANT_DIG. */
......
......@@ -32,6 +32,12 @@
#include "minus-zero.h"
#include "macros.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
/* The reference implementation, taken from lib/ceil.c. */
......
......@@ -32,6 +32,12 @@
#include "minus-zero.h"
#include "macros.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
/* The reference implementation, taken from lib/ceil.c. */
......
......@@ -31,6 +31,12 @@
#include "isnand-nolibm.h"
#include "macros.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
/* The reference implementation, taken from lib/floor.c. */
......
......@@ -31,6 +31,12 @@
#include "isnanf-nolibm.h"
#include "macros.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
/* The reference implementation, taken from lib/floor.c. */
......
......@@ -32,6 +32,12 @@
#include "minus-zero.h"
#include "macros.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
/* The reference implementation, taken from lib/trunc.c. */
......
......@@ -32,6 +32,12 @@
#include "minus-zero.h"
#include "macros.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
/* The reference implementation, taken from lib/trunc.c. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment