annotate m4/frexp.m4 @ 15857:6b8400199763

New module 'sqrtf'. * lib/math.in.h (sqrtf): New declaration. * lib/sqrtf.c: New file. * m4/sqrtf.m4: New file. * m4/math_h.m4 (gl_MATH_H): Test whether sqrtf is declared. (gl_MATH_H_DEFAULTS): Initialize GNULIB_SQRTF, HAVE_SQRTF. * modules/math (Makefile.am): Substitute GNULIB_SQRTF, HAVE_SQRTF. * modules/sqrtf: New file. * tests/test-math-c++.cc: Check the declaration of sqrtf. * doc/posix-functions/sqrtf.texi: Mention the new module.
author Bruno Haible <bruno@clisp.org>
date Sat, 08 Oct 2011 21:16:48 +0200
parents 328819af1c02
children 916745fe55a6
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
15595
328819af1c02 Support for MSVC compiler: Avoid division by a literal 0.
Bruno Haible <bruno@clisp.org>
parents: 15356
diff changeset
1 # frexp.m4 serial 12
14079
97fc9a21a8fb maint: update almost all copyright ranges to include 2011
Jim Meyering <meyering@redhat.com>
parents: 13918
diff changeset
2 dnl Copyright (C) 2007-2011 Free Software Foundation, Inc.
8491
af98e0b44387 New module 'frexp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3 dnl This file is free software; the Free Software Foundation
af98e0b44387 New module 'frexp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
4 dnl gives unlimited permission to copy and/or distribute it,
af98e0b44387 New module 'frexp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
5 dnl with or without modifications, as long as this notice is preserved.
af98e0b44387 New module 'frexp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6
af98e0b44387 New module 'frexp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
7 AC_DEFUN([gl_FUNC_FREXP],
af98e0b44387 New module 'frexp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
8 [
af98e0b44387 New module 'frexp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
9 AC_REQUIRE([gl_MATH_H_DEFAULTS])
13460
54037f4be4a4 Unify tests that set gl_cv_func_frexp_no_libm.
Bruno Haible <bruno@clisp.org>
parents: 12559
diff changeset
10 AC_REQUIRE([gl_CHECK_FREXP_NO_LIBM])
8491
af98e0b44387 New module 'frexp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
11 FREXP_LIBM=
af98e0b44387 New module 'frexp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
12 if test $gl_cv_func_frexp_no_libm = no; then
af98e0b44387 New module 'frexp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
13 AC_CACHE_CHECK([whether frexp() can be used with libm],
af98e0b44387 New module 'frexp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
14 [gl_cv_func_frexp_in_libm],
af98e0b44387 New module 'frexp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
15 [
af98e0b44387 New module 'frexp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
16 save_LIBS="$LIBS"
af98e0b44387 New module 'frexp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
17 LIBS="$LIBS -lm"
13578
1e26f884665f Modernize AC_TRY_LINK invocations.
Bruno Haible <bruno@clisp.org>
parents: 13460
diff changeset
18 AC_LINK_IFELSE(
1e26f884665f Modernize AC_TRY_LINK invocations.
Bruno Haible <bruno@clisp.org>
parents: 13460
diff changeset
19 [AC_LANG_PROGRAM(
1e26f884665f Modernize AC_TRY_LINK invocations.
Bruno Haible <bruno@clisp.org>
parents: 13460
diff changeset
20 [[#include <math.h>
1e26f884665f Modernize AC_TRY_LINK invocations.
Bruno Haible <bruno@clisp.org>
parents: 13460
diff changeset
21 double x;]],
1e26f884665f Modernize AC_TRY_LINK invocations.
Bruno Haible <bruno@clisp.org>
parents: 13460
diff changeset
22 [[int e; return frexp (x, &e) > 0;]])],
8491
af98e0b44387 New module 'frexp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
23 [gl_cv_func_frexp_in_libm=yes],
af98e0b44387 New module 'frexp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
24 [gl_cv_func_frexp_in_libm=no])
af98e0b44387 New module 'frexp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
25 LIBS="$save_LIBS"
af98e0b44387 New module 'frexp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
26 ])
af98e0b44387 New module 'frexp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
27 if test $gl_cv_func_frexp_in_libm = yes; then
af98e0b44387 New module 'frexp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
28 FREXP_LIBM=-lm
af98e0b44387 New module 'frexp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
29 fi
af98e0b44387 New module 'frexp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
30 fi
af98e0b44387 New module 'frexp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
31 if test $gl_cv_func_frexp_no_libm = yes \
af98e0b44387 New module 'frexp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
32 || test $gl_cv_func_frexp_in_libm = yes; then
af98e0b44387 New module 'frexp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
33 save_LIBS="$LIBS"
af98e0b44387 New module 'frexp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
34 LIBS="$LIBS $FREXP_LIBM"
af98e0b44387 New module 'frexp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
35 gl_FUNC_FREXP_WORKS
af98e0b44387 New module 'frexp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
36 LIBS="$save_LIBS"
af98e0b44387 New module 'frexp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
37 case "$gl_cv_func_frexp_works" in
af98e0b44387 New module 'frexp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
38 *yes) gl_func_frexp=yes ;;
af98e0b44387 New module 'frexp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
39 *) gl_func_frexp=no; REPLACE_FREXP=1; FREXP_LIBM= ;;
af98e0b44387 New module 'frexp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
40 esac
af98e0b44387 New module 'frexp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
41 else
af98e0b44387 New module 'frexp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
42 gl_func_frexp=no
af98e0b44387 New module 'frexp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
43 fi
af98e0b44387 New module 'frexp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
44 if test $gl_func_frexp = yes; then
11007
f6cba5a556ce many *.m4 files: improve m4 quoting
Jim Meyering <meyering@redhat.com>
parents: 10418
diff changeset
45 AC_DEFINE([HAVE_FREXP], [1],
8491
af98e0b44387 New module 'frexp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
46 [Define if the frexp() function is available and works.])
af98e0b44387 New module 'frexp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
47 fi
8627
fd0df3b4a14d Clarify the dependencies on libm.
Bruno Haible <bruno@clisp.org>
parents: 8546
diff changeset
48 AC_SUBST([FREXP_LIBM])
8491
af98e0b44387 New module 'frexp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
49 ])
af98e0b44387 New module 'frexp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
50
9440
176074d93ed1 New module 'frexp-nolibm'.
Bruno Haible <bruno@clisp.org>
parents: 8845
diff changeset
51 AC_DEFUN([gl_FUNC_FREXP_NO_LIBM],
176074d93ed1 New module 'frexp-nolibm'.
Bruno Haible <bruno@clisp.org>
parents: 8845
diff changeset
52 [
176074d93ed1 New module 'frexp-nolibm'.
Bruno Haible <bruno@clisp.org>
parents: 8845
diff changeset
53 AC_REQUIRE([gl_MATH_H_DEFAULTS])
13460
54037f4be4a4 Unify tests that set gl_cv_func_frexp_no_libm.
Bruno Haible <bruno@clisp.org>
parents: 12559
diff changeset
54 AC_REQUIRE([gl_CHECK_FREXP_NO_LIBM])
9440
176074d93ed1 New module 'frexp-nolibm'.
Bruno Haible <bruno@clisp.org>
parents: 8845
diff changeset
55 if test $gl_cv_func_frexp_no_libm = yes; then
176074d93ed1 New module 'frexp-nolibm'.
Bruno Haible <bruno@clisp.org>
parents: 8845
diff changeset
56 gl_FUNC_FREXP_WORKS
176074d93ed1 New module 'frexp-nolibm'.
Bruno Haible <bruno@clisp.org>
parents: 8845
diff changeset
57 case "$gl_cv_func_frexp_works" in
176074d93ed1 New module 'frexp-nolibm'.
Bruno Haible <bruno@clisp.org>
parents: 8845
diff changeset
58 *yes) gl_func_frexp_no_libm=yes ;;
176074d93ed1 New module 'frexp-nolibm'.
Bruno Haible <bruno@clisp.org>
parents: 8845
diff changeset
59 *) gl_func_frexp_no_libm=no; REPLACE_FREXP=1 ;;
176074d93ed1 New module 'frexp-nolibm'.
Bruno Haible <bruno@clisp.org>
parents: 8845
diff changeset
60 esac
176074d93ed1 New module 'frexp-nolibm'.
Bruno Haible <bruno@clisp.org>
parents: 8845
diff changeset
61 else
176074d93ed1 New module 'frexp-nolibm'.
Bruno Haible <bruno@clisp.org>
parents: 8845
diff changeset
62 gl_func_frexp_no_libm=no
176074d93ed1 New module 'frexp-nolibm'.
Bruno Haible <bruno@clisp.org>
parents: 8845
diff changeset
63 dnl Set REPLACE_FREXP here because the system may have frexp in libm.
176074d93ed1 New module 'frexp-nolibm'.
Bruno Haible <bruno@clisp.org>
parents: 8845
diff changeset
64 REPLACE_FREXP=1
176074d93ed1 New module 'frexp-nolibm'.
Bruno Haible <bruno@clisp.org>
parents: 8845
diff changeset
65 fi
176074d93ed1 New module 'frexp-nolibm'.
Bruno Haible <bruno@clisp.org>
parents: 8845
diff changeset
66 if test $gl_func_frexp_no_libm = yes; then
11007
f6cba5a556ce many *.m4 files: improve m4 quoting
Jim Meyering <meyering@redhat.com>
parents: 10418
diff changeset
67 AC_DEFINE([HAVE_FREXP_IN_LIBC], [1],
9440
176074d93ed1 New module 'frexp-nolibm'.
Bruno Haible <bruno@clisp.org>
parents: 8845
diff changeset
68 [Define if the frexp() function is available in libc.])
176074d93ed1 New module 'frexp-nolibm'.
Bruno Haible <bruno@clisp.org>
parents: 8845
diff changeset
69 fi
176074d93ed1 New module 'frexp-nolibm'.
Bruno Haible <bruno@clisp.org>
parents: 8845
diff changeset
70 ])
176074d93ed1 New module 'frexp-nolibm'.
Bruno Haible <bruno@clisp.org>
parents: 8845
diff changeset
71
13460
54037f4be4a4 Unify tests that set gl_cv_func_frexp_no_libm.
Bruno Haible <bruno@clisp.org>
parents: 12559
diff changeset
72 dnl Test whether frexp() can be used without linking with libm.
54037f4be4a4 Unify tests that set gl_cv_func_frexp_no_libm.
Bruno Haible <bruno@clisp.org>
parents: 12559
diff changeset
73 dnl Set gl_cv_func_frexp_no_libm to 'yes' or 'no' accordingly.
54037f4be4a4 Unify tests that set gl_cv_func_frexp_no_libm.
Bruno Haible <bruno@clisp.org>
parents: 12559
diff changeset
74 AC_DEFUN([gl_CHECK_FREXP_NO_LIBM],
54037f4be4a4 Unify tests that set gl_cv_func_frexp_no_libm.
Bruno Haible <bruno@clisp.org>
parents: 12559
diff changeset
75 [
54037f4be4a4 Unify tests that set gl_cv_func_frexp_no_libm.
Bruno Haible <bruno@clisp.org>
parents: 12559
diff changeset
76 AC_CACHE_CHECK([whether frexp() can be used without linking with libm],
54037f4be4a4 Unify tests that set gl_cv_func_frexp_no_libm.
Bruno Haible <bruno@clisp.org>
parents: 12559
diff changeset
77 [gl_cv_func_frexp_no_libm],
54037f4be4a4 Unify tests that set gl_cv_func_frexp_no_libm.
Bruno Haible <bruno@clisp.org>
parents: 12559
diff changeset
78 [
13578
1e26f884665f Modernize AC_TRY_LINK invocations.
Bruno Haible <bruno@clisp.org>
parents: 13460
diff changeset
79 AC_LINK_IFELSE(
1e26f884665f Modernize AC_TRY_LINK invocations.
Bruno Haible <bruno@clisp.org>
parents: 13460
diff changeset
80 [AC_LANG_PROGRAM(
1e26f884665f Modernize AC_TRY_LINK invocations.
Bruno Haible <bruno@clisp.org>
parents: 13460
diff changeset
81 [[#include <math.h>
1e26f884665f Modernize AC_TRY_LINK invocations.
Bruno Haible <bruno@clisp.org>
parents: 13460
diff changeset
82 double x;]],
1e26f884665f Modernize AC_TRY_LINK invocations.
Bruno Haible <bruno@clisp.org>
parents: 13460
diff changeset
83 [[int e; return frexp (x, &e) > 0;]])],
13460
54037f4be4a4 Unify tests that set gl_cv_func_frexp_no_libm.
Bruno Haible <bruno@clisp.org>
parents: 12559
diff changeset
84 [gl_cv_func_frexp_no_libm=yes],
54037f4be4a4 Unify tests that set gl_cv_func_frexp_no_libm.
Bruno Haible <bruno@clisp.org>
parents: 12559
diff changeset
85 [gl_cv_func_frexp_no_libm=no])
54037f4be4a4 Unify tests that set gl_cv_func_frexp_no_libm.
Bruno Haible <bruno@clisp.org>
parents: 12559
diff changeset
86 ])
54037f4be4a4 Unify tests that set gl_cv_func_frexp_no_libm.
Bruno Haible <bruno@clisp.org>
parents: 12559
diff changeset
87 ])
54037f4be4a4 Unify tests that set gl_cv_func_frexp_no_libm.
Bruno Haible <bruno@clisp.org>
parents: 12559
diff changeset
88
8546
d03503ff8d69 Check against a bug of frexp() on IRIX 6.5.
Bruno Haible <bruno@clisp.org>
parents: 8493
diff changeset
89 dnl Test whether frexp() works also on denormalized numbers (this fails e.g. on
10418
1e251b3d489c frexp: test for NetBSD failure on -0.0
Eric Blake <ebb9@byu.net>
parents: 9508
diff changeset
90 dnl NetBSD 3.0), on infinite numbers (this fails e.g. on IRIX 6.5 and mingw),
15356
13f119e60592 Comments.
Bruno Haible <bruno@clisp.org>
parents: 14997
diff changeset
91 dnl and on negative zero (this fails e.g. on NetBSD 4.99 and mingw).
8491
af98e0b44387 New module 'frexp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
92 AC_DEFUN([gl_FUNC_FREXP_WORKS],
af98e0b44387 New module 'frexp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
93 [
af98e0b44387 New module 'frexp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
94 AC_REQUIRE([AC_PROG_CC])
af98e0b44387 New module 'frexp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
95 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
af98e0b44387 New module 'frexp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
96 AC_CACHE_CHECK([whether frexp works], [gl_cv_func_frexp_works],
af98e0b44387 New module 'frexp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
97 [
13579
da9779900713 Modernize AC_TRY_RUN invocations.
Bruno Haible <bruno@clisp.org>
parents: 13578
diff changeset
98 AC_RUN_IFELSE(
da9779900713 Modernize AC_TRY_RUN invocations.
Bruno Haible <bruno@clisp.org>
parents: 13578
diff changeset
99 [AC_LANG_SOURCE([[
8491
af98e0b44387 New module 'frexp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
100 #include <float.h>
af98e0b44387 New module 'frexp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
101 #include <math.h>
10418
1e251b3d489c frexp: test for NetBSD failure on -0.0
Eric Blake <ebb9@byu.net>
parents: 9508
diff changeset
102 #include <string.h>
13834
108bbfd6f03b frexp, tests: work around ICC bug with -zero
Eric Blake <eblake@redhat.com>
parents: 13579
diff changeset
103 /* HP cc on HP-UX 10.20 has a bug with the constant expression -0.0.
108bbfd6f03b frexp, tests: work around ICC bug with -zero
Eric Blake <eblake@redhat.com>
parents: 13579
diff changeset
104 ICC 10.0 has a bug when optimizing the expression -zero.
108bbfd6f03b frexp, tests: work around ICC bug with -zero
Eric Blake <eblake@redhat.com>
parents: 13579
diff changeset
105 The expression -DBL_MIN * DBL_MIN does not work when cross-compiling
108bbfd6f03b frexp, tests: work around ICC bug with -zero
Eric Blake <eblake@redhat.com>
parents: 13579
diff changeset
106 to PowerPC on MacOS X 10.5. */
108bbfd6f03b frexp, tests: work around ICC bug with -zero
Eric Blake <eblake@redhat.com>
parents: 13579
diff changeset
107 #if defined __hpux || defined __sgi || defined __ICC
108bbfd6f03b frexp, tests: work around ICC bug with -zero
Eric Blake <eblake@redhat.com>
parents: 13579
diff changeset
108 static double
108bbfd6f03b frexp, tests: work around ICC bug with -zero
Eric Blake <eblake@redhat.com>
parents: 13579
diff changeset
109 compute_minus_zero (void)
108bbfd6f03b frexp, tests: work around ICC bug with -zero
Eric Blake <eblake@redhat.com>
parents: 13579
diff changeset
110 {
108bbfd6f03b frexp, tests: work around ICC bug with -zero
Eric Blake <eblake@redhat.com>
parents: 13579
diff changeset
111 return -DBL_MIN * DBL_MIN;
108bbfd6f03b frexp, tests: work around ICC bug with -zero
Eric Blake <eblake@redhat.com>
parents: 13579
diff changeset
112 }
108bbfd6f03b frexp, tests: work around ICC bug with -zero
Eric Blake <eblake@redhat.com>
parents: 13579
diff changeset
113 # define minus_zero compute_minus_zero ()
108bbfd6f03b frexp, tests: work around ICC bug with -zero
Eric Blake <eblake@redhat.com>
parents: 13579
diff changeset
114 #else
108bbfd6f03b frexp, tests: work around ICC bug with -zero
Eric Blake <eblake@redhat.com>
parents: 13579
diff changeset
115 double minus_zero = -0.0;
108bbfd6f03b frexp, tests: work around ICC bug with -zero
Eric Blake <eblake@redhat.com>
parents: 13579
diff changeset
116 #endif
8491
af98e0b44387 New module 'frexp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
117 int main()
af98e0b44387 New module 'frexp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
118 {
13918
d5a74c6ec06b Put more information about failed tests into the test return codes.
Bruno Haible <bruno@clisp.org>
parents: 13834
diff changeset
119 int result = 0;
8491
af98e0b44387 New module 'frexp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
120 int i;
af98e0b44387 New module 'frexp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
121 volatile double x;
10418
1e251b3d489c frexp: test for NetBSD failure on -0.0
Eric Blake <ebb9@byu.net>
parents: 9508
diff changeset
122 double zero = 0.0;
8546
d03503ff8d69 Check against a bug of frexp() on IRIX 6.5.
Bruno Haible <bruno@clisp.org>
parents: 8493
diff changeset
123 /* Test on denormalized numbers. */
8491
af98e0b44387 New module 'frexp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
124 for (i = 1, x = 1.0; i >= DBL_MIN_EXP; i--, x *= 0.5)
af98e0b44387 New module 'frexp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
125 ;
af98e0b44387 New module 'frexp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
126 if (x > 0.0)
af98e0b44387 New module 'frexp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
127 {
af98e0b44387 New module 'frexp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
128 int exp;
af98e0b44387 New module 'frexp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
129 double y = frexp (x, &exp);
af98e0b44387 New module 'frexp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
130 /* On machines with IEEE754 arithmetic: x = 1.11254e-308, exp = -1022.
af98e0b44387 New module 'frexp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
131 On NetBSD: y = 0.75. Correct: y = 0.5. */
af98e0b44387 New module 'frexp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
132 if (y != 0.5)
13918
d5a74c6ec06b Put more information about failed tests into the test return codes.
Bruno Haible <bruno@clisp.org>
parents: 13834
diff changeset
133 result |= 1;
8491
af98e0b44387 New module 'frexp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
134 }
8546
d03503ff8d69 Check against a bug of frexp() on IRIX 6.5.
Bruno Haible <bruno@clisp.org>
parents: 8493
diff changeset
135 /* Test on infinite numbers. */
15595
328819af1c02 Support for MSVC compiler: Avoid division by a literal 0.
Bruno Haible <bruno@clisp.org>
parents: 15356
diff changeset
136 x = 1.0 / zero;
8546
d03503ff8d69 Check against a bug of frexp() on IRIX 6.5.
Bruno Haible <bruno@clisp.org>
parents: 8493
diff changeset
137 {
d03503ff8d69 Check against a bug of frexp() on IRIX 6.5.
Bruno Haible <bruno@clisp.org>
parents: 8493
diff changeset
138 int exp;
d03503ff8d69 Check against a bug of frexp() on IRIX 6.5.
Bruno Haible <bruno@clisp.org>
parents: 8493
diff changeset
139 double y = frexp (x, &exp);
d03503ff8d69 Check against a bug of frexp() on IRIX 6.5.
Bruno Haible <bruno@clisp.org>
parents: 8493
diff changeset
140 if (y != x)
13918
d5a74c6ec06b Put more information about failed tests into the test return codes.
Bruno Haible <bruno@clisp.org>
parents: 13834
diff changeset
141 result |= 2;
8546
d03503ff8d69 Check against a bug of frexp() on IRIX 6.5.
Bruno Haible <bruno@clisp.org>
parents: 8493
diff changeset
142 }
10418
1e251b3d489c frexp: test for NetBSD failure on -0.0
Eric Blake <ebb9@byu.net>
parents: 9508
diff changeset
143 /* Test on negative zero. */
13834
108bbfd6f03b frexp, tests: work around ICC bug with -zero
Eric Blake <eblake@redhat.com>
parents: 13579
diff changeset
144 x = minus_zero;
10418
1e251b3d489c frexp: test for NetBSD failure on -0.0
Eric Blake <ebb9@byu.net>
parents: 9508
diff changeset
145 {
1e251b3d489c frexp: test for NetBSD failure on -0.0
Eric Blake <ebb9@byu.net>
parents: 9508
diff changeset
146 int exp;
1e251b3d489c frexp: test for NetBSD failure on -0.0
Eric Blake <ebb9@byu.net>
parents: 9508
diff changeset
147 double y = frexp (x, &exp);
1e251b3d489c frexp: test for NetBSD failure on -0.0
Eric Blake <ebb9@byu.net>
parents: 9508
diff changeset
148 if (memcmp (&y, &x, sizeof x))
13918
d5a74c6ec06b Put more information about failed tests into the test return codes.
Bruno Haible <bruno@clisp.org>
parents: 13834
diff changeset
149 result |= 4;
10418
1e251b3d489c frexp: test for NetBSD failure on -0.0
Eric Blake <ebb9@byu.net>
parents: 9508
diff changeset
150 }
13918
d5a74c6ec06b Put more information about failed tests into the test return codes.
Bruno Haible <bruno@clisp.org>
parents: 13834
diff changeset
151 return result;
13579
da9779900713 Modernize AC_TRY_RUN invocations.
Bruno Haible <bruno@clisp.org>
parents: 13578
diff changeset
152 }]])],
da9779900713 Modernize AC_TRY_RUN invocations.
Bruno Haible <bruno@clisp.org>
parents: 13578
diff changeset
153 [gl_cv_func_frexp_works=yes],
da9779900713 Modernize AC_TRY_RUN invocations.
Bruno Haible <bruno@clisp.org>
parents: 13578
diff changeset
154 [gl_cv_func_frexp_works=no],
da9779900713 Modernize AC_TRY_RUN invocations.
Bruno Haible <bruno@clisp.org>
parents: 13578
diff changeset
155 [case "$host_os" in
da9779900713 Modernize AC_TRY_RUN invocations.
Bruno Haible <bruno@clisp.org>
parents: 13578
diff changeset
156 netbsd* | irix* | mingw*) gl_cv_func_frexp_works="guessing no";;
da9779900713 Modernize AC_TRY_RUN invocations.
Bruno Haible <bruno@clisp.org>
parents: 13578
diff changeset
157 *) gl_cv_func_frexp_works="guessing yes";;
da9779900713 Modernize AC_TRY_RUN invocations.
Bruno Haible <bruno@clisp.org>
parents: 13578
diff changeset
158 esac
da9779900713 Modernize AC_TRY_RUN invocations.
Bruno Haible <bruno@clisp.org>
parents: 13578
diff changeset
159 ])
8491
af98e0b44387 New module 'frexp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
160 ])
af98e0b44387 New module 'frexp'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
161 ])