aboutsummaryrefslogtreecommitdiff
path: root/math
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1998-08-31 16:30:27 +0000
committerUlrich Drepper <drepper@redhat.com>1998-08-31 16:30:27 +0000
commitbfce746a87e205a682b85e144e056029a8a30d07 (patch)
tree081313643ad086d15559161dc218d203b62f605d /math
parentac72fbb190675473855c33d79ccd75b0de68c0d1 (diff)
downloadglibc-bfce746a87e205a682b85e144e056029a8a30d07.zip
glibc-bfce746a87e205a682b85e144e056029a8a30d07.tar.gz
glibc-bfce746a87e205a682b85e144e056029a8a30d07.tar.bz2
Update.
1998-08-31 15:56 Ulrich Drepper <drepper@cygnus.com> * db2/db_int.h: Use <db.h> instead of "db.h" to find header in include. * include/stdio.h: Add __vsscanf. * libio/stdio.h: Make vfscanf, scanf, and vsscanf available if __USE_ISOC9X. Remove __vsscanf declaration. Always declare fgetpos and fsetpos. * math/math.h: Define isinf as macro. * math/bits/mathcalls.h: Change to declare __isinf all the time. Don't declare scalb for ISO C 9x. * math/tgmath.h: Define fma. Rewrite the underlying macros. * stdlib/stdlib.h: Declare strtof and strtold is __USE_ISOC9X. * sysdeps/unix/sysv/linux/bits/sigcontext.h: Allow inclusion from sys/ucontext.h. * sysdeps/wordsize-32/inttypes.h: Define missing PRI* and SCN* macros. 1998-08-31 Andreas Jaeger <aj@arthur.rhein-neckar.de> * sysdeps/standalone/bits/errno.h (ENOMSG): Remove duplicate. Reported by jreising@frequentis.com [PR libc/767]. 1998-08-31 Andreas Jaeger <aj@arthur.rhein-neckar.de> * io/lockf.c (lockf): Move initilisation of fl.l_whence and fl.l_start at beginning of function. Patch by Geoff. Dash <geoffd@zeta.org.au> [PR libc/769].
Diffstat (limited to 'math')
-rw-r--r--math/bits/mathcalls.h12
-rw-r--r--math/math.h7
-rw-r--r--math/tgmath.h92
3 files changed, 71 insertions, 40 deletions
diff --git a/math/bits/mathcalls.h b/math/bits/mathcalls.h
index a94707f..d23a013 100644
--- a/math/bits/mathcalls.h
+++ b/math/bits/mathcalls.h
@@ -171,10 +171,14 @@ __MATHCALL (floor,, (_Mdouble_ __x));
__MATHCALL (fmod,, (_Mdouble_ __x, _Mdouble_ __y));
+/* Return 0 if VALUE is finite or NaN, +1 if it
+ is +Infinity, -1 if it is -Infinity. */
+__MATHDECL_1 (int,__isinf,, (_Mdouble_ __value)) __attribute__ ((__const__));
+
#ifdef __USE_MISC
/* Return 0 if VALUE is finite or NaN, +1 if it
is +Infinity, -1 if it is -Infinity. */
-__MATHDECLX (int,isinf,, (_Mdouble_ __value), (__const__));
+__MATHDECL_1 (int,isinf,, (_Mdouble_ __value)) __attribute__ ((__const__));
/* Return nonzero if VALUE is finite and not NaN. */
__MATHDECLX (int,finite,, (_Mdouble_ __value), (__const__));
@@ -248,15 +252,17 @@ __MATHCALL (rint,, (_Mdouble_ __x));
/* Return X + epsilon if X < Y, X - epsilon if X > Y. */
__MATHCALLX (nextafter,, (_Mdouble_ __x, _Mdouble_ __y), (__const__));
-#ifdef __USE_ISOC9X
+# ifdef __USE_ISOC9X
__MATHCALLX (nextafterx,, (_Mdouble_ __x, long double __y), (__const__));
-#endif
+# endif
/* Return the remainder of integer divison X / Y with infinite precision. */
__MATHCALL (remainder,, (_Mdouble_ __x, _Mdouble_ __y));
+#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED
/* Return X times (2 to the Nth power). */
__MATHCALL (scalb,, (_Mdouble_ __x, _Mdouble_ __n));
+#endif
/* Return X times (2 to the Nth power). */
__MATHCALL (scalbn,, (_Mdouble_ __x, int __n));
diff --git a/math/math.h b/math/math.h
index 5381f29..d7487dd 100644
--- a/math/math.h
+++ b/math/math.h
@@ -196,6 +196,13 @@ enum
: sizeof (x) == sizeof (double) ? \
__isnan (x) : __isnanl (x))
+/* Return nonzero value is X is positive or negative infinity. */
+# define isinf(x) \
+ (sizeof (x) == sizeof (float) ? \
+ __isinff (x) \
+ : sizeof (x) == sizeof (double) ? \
+ __isinf (x) : __isinfl (x))
+
#endif /* Use ISO C 9X. */
#ifdef __USE_MISC
diff --git a/math/tgmath.h b/math/tgmath.h
index 5880e66..307a124 100644
--- a/math/tgmath.h
+++ b/math/tgmath.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 1998 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
@@ -40,70 +40,83 @@
only defined on real valued parameters and those which are defined
for complex functions as well. */
# define __TGMATH_UNARY_REAL_ONLY(Val, Fct) \
- (__extension__ (sizeof (__real__ (Val)) == sizeof (double) \
+ (__extension__ (sizeof (Val) == sizeof (double) \
? Fct (Val) \
- : (sizeof (__real__ (Val)) == sizeof (long double) \
+ : (sizeof (Val) == sizeof (long double) \
? Fct##l (Val) \
: Fct##f (Val))))
# define __TGMATH_BINARY_FIRST_REAL_ONLY(Val1, Val2, Fct) \
- (__extension__ (sizeof (__real__ (Val1)) == sizeof (double) \
- ? Fct (Val1, Val2) \
- : (sizeof (__real__ (Val1)) == sizeof (long double) \
- ? Fct##l (Val1, Val2) \
+ (__extension__ (sizeof (Val1) > sizeof (double) \
+ ? Fct##l (Val1, Val2) \
+ : (sizeof (Val1) == sizeof (double) \
+ ? Fct (Val1, Val2) \
: Fct##f (Val1, Val2))))
# define __TGMATH_BINARY_REAL_ONLY(Val1, Val2, Fct) \
- (__extension__ (sizeof (Val1) == sizeof (double) \
- || sizeof (Val2) == sizeof (double) \
- ? Fct (Val1, Val2) \
- : (sizeof (Val1) == sizeof (long double) \
- || sizeof (Val2) == sizeof (long double) \
- ? Fct##l (Val1, Val2) \
+ (__extension__ (sizeof (Val1) > sizeof (double) \
+ || sizeof (Val2) > sizeof (double) \
+ ? Fct##l (Val1, Val2) \
+ : (sizeof (Val1) == sizeof (double) \
+ || sizeof (Val2) == sizeof (double) \
+ ? Fct (Val1, Val2) \
: Fct##f (Val1, Val2))))
# define __TGMATH_TERNARY_FIRST_SECOND_REAL_ONLY(Val1, Val2, Val3, Fct) \
- (__extension__ (sizeof (Val1) == sizeof (double) \
- || sizeof (Val2) == sizeof (double) \
- ? Fct (Val1, Val2, Val3) \
- : (sizeof (Val1) == sizeof (long double) \
- || sizeof (Val2) == sizeof (long double) \
- ? Fct##l (Val1, Val2, Val3) \
+ (__extension__ (sizeof (Val1) > sizeof (double) \
+ || sizeof (Val2) > sizeof (double) \
+ ? Fct##l (Val1, Val2, Val3) \
+ : (sizeof (Val1) == sizeof (double) \
+ || sizeof (Val2) == sizeof (double) \
+ ? Fct (Val1, Val2, Val3) \
+ : Fct##f (Val1, Val2, Val3))))
+
+# define __TGMATH_TERNARY_REAL_ONLY(Val1, Val2, Val3, Fct) \
+ (__extension__ (sizeof (Val1) > sizeof (double) \
+ || sizeof (Val2) > sizeof (double) \
+ || sizeof (Val3) > sizeof (double) \
+ ? Fct##l (Val1, Val2, Val3) \
+ : (sizeof (Val1) == sizeof (double) \
+ || sizeof (Val2) == sizeof (double) \
+ || sizeof (Val3) == sizeof (double) \
+ ? Fct (Val1, Val2, Val3) \
: Fct##f (Val1, Val2, Val3))))
# define __TGMATH_UNARY_REAL_IMAG(Val, Fct, Cfct) \
- (__extension__ (sizeof (__real__ (Val)) == sizeof (double) \
+ (__extension__ (sizeof (__real__ (val)) > sizeof (double) \
? (sizeof (__real__ (Val)) == sizeof (Val) \
- ? Fct (Val) \
- : Cfct (Val)) \
- : (sizeof (__real__ (Val)) == sizeof (long double) \
+ ? Fct##l (Val) \
+ : Cfct##l (Val)) \
+ : (sizeof (__real__ (val)) == sizeof (double) \
? (sizeof (__real__ (Val)) == sizeof (Val) \
- ? Fct##l (Val) \
- : Cfct##l (Val)) \
+ ? Fct (Val) \
+ : Cfct (Val)) \
: (sizeof (__real__ (Val)) == sizeof (Val) \
? Fct##f (Val) \
: Cfct##f (Val)))))
+/* XXX This definition has to be changed as soon as the compiler understands
+ the imaginary keyword. */
# define __TGMATH_UNARY_IMAG_ONLY(Val, Fct) \
- (__extension__ (sizeof (Val) == sizeof (__complex__ double) \
- ? Fct (Val) \
- : (sizeof (Val) == sizeof (__complex__ long double) \
- ? Fct##l (Val) \
+ (__extension__ (sizeof (Val) > sizeof (__complex__ double) \
+ ? Fct##l (Val) \
+ : (sizeof (Val) == sizeof (__complex__ double) \
+ ? Fct (Val) \
: Fct##f (Val))))
# define __TGMATH_BINARY_REAL_IMAG(Val1, Val2, Fct, Cfct) \
- (__extension__ (sizeof (__real__ (Val1)) == sizeof (double) \
- || sizeof (__real__ (Val2)) == sizeof (double) \
+ (__extension__ (sizeof (__real__ (Val1)) > sizeof (double) \
+ || sizeof (__real__ (Val2)) > sizeof (double) \
? (sizeof (__real__ (Val1)) == sizeof (Val1) \
&& sizeof (__real__ (Val2)) == sizeof (Val2) \
- ? Fct (Val1, Val2) \
- : Cfct (Val1, Val2)) \
- : (sizeof (__real__ (Val1)) == sizeof (long double) \
- || sizeof (__real__ (Val2)) == sizeof (long double) \
+ ? Fct##l (Val1, Val2) \
+ : Cfct##l (Val1, Val2)) \
+ : (sizeof (__real__ (Val1)) == sizeof (double) \
+ || sizeof (__real__ (Val2)) == sizeof (double) \
? (sizeof (__real__ (Val1)) == sizeof (Val1) \
&& sizeof (__real__ (Val2)) == sizeof (Val2) \
- ? Fct##l (Val1, Val2) \
- : Cfct##l (Val1, Val2)) \
+ ? Fct (Val1, Val2) \
+ : Cfct (Val1, Val2)) \
: (sizeof (__real__ (Val1)) == sizeof (Val1) \
&& sizeof (__real__ (Val2)) == sizeof (Val2) \
? Fct##f (Val1, Val2) \
@@ -293,6 +306,11 @@
#define fmin(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, fmin)
+/* Multiply-add function computed as a ternary operation. */
+#define fma(Vat1, Val2, Val3) \
+ __TGMATH_TERNARY_REAL_ONLY (Val1, Val2, Val3, fma)
+
+
/* Absolute value, conjugates, and projection. */
/* Argument value of Z. */