summaryrefslogtreecommitdiff
path: root/math
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2006-01-30 09:30:09 +0000
committerJakub Jelinek <jakub@redhat.com>2006-01-30 09:30:09 +0000
commit3e543bc56346540cbf73fd48d0172fc6a588efd5 (patch)
treeb2c3502b6596d238ac861cc82cafdc6f8b84e143 /math
parent06f313e361a523605ba6d4c9cdc67a7353cd367c (diff)
Updated to fedora-glibc-20060130T0922
Diffstat (limited to 'math')
-rw-r--r--math/Makefile12
-rw-r--r--math/bits/mathcalls.h4
-rw-r--r--math/complex.h11
-rw-r--r--math/e_exp2l.c12
-rw-r--r--math/libm-test.inc318
-rw-r--r--math/math.h28
-rw-r--r--math/s_cacosh.c5
-rw-r--r--math/s_cacoshf.c5
-rw-r--r--math/s_cacoshl.c5
-rw-r--r--math/w_j0l.c11
-rw-r--r--math/w_j1l.c10
-rw-r--r--math/w_jnl.c10
12 files changed, 397 insertions, 34 deletions
diff --git a/math/Makefile b/math/Makefile
index 8e5c788403..b45283d8fc 100644
--- a/math/Makefile
+++ b/math/Makefile
@@ -1,4 +1,5 @@
-# Copyright (C) 1996-2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+# Copyright (C) 1996-2001,2002,2003,2004,2005,2006
+# Free Software Foundation, Inc.
# This file is part of the GNU C Library.
# The GNU C Library is free software; you can redistribute it and/or
@@ -149,6 +150,15 @@ distribute += ieee-math.c
include ../Rules
+# The generated sysd-rules file defines rules like this for sources
+# coming from sysdeps/ directories. These rules find the generic sources.
+define o-iterator-doit
+$(objpfx)m_%$o: s_%.c $(before-compile); $$(compile-command.c)
+endef
+object-suffixes-left := $(all-object-suffixes)
+include $(o-iterator)
+
+
# This file defines the default _LIB_VERSION variable that controls
# the error return conventions for the math functions.
CPPFLAGS-s_lib_version.c := -D_POSIX_MODE
diff --git a/math/bits/mathcalls.h b/math/bits/mathcalls.h
index 75b2f74556..174fe34589 100644
--- a/math/bits/mathcalls.h
+++ b/math/bits/mathcalls.h
@@ -1,5 +1,5 @@
/* Prototype declarations for math functions; helper file for <math.h>.
- Copyright (C) 1996-2002, 2003 Free Software Foundation, Inc.
+ Copyright (C) 1996-2002, 2003, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -281,7 +281,7 @@ __MATHCALL (rint,, (_Mdouble_ __x));
/* Return X + epsilon if X < Y, X - epsilon if X > Y. */
__MATHCALLX (nextafter,, (_Mdouble_ __x, _Mdouble_ __y), (__const__));
-# ifdef __USE_ISOC99
+# if defined __USE_ISOC99 && !defined __LDBL_COMPAT
__MATHCALLX (nexttoward,, (_Mdouble_ __x, long double __y), (__const__));
# endif
diff --git a/math/complex.h b/math/complex.h
index f005a93912..229bb7dca6 100644
--- a/math/complex.h
+++ b/math/complex.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 1998, 1999, 2000, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -84,7 +84,14 @@ __BEGIN_DECLS
/* And the long double versions. It is non-critical to define them
here unconditionally since `long double' is required in ISO C99. */
-#if __STDC__ - 0 || __GNUC__ - 0 && !defined __NO_LONG_DOUBLE_MATH
+#if (__STDC__ - 0 || __GNUC__ - 0) \
+ && (!defined __NO_LONG_DOUBLE_MATH || defined __LDBL_COMPAT)
+# ifdef __LDBL_COMPAT
+# undef __MATHDECL_1
+# define __MATHDECL_1(type, function, args) \
+ extern type __REDIRECT(__MATH_PRECNAME(function), args, function) __THROW
+# endif
+
# ifndef _Mlong_double_
# define _Mlong_double_ long double
# endif
diff --git a/math/e_exp2l.c b/math/e_exp2l.c
index 64ef6d3d50..7e598d8d2d 100644
--- a/math/e_exp2l.c
+++ b/math/e_exp2l.c
@@ -1,14 +1,10 @@
#include <math.h>
-#include <stdio.h>
-#include <errno.h>
+#include "math_private.h"
long double
__ieee754_exp2l (long double x)
{
- fputs ("__ieee754_exp2l not implemented\n", stderr);
- __set_errno (ENOSYS);
- return 0.0;
+ /* This is a very stupid and inprecise implementation. It'll get
+ replaced sometime (soon?). */
+ return __ieee754_expl (M_LN2l * x);
}
-
-stub_warning (exp2l)
-#include <stub-tag.h>
diff --git a/math/libm-test.inc b/math/libm-test.inc
index 15509019c9..9534596725 100644
--- a/math/libm-test.inc
+++ b/math/libm-test.inc
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997-2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+/* Copyright (C) 1997-2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Andreas Jaeger <aj@suse.de>, 1997.
@@ -22,7 +22,7 @@
This file is processed by a perl script. The resulting file has to
be included by a master file that defines:
- Makros:
+ Macros:
FUNC(function): converts general function name (like cos) to
name with correct suffix (e.g. cosl or cosf)
MATHCONST(x): like FUNC but for constants (e.g convert 0.0 to 0.0L)
@@ -498,7 +498,7 @@ check_float_internal (const char *test_name, FLOAT computed, FLOAT expected,
&& computed == 0.0 && expected == 0.0
&& signbit(computed) != signbit (expected))
ok = 0;
- else if (ulp == 0.0 || (ulp <= max_ulp && !ignore_max_ulp))
+ else if (ulp <= 0.5 || (ulp <= max_ulp && !ignore_max_ulp))
ok = 1;
else
{
@@ -1116,7 +1116,7 @@ cacosh_test (void)
TEST_c_c (cacosh, nan_value, nan_value, nan_value, nan_value);
TEST_c_c (cacosh, 0.75L, 1.25L, 1.13239363160530819522266333696834467L, 1.11752014915610270578240049553777969L);
- TEST_c_c (cacosh, -2, -3, -1.9833870299165354323470769028940395L, 2.1414491111159960199416055713254211L);
+ TEST_c_c (cacosh, -2, -3, 1.9833870299165354323470769028940395L, -2.1414491111159960199416055713254211L);
END (cacosh, complex);
}
@@ -1631,6 +1631,51 @@ ceil_test (void)
TEST_f_f (ceil, 0.25, 1.0);
TEST_f_f (ceil, -0.25, minus_zero);
+#ifdef TEST_LDOUBLE
+ /* The result can only be represented in long double. */
+ TEST_f_f (ceil, 4503599627370495.5L, 4503599627370496.0L);
+ TEST_f_f (ceil, 4503599627370496.25L, 4503599627370497.0L);
+ TEST_f_f (ceil, 4503599627370496.5L, 4503599627370497.0L);
+ TEST_f_f (ceil, 4503599627370496.75L, 4503599627370497.0L);
+ TEST_f_f (ceil, 4503599627370497.5L, 4503599627370498.0L);
+
+ TEST_f_f (ceil, -4503599627370495.5L, -4503599627370495.0L);
+ TEST_f_f (ceil, -4503599627370496.25L, -4503599627370496.0L);
+ TEST_f_f (ceil, -4503599627370496.5L, -4503599627370496.0L);
+ TEST_f_f (ceil, -4503599627370496.75L, -4503599627370496.0L);
+ TEST_f_f (ceil, -4503599627370497.5L, -4503599627370497.0L);
+
+ TEST_f_f (ceil, 9007199254740991.5L, 9007199254740992.0L);
+ TEST_f_f (ceil, 9007199254740992.25L, 9007199254740993.0L);
+ TEST_f_f (ceil, 9007199254740992.5L, 9007199254740993.0L);
+ TEST_f_f (ceil, 9007199254740992.75L, 9007199254740993.0L);
+ TEST_f_f (ceil, 9007199254740993.5L, 9007199254740994.0L);
+
+ TEST_f_f (ceil, -9007199254740991.5L, -9007199254740991.0L);
+ TEST_f_f (ceil, -9007199254740992.25L, -9007199254740992.0L);
+ TEST_f_f (ceil, -9007199254740992.5L, -9007199254740992.0L);
+ TEST_f_f (ceil, -9007199254740992.75L, -9007199254740992.0L);
+ TEST_f_f (ceil, -9007199254740993.5L, -9007199254740993.0L);
+
+ TEST_f_f (ceil, 72057594037927935.5L, 72057594037927936.0L);
+ TEST_f_f (ceil, 72057594037927936.25L, 72057594037927937.0L);
+ TEST_f_f (ceil, 72057594037927936.5L, 72057594037927937.0L);
+ TEST_f_f (ceil, 72057594037927936.75L, 72057594037927937.0L);
+ TEST_f_f (ceil, 72057594037927937.5L, 72057594037927938.0L);
+
+ TEST_f_f (ceil, -72057594037927935.5L, -72057594037927935.0L);
+ TEST_f_f (ceil, -72057594037927936.25L, -72057594037927936.0L);
+ TEST_f_f (ceil, -72057594037927936.5L, -72057594037927936.0L);
+ TEST_f_f (ceil, -72057594037927936.75L, -72057594037927936.0L);
+ TEST_f_f (ceil, -72057594037927937.5L, -72057594037927937.0L);
+
+ TEST_f_f (ceil, 10141204801825835211973625643007.5L, 10141204801825835211973625643008.0L);
+ TEST_f_f (ceil, 10141204801825835211973625643008.25L, 10141204801825835211973625643009.0L);
+ TEST_f_f (ceil, 10141204801825835211973625643008.5L, 10141204801825835211973625643009.0L);
+ TEST_f_f (ceil, 10141204801825835211973625643008.75L, 10141204801825835211973625643009.0L);
+ TEST_f_f (ceil, 10141204801825835211973625643009.5L, 10141204801825835211973625643010.0L);
+#endif
+
END (ceil);
}
@@ -2389,7 +2434,9 @@ erfc_test (void)
TEST_f_f (erfc, 4.125L, 0.542340079956506600531223408575531062e-8L);
#ifdef TEST_LDOUBLE
/* The result can only be represented in long double. */
+# if LDBL_MIN_10_EXP < -319
TEST_f_f (erfc, 27.0L, 0.523704892378925568501606768284954709e-318L);
+# endif
#endif
END (erfc);
@@ -2584,6 +2631,52 @@ floor_test (void)
TEST_f_f (floor, 0.25, 0.0);
TEST_f_f (floor, -0.25, -1.0);
+
+#ifdef TEST_LDOUBLE
+ /* The result can only be represented in long double. */
+ TEST_f_f (floor, 4503599627370495.5L, 4503599627370495.0L);
+ TEST_f_f (floor, 4503599627370496.25L, 4503599627370496.0L);
+ TEST_f_f (floor, 4503599627370496.5L, 4503599627370496.0L);
+ TEST_f_f (floor, 4503599627370496.75L, 4503599627370496.0L);
+ TEST_f_f (floor, 4503599627370497.5L, 4503599627370497.0L);
+
+ TEST_f_f (floor, -4503599627370495.5L, -4503599627370496.0L);
+ TEST_f_f (floor, -4503599627370496.25L, -4503599627370497.0L);
+ TEST_f_f (floor, -4503599627370496.5L, -4503599627370497.0L);
+ TEST_f_f (floor, -4503599627370496.75L, -4503599627370497.0L);
+ TEST_f_f (floor, -4503599627370497.5L, -4503599627370498.0L);
+
+ TEST_f_f (floor, 9007199254740991.5L, 9007199254740991.0L);
+ TEST_f_f (floor, 9007199254740992.25L, 9007199254740992.0L);
+ TEST_f_f (floor, 9007199254740992.5L, 9007199254740992.0L);
+ TEST_f_f (floor, 9007199254740992.75L, 9007199254740992.0L);
+ TEST_f_f (floor, 9007199254740993.5L, 9007199254740993.0L);
+
+ TEST_f_f (floor, -9007199254740991.5L, -9007199254740992.0L);
+ TEST_f_f (floor, -9007199254740992.25L, -9007199254740993.0L);
+ TEST_f_f (floor, -9007199254740992.5L, -9007199254740993.0L);
+ TEST_f_f (floor, -9007199254740992.75L, -9007199254740993.0L);
+ TEST_f_f (floor, -9007199254740993.5L, -9007199254740994.0L);
+
+ TEST_f_f (floor, 72057594037927935.5L, 72057594037927935.0L);
+ TEST_f_f (floor, 72057594037927936.25L, 72057594037927936.0L);
+ TEST_f_f (floor, 72057594037927936.5L, 72057594037927936.0L);
+ TEST_f_f (floor, 72057594037927936.75L, 72057594037927936.0L);
+ TEST_f_f (floor, 72057594037927937.5L, 72057594037927937.0L);
+
+ TEST_f_f (floor, -72057594037927935.5L, -72057594037927936.0L);
+ TEST_f_f (floor, -72057594037927936.25L, -72057594037927937.0L);
+ TEST_f_f (floor, -72057594037927936.5L, -72057594037927937.0L);
+ TEST_f_f (floor, -72057594037927936.75L, -72057594037927937.0L);
+ TEST_f_f (floor, -72057594037927937.5L, -72057594037927938.0L);
+
+ TEST_f_f (floor, 10141204801825835211973625643007.5L, 10141204801825835211973625643007.0L);
+ TEST_f_f (floor, 10141204801825835211973625643008.25L, 10141204801825835211973625643008.0L);
+ TEST_f_f (floor, 10141204801825835211973625643008.5L, 10141204801825835211973625643008.0L);
+ TEST_f_f (floor, 10141204801825835211973625643008.75L, 10141204801825835211973625643008.0L);
+ TEST_f_f (floor, 10141204801825835211973625643009.5L, 10141204801825835211973625643009.0L);
+#endif
+
END (floor);
}
@@ -3164,6 +3257,44 @@ llrint_test (void)
TEST_f_L (llrint, 36028797018963968.0, 36028797018963968LL);
/* 0x100000000000000 */
TEST_f_L (llrint, 72057594037927936.0, 72057594037927936LL);
+#ifdef TEST_LDOUBLE
+ /* The input can only be represented in long double. */
+ TEST_f_L (llrint, 4503599627370495.5L, 4503599627370496LL);
+ TEST_f_L (llrint, 4503599627370496.25L, 4503599627370496LL);
+ TEST_f_L (llrint, 4503599627370496.5L, 4503599627370496LL);
+ TEST_f_L (llrint, 4503599627370496.75L, 4503599627370497LL);
+ TEST_f_L (llrint, 4503599627370497.5L, 4503599627370498LL);
+
+ TEST_f_L (llrint, -4503599627370495.5L, -4503599627370496LL);
+ TEST_f_L (llrint, -4503599627370496.25L, -4503599627370496LL);
+ TEST_f_L (llrint, -4503599627370496.5L, -4503599627370496LL);
+ TEST_f_L (llrint, -4503599627370496.75L, -4503599627370497LL);
+ TEST_f_L (llrint, -4503599627370497.5L, -4503599627370498LL);
+
+ TEST_f_L (llrint, 9007199254740991.5L, 9007199254740992LL);
+ TEST_f_L (llrint, 9007199254740992.25L, 9007199254740992LL);
+ TEST_f_L (llrint, 9007199254740992.5L, 9007199254740992LL);
+ TEST_f_L (llrint, 9007199254740992.75L, 9007199254740993LL);
+ TEST_f_L (llrint, 9007199254740993.5L, 9007199254740994LL);
+
+ TEST_f_L (llrint, -9007199254740991.5L, -9007199254740992LL);
+ TEST_f_L (llrint, -9007199254740992.25L, -9007199254740992LL);
+ TEST_f_L (llrint, -9007199254740992.5L, -9007199254740992LL);
+ TEST_f_L (llrint, -9007199254740992.75L, -9007199254740993LL);
+ TEST_f_L (llrint, -9007199254740993.5L, -9007199254740994LL);
+
+ TEST_f_L (llrint, 72057594037927935.5L, 72057594037927936LL);
+ TEST_f_L (llrint, 72057594037927936.25L, 72057594037927936LL);
+ TEST_f_L (llrint, 72057594037927936.5L, 72057594037927936LL);
+ TEST_f_L (llrint, 72057594037927936.75L, 72057594037927937LL);
+ TEST_f_L (llrint, 72057594037927937.5L, 72057594037927938LL);
+
+ TEST_f_L (llrint, -72057594037927935.5L, -72057594037927936LL);
+ TEST_f_L (llrint, -72057594037927936.25L, -72057594037927936LL);
+ TEST_f_L (llrint, -72057594037927936.5L, -72057594037927936LL);
+ TEST_f_L (llrint, -72057594037927936.75L, -72057594037927937LL);
+ TEST_f_L (llrint, -72057594037927937.5L, -72057594037927938LL);
+#endif
END (llrint);
}
@@ -3398,6 +3529,52 @@ llround_test (void)
TEST_f_L (llround, 8589934591.5, 8589934592LL);
#endif
+#ifdef TEST_LDOUBLE
+ /* The input can only be represented in long double. */
+ TEST_f_L (llround, 4503599627370495.5L, 4503599627370496LL);
+ TEST_f_L (llround, 4503599627370496.25L, 4503599627370496LL);
+ TEST_f_L (llround, 4503599627370496.5L, 4503599627370497LL);
+ TEST_f_L (llround, 4503599627370496.75L, 4503599627370497LL);
+ TEST_f_L (llround, 4503599627370497.5L, 4503599627370498LL);
+
+ TEST_f_L (llround, -4503599627370495.5L, -4503599627370496LL);
+ TEST_f_L (llround, -4503599627370496.25L, -4503599627370496LL);
+ TEST_f_L (llround, -4503599627370496.5L, -4503599627370497LL);
+ TEST_f_L (llround, -4503599627370496.75L, -4503599627370497LL);
+ TEST_f_L (llround, -4503599627370497.5L, -4503599627370498LL);
+
+ TEST_f_L (llround, 9007199254740991.5L, 9007199254740992LL);
+ TEST_f_L (llround, 9007199254740992.25L, 9007199254740992LL);
+ TEST_f_L (llround, 9007199254740992.5L, 9007199254740993LL);
+ TEST_f_L (llround, 9007199254740992.75L, 9007199254740993LL);
+ TEST_f_L (llround, 9007199254740993.5L, 9007199254740994LL);
+
+ TEST_f_L (llround, -9007199254740991.5L, -9007199254740992LL);
+ TEST_f_L (llround, -9007199254740992.25L, -9007199254740992LL);
+ TEST_f_L (llround, -9007199254740992.5L, -9007199254740993LL);
+ TEST_f_L (llround, -9007199254740992.75L, -9007199254740993LL);
+ TEST_f_L (llround, -9007199254740993.5L, -9007199254740994LL);
+
+ TEST_f_L (llround, 72057594037927935.5L, 72057594037927936LL);
+ TEST_f_L (llround, 72057594037927936.25L, 72057594037927936LL);
+ TEST_f_L (llround, 72057594037927936.5L, 72057594037927937LL);
+ TEST_f_L (llround, 72057594037927936.75L, 72057594037927937LL);
+ TEST_f_L (llround, 72057594037927937.5L, 72057594037927938LL);
+
+ TEST_f_L (llround, -72057594037927935.5L, -72057594037927936LL);
+ TEST_f_L (llround, -72057594037927936.25L, -72057594037927936LL);
+ TEST_f_L (llround, -72057594037927936.5L, -72057594037927937LL);
+ TEST_f_L (llround, -72057594037927936.75L, -72057594037927937LL);
+ TEST_f_L (llround, -72057594037927937.5L, -72057594037927938LL);
+
+ TEST_f_L (llround, 9223372036854775806.25L, 9223372036854775806LL);
+ TEST_f_L (llround, -9223372036854775806.25L, -9223372036854775806LL);
+ TEST_f_L (llround, 9223372036854775806.5L, 9223372036854775807LL);
+ TEST_f_L (llround, -9223372036854775806.5L, -9223372036854775807LL);
+ TEST_f_L (llround, 9223372036854775807.0L, 9223372036854775807LL);
+ TEST_f_L (llround, -9223372036854775807.0L, -9223372036854775807LL);
+#endif
+
END (llround);
}
@@ -3794,6 +3971,50 @@ rint_test (void)
TEST_f_f (rint, -2.5, -2.0);
TEST_f_f (rint, -3.5, -4.0);
TEST_f_f (rint, -4.5, -4.0);
+#ifdef TEST_LDOUBLE
+ /* The result can only be represented in long double. */
+ TEST_f_f (rint, 4503599627370495.5L, 4503599627370496.0L);
+ TEST_f_f (rint, 4503599627370496.25L, 4503599627370496.0L);
+ TEST_f_f (rint, 4503599627370496.5L, 4503599627370496.0L);
+ TEST_f_f (rint, 4503599627370496.75L, 4503599627370497.0L);
+ TEST_f_f (rint, 4503599627370497.5L, 4503599627370498.0L);
+
+ TEST_f_f (rint, -4503599627370495.5L, -4503599627370496.0L);
+ TEST_f_f (rint, -4503599627370496.25L, -4503599627370496.0L);
+ TEST_f_f (rint, -4503599627370496.5L, -4503599627370496.0L);
+ TEST_f_f (rint, -4503599627370496.75L, -4503599627370497.0L);
+ TEST_f_f (rint, -4503599627370497.5L, -4503599627370498.0L);
+
+ TEST_f_f (rint, 9007199254740991.5L, 9007199254740992.0L);
+ TEST_f_f (rint, 9007199254740992.25L, 9007199254740992.0L);
+ TEST_f_f (rint, 9007199254740992.5L, 9007199254740992.0L);
+ TEST_f_f (rint, 9007199254740992.75L, 9007199254740993.0L);
+ TEST_f_f (rint, 9007199254740993.5L, 9007199254740994.0L);
+
+ TEST_f_f (rint, -9007199254740991.5L, -9007199254740992.0L);
+ TEST_f_f (rint, -9007199254740992.25L, -9007199254740992.0L);
+ TEST_f_f (rint, -9007199254740992.5L, -9007199254740992.0L);
+ TEST_f_f (rint, -9007199254740992.75L, -9007199254740993.0L);
+ TEST_f_f (rint, -9007199254740993.5L, -9007199254740994.0L);
+
+ TEST_f_f (rint, 72057594037927935.5L, 72057594037927936.0L);
+ TEST_f_f (rint, 72057594037927936.25L, 72057594037927936.0L);
+ TEST_f_f (rint, 72057594037927936.5L, 72057594037927936.0L);
+ TEST_f_f (rint, 72057594037927936.75L, 72057594037927937.0L);
+ TEST_f_f (rint, 72057594037927937.5L, 72057594037927938.0L);
+
+ TEST_f_f (rint, -72057594037927935.5L, -72057594037927936.0L);
+ TEST_f_f (rint, -72057594037927936.25L, -72057594037927936.0L);
+ TEST_f_f (rint, -72057594037927936.5L, -72057594037927936.0L);
+ TEST_f_f (rint, -72057594037927936.75L, -72057594037927937.0L);
+ TEST_f_f (rint, -72057594037927937.5L, -72057594037927938.0L);
+
+ TEST_f_f (rint, 10141204801825835211973625643007.5L, 10141204801825835211973625643008.0L);
+ TEST_f_f (rint, 10141204801825835211973625643008.25L, 10141204801825835211973625643008.0L);
+ TEST_f_f (rint, 10141204801825835211973625643008.5L, 10141204801825835211973625643008.0L);
+ TEST_f_f (rint, 10141204801825835211973625643008.75L, 10141204801825835211973625643009.0L);
+ TEST_f_f (rint, 10141204801825835211973625643009.5L, 10141204801825835211973625643010.0L);
+#endif
END (rint);
}
@@ -3924,6 +4145,51 @@ round_test (void)
TEST_f_f (round, 2097152.5, 2097153);
TEST_f_f (round, -2097152.5, -2097153);
+#ifdef TEST_LDOUBLE
+ /* The result can only be represented in long double. */
+ TEST_f_f (round, 4503599627370495.5L, 4503599627370496.0L);
+ TEST_f_f (round, 4503599627370496.25L, 4503599627370496.0L);
+ TEST_f_f (round, 4503599627370496.5L, 4503599627370497.0L);
+ TEST_f_f (round, 4503599627370496.75L, 4503599627370497.0L);
+ TEST_f_f (round, 4503599627370497.5L, 4503599627370498.0L);
+
+ TEST_f_f (round, -4503599627370495.5L, -4503599627370496.0L);
+ TEST_f_f (round, -4503599627370496.25L, -4503599627370496.0L);
+ TEST_f_f (round, -4503599627370496.5L, -4503599627370497.0L);
+ TEST_f_f (round, -4503599627370496.75L, -4503599627370497.0L);
+ TEST_f_f (round, -4503599627370497.5L, -4503599627370498.0L);
+
+ TEST_f_f (round, 9007199254740991.5L, 9007199254740992.0L);
+ TEST_f_f (round, 9007199254740992.25L, 9007199254740992.0L);
+ TEST_f_f (round, 9007199254740992.5L, 9007199254740993.0L);
+ TEST_f_f (round, 9007199254740992.75L, 9007199254740993.0L);
+ TEST_f_f (round, 9007199254740993.5L, 9007199254740994.0L);
+
+ TEST_f_f (round, -9007199254740991.5L, -9007199254740992.0L);
+ TEST_f_f (round, -9007199254740992.25L, -9007199254740992.0L);
+ TEST_f_f (round, -9007199254740992.5L, -9007199254740993.0L);
+ TEST_f_f (round, -9007199254740992.75L, -9007199254740993.0L);
+ TEST_f_f (round, -9007199254740993.5L, -9007199254740994.0L);
+
+ TEST_f_f (round, 72057594037927935.5L, 72057594037927936.0L);
+ TEST_f_f (round, 72057594037927936.25L, 72057594037927936.0L);
+ TEST_f_f (round, 72057594037927936.5L, 72057594037927937.0L);
+ TEST_f_f (round, 72057594037927936.75L, 72057594037927937.0L);
+ TEST_f_f (round, 72057594037927937.5L, 72057594037927938.0L);
+
+ TEST_f_f (round, -72057594037927935.5L, -72057594037927936.0L);
+ TEST_f_f (round, -72057594037927936.25L, -72057594037927936.0L);
+ TEST_f_f (round, -72057594037927936.5L, -72057594037927937.0L);
+ TEST_f_f (round, -72057594037927936.75L, -72057594037927937.0L);
+ TEST_f_f (round, -72057594037927937.5L, -72057594037927938.0L);
+
+ TEST_f_f (round, 10141204801825835211973625643007.5L, 10141204801825835211973625643008.0L);
+ TEST_f_f (round, 10141204801825835211973625643008.25L, 10141204801825835211973625643008.0L);
+ TEST_f_f (round, 10141204801825835211973625643008.5L, 10141204801825835211973625643009.0L);
+ TEST_f_f (round, 10141204801825835211973625643008.75L, 10141204801825835211973625643009.0L);
+ TEST_f_f (round, 10141204801825835211973625643009.5L, 10141204801825835211973625643010.0L);
+#endif
+
END (round);
}
@@ -4291,6 +4557,50 @@ trunc_test (void)
TEST_f_f (trunc, 4294967296.625L, 4294967296.0L);
TEST_f_f (trunc, -4294967296.625L, -4294967296.0L);
+#ifdef TEST_LDOUBLE
+ /* The result can only be represented in long double. */
+ TEST_f_f (trunc, 4503599627370495.5L, 4503599627370495.0L);
+ TEST_f_f (trunc, 4503599627370496.25L, 4503599627370496.0L);
+ TEST_f_f (trunc, 4503599627370496.5L, 4503599627370496.0L);
+ TEST_f_f (trunc, 4503599627370496.75L, 4503599627370496.0L);
+ TEST_f_f (trunc, 4503599627370497.5L, 4503599627370497.0L);
+
+ TEST_f_f (trunc, -4503599627370495.5L, -4503599627370495.0L);
+ TEST_f_f (trunc, -4503599627370496.25L, -4503599627370496.0L);
+ TEST_f_f (trunc, -4503599627370496.5L, -4503599627370496.0L);
+ TEST_f_f (trunc, -4503599627370496.75L, -4503599627370496.0L);
+ TEST_f_f (trunc, -4503599627370497.5L, -4503599627370497.0L);
+
+ TEST_f_f (trunc, 9007199254740991.5L, 9007199254740991.0L);
+ TEST_f_f (trunc, 9007199254740992.25L, 9007199254740992.0L);
+ TEST_f_f (trunc, 9007199254740992.5L, 9007199254740992.0L);
+ TEST_f_f (trunc, 9007199254740992.75L, 9007199254740992.0L);
+ TEST_f_f (trunc, 9007199254740993.5L, 9007199254740993.0L);
+
+ TEST_f_f (trunc, -9007199254740991.5L, -9007199254740991.0L);
+ TEST_f_f (trunc, -9007199254740992.25L, -9007199254740992.0L);
+ TEST_f_f (trunc, -9007199254740992.5L, -9007199254740992.0L);
+ TEST_f_f (trunc, -9007199254740992.75L, -9007199254740992.0L);
+ TEST_f_f (trunc, -9007199254740993.5L, -9007199254740993.0L);
+
+ TEST_f_f (trunc, 72057594037927935.5L, 72057594037927935.0L);
+ TEST_f_f (trunc, 72057594037927936.25L, 72057594037927936.0L);
+ TEST_f_f (trunc, 72057594037927936.5L, 72057594037927936.0L);
+ TEST_f_f (trunc, 72057594037927936.75L, 72057594037927936.0L);
+ TEST_f_f (trunc, 72057594037927937.5L, 72057594037927937.0L);
+
+ TEST_f_f (trunc, -72057594037927935.5L, -72057594037927935.0L);
+ TEST_f_f (trunc, -72057594037927936.25L, -72057594037927936.0L);
+ TEST_f_f (trunc, -72057594037927936.5L, -72057594037927936.0L);
+ TEST_f_f (trunc, -72057594037927936.75L, -72057594037927936.0L);
+ TEST_f_f (trunc, -72057594037927937.5L, -72057594037927937.0L);
+
+ TEST_f_f (trunc, 10141204801825835211973625643007.5L, 10141204801825835211973625643007.0L);
+ TEST_f_f (trunc, 10141204801825835211973625643008.25L, 10141204801825835211973625643008.0L);
+ TEST_f_f (trunc, 10141204801825835211973625643008.5L, 10141204801825835211973625643008.0L);
+ TEST_f_f (trunc, 10141204801825835211973625643008.75L, 10141204801825835211973625643008.0L);
+ TEST_f_f (trunc, 10141204801825835211973625643009.5L, 10141204801825835211973625643009.0L);
+#endif
END (trunc);
}
diff --git a/math/math.h b/math/math.h
index 7f8a4815f4..050b89ca85 100644
--- a/math/math.h
+++ b/math/math.h
@@ -1,5 +1,6 @@
/* Declarations for math functions.
- Copyright (C) 1991-1993,1995-1999,2001,2002,2004 Free Software Foundation, Inc.
+ Copyright (C) 1991-1993, 1995-1999, 2001, 2002, 2004, 2006
+ Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -96,10 +97,33 @@ __BEGIN_DECLS
# undef _Mdouble_END_NAMESPACE
# undef __MATH_PRECNAME
-# if (__STDC__ - 0 || __GNUC__ - 0) && !defined __NO_LONG_DOUBLE_MATH
+# if (__STDC__ - 0 || __GNUC__ - 0) \
+ && (!defined __NO_LONG_DOUBLE_MATH || defined __LDBL_COMPAT)
+# ifdef __LDBL_COMPAT
+
+# ifdef __USE_ISOC99
+extern float __nldbl_nexttowardf (float __x, long double __y)
+ __attribute__ ((__const__)) __THROW;
+# ifdef __REDIRECT_NTH
+extern float __REDIRECT_NTH (nexttowardf, (float __x, long double __y),
+ __nldbl_nexttowardf)
+ __attribute__ ((__const__));
+extern double __REDIRECT_NTH (nexttoward, (double __x, long double __y),
+ nextafter) __attribute__ ((__const__));
+# endif
+# endif
+
/* Include the file of declarations again, this time using `long double'
instead of `double' and appending l to each function name. */
+# undef __MATHDECL_1
+# define __MATHDECL_2(type, function,suffix, args, alias) \
+ extern type __REDIRECT(__MATH_PRECNAME(function,suffix), \
+ args, alias) __THROW
+# define __MATHDECL_1(type, function,suffix, args) \
+ __MATHDECL_2(type, function,suffix, args, __CONCAT(function,suffix))
+# endif
+
# ifndef _Mlong_double_
# define _Mlong_double_ long double
# endif
diff --git a/math/s_cacosh.c b/math/s_cacosh.c
index 1ae8708d49..e921f0763e 100644
--- a/math/s_cacosh.c
+++ b/math/s_cacosh.c
@@ -1,5 +1,5 @@
/* Return arc hyperbole cosine for double value.
- Copyright (C) 1997 Free Software Foundation, Inc.
+ Copyright (C) 1997, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -73,6 +73,9 @@ __cacosh (__complex__ double x)
y = __csqrt (y);
+ if (__real__ x < 0.0)
+ y = -y;
+
__real__ y += __real__ x;
__imag__ y += __imag__ x;
diff --git a/math/s_cacoshf.c b/math/s_cacoshf.c
index 52c35505e0..3fc48bb617 100644
--- a/math/s_cacoshf.c
+++ b/math/s_cacoshf.c
@@ -1,5 +1,5 @@
/* Return arc hyperbole cosine for float value.
- Copyright (C) 1997 Free Software Foundation, Inc.
+ Copyright (C) 1997, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -75,6 +75,9 @@ __cacoshf (__complex__ float x)
y = __csqrtf (y);
+ if (__real__ x < 0.0)
+ y = -y;
+
__real__ y += __real__ x;
__imag__ y += __imag__ x;
diff --git a/math/s_cacoshl.c b/math/s_cacoshl.c
index 4e5e2b3e3e..643858920e 100644
--- a/math/s_cacoshl.c
+++ b/math/s_cacoshl.c
@@ -1,5 +1,5 @@
/* Return arc hyperbole cosine for long double value.
- Copyright (C) 1997, 1998 Free Software Foundation, Inc.
+ Copyright (C) 1997, 1998, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -73,6 +73,9 @@ __cacoshl (__complex__ long double x)
y = __csqrtl (y);
+ if (__real__ x < 0.0)
+ y = -y;
+
__real__ y += __real__ x;
__imag__ y += __imag__ x;
diff --git a/math/w_j0l.c b/math/w_j0l.c
index fde0f64f89..1ec6e9e0c2 100644
--- a/math/w_j0l.c
+++ b/math/w_j0l.c
@@ -26,9 +26,9 @@ static char rcsid[] = "$NetBSD: $";
#include "math_private.h"
#ifdef __STDC__
- long double j0l(long double x) /* wrapper j0l */
+ long double __j0l(long double x) /* wrapper j0l */
#else
- long double j0l(x) /* wrapper j0 */
+ long double __j0l(x) /* wrapper j0 */
long double x;
#endif
{
@@ -43,11 +43,12 @@ static char rcsid[] = "$NetBSD: $";
return z;
#endif
}
+weak_alias (__j0l, j0l)
#ifdef __STDC__
- long double y0l(long double x) /* wrapper y0l */
+ long double __y0l(long double x) /* wrapper y0l */
#else
- long double y0l(x) /* wrapper y0 */
+ long double __y0l(x) /* wrapper y0 */
long double x;
#endif
{
@@ -71,3 +72,5 @@ static char rcsid[] = "$NetBSD: $";
return z;
#endif
}
+
+weak_alias (__y0l, y0l)
diff --git a/math/w_j1l.c b/math/w_j1l.c
index 5ecfd1ec6e..7bd31ad995 100644
--- a/math/w_j1l.c
+++ b/math/w_j1l.c
@@ -26,9 +26,9 @@ static char rcsid[] = "$NetBSD: $";
#include "math_private.h"
#ifdef __STDC__
- long double j1l(long double x) /* wrapper j1l */
+ long double __j1l(long double x) /* wrapper j1l */
#else
- long double j1l(x) /* wrapper j1l */
+ long double __j1l(x) /* wrapper j1l */
long double x;
#endif
{
@@ -44,11 +44,12 @@ static char rcsid[] = "$NetBSD: $";
return z;
#endif
}
+weak_alias (__j1l, j1l)
#ifdef __STDC__
- long double y1l(long double x) /* wrapper y1l */
+ long double __y1l(long double x) /* wrapper y1l */
#else
- long double y1l(x) /* wrapper y1l */
+ long double __y1l(x) /* wrapper y1l */
long double x;
#endif
{
@@ -72,3 +73,4 @@ static char rcsid[] = "$NetBSD: $";
return z;
#endif
}
+weak_alias (__y1l, y1l)
diff --git a/math/w_jnl.c b/math/w_jnl.c
index 021c16a104..4bb4d6b620 100644
--- a/math/w_jnl.c
+++ b/math/w_jnl.c
@@ -48,9 +48,9 @@ static char rcsid[] = "$NetBSD: $";
#include "math_private.h"
#ifdef __STDC__
- long double jnl(int n, long double x) /* wrapper jnl */
+ long double __jnl(int n, long double x) /* wrapper jnl */
#else
- long double jnl(n,x) /* wrapper jnl */
+ long double __jnl(n,x) /* wrapper jnl */
long double x; int n;
#endif
{
@@ -66,11 +66,12 @@ static char rcsid[] = "$NetBSD: $";
return z;
#endif
}
+weak_alias (__jnl, jnl)
#ifdef __STDC__
- long double ynl(int n, long double x) /* wrapper ynl */
+ long double __ynl(int n, long double x) /* wrapper ynl */
#else
- long double ynl(n,x) /* wrapper ynl */
+ long double __ynl(n,x) /* wrapper ynl */
long double x; int n;
#endif
{
@@ -94,3 +95,4 @@ static char rcsid[] = "$NetBSD: $";
return z;
#endif
}
+weak_alias (__ynl, ynl)