summaryrefslogtreecommitdiff
path: root/sysdeps
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1997-04-30 15:51:34 +0000
committerUlrich Drepper <drepper@redhat.com>1997-04-30 15:51:34 +0000
commit779ae82ecdf88b7ed7c1f00d3ed3a639671c3c8d (patch)
tree287afe5ef732d76109129a142c5840cc42a2b34a /sysdeps
parenta12ea214dbc999b98ab5ed4e53fb0089cf5e183a (diff)
downloadglibc-779ae82ecdf88b7ed7c1f00d3ed3a639671c3c8d.tar.gz
1997-04-30 17:35 Ulrich Drepper <drepper@cygnus.com> * math/libm-test.c: Implement test for exceptions. Partly due to Andreas Jaeger. (csin_test): New function. * sysdeps/libm-i387/s_cexp.S: Raise correct exceptions. * sysdeps/libm-i387/s_cexpf.S: Likewise. * sysdeps/libm-i387/s_cexpl.S: Likewise. * sysdeps/libm-ieee754/s_ccos.c: Likewise. * sysdeps/libm-ieee754/s_ccosf.c: Likewise. * sysdeps/libm-ieee754/s_ccosl.c: Likewise. * sysdeps/libm-ieee754/s_ccosh.c: Likewise. * sysdeps/libm-ieee754/s_ccoshf.c: Likewise. * sysdeps/libm-ieee754/s_ccoshl.c: Likewise. * sysdeps/libm-ieee754/s_cexp.c: Likewise. * sysdeps/libm-ieee754/s_cexpf.c: Likewise. * sysdeps/libm-ieee754/s_cexpl.c: Likewise. * sysdeps/libm-ieee754/s_csinh.c: Likewise. * sysdeps/libm-ieee754/s_csinhf.c: Likewise. * sysdeps/libm-ieee754/s_csinhl.c: Likewise. * sysdeps/libm-ieee754/s_ctanh.c: Likewise. * sysdeps/libm-ieee754/s_ctanhf.c: Likewise. * sysdeps/libm-ieee754/s_ctanhl.c: Likewise. * sysdeps/libm-ieee754/s_ccosh.c: Correct computation. * sysdeps/libm-ieee754/s_ccoshf.c: Likewise. * sysdeps/libm-ieee754/s_ccoshl.c: Likewise. * sysdeps/libm-ieee754/s_csinh.c: Likewise. * sysdeps/libm-ieee754/s_csinhf.c: Likewise. * sysdeps/libm-ieee754/s_csinhl.c: Likewise. * sysdeps/libm-ieee754/s_csin.c: Rewrite. * sysdeps/libm-ieee754/s_csinf.c: Likewise. * sysdeps/libm-ieee754/s_csinl.c: Likewise. * stdlib/random_r.c (__srandom_r): Don't use seed 0. Use 1 in this case. * sysdeps/i386/dl-machine.h (elf_machine_load_address): Use notation for local label. * time/strftime.c (add): Respect `0' padding flag. Reported by Richard Stallman <rms@gnu.ai.mit.edu>. 1997-04-30 15:46 Ulrich Drepper <drepper@cygnus.com> * Makeconfig (start-installed-name): Define here, not in csu/Makefile. Use in +link macro. * csu/Makefile (distribute): Add abi-note.S and abi-tag.h. (start-installed-name): Don't define here. When ELF generate file named by start-installed-name from start.o and abi-note.o. * csu/abi-note.S: New file. * sysdeps/stub/abi-tag.h: New file. * sysdpes/unix/sysv/linux/abi-tag.h: New file. Patches by Roland McGrath <roland@gnu.ai.mit.edu>. 1997-04-30 01:32 Ulrich Drepper <drepper@cygnus.com> * manual/stdio.texi: Use @vtable where possible. Add TeX version of @multitable since texi2dvi cannot handle them correct in the moment. * po/de.po: Update. 1997-04-29 21:06 Ulrich Drepper <drepper@cygnus.com> * Makeconfig: Don't set cross-compiling based on $(BUILD_CC) != $(CC). * config.make.in: Set cross-compiling from configure result. * configure.in: Emit definition of `cross_compiling'. Patches by Marcus G. Daniels <marcus@cathcart.sysc.pdx.edu>. 1997-04-27 21:50 Philip Blundell <pjb27@cam.ac.uk> * sysdeps/unix/sysv/linux/net/route.h (struct in6_rtmsg): Use correct `int' sizes for struct members. 1997-04-29 19:14 Ulrich Drepper <drepper@cygnus.com> * sysdeps/libm-i387/e_powf.S Generate invalid exception correctly. * sysdeps/libm-i387/e_pow.S: Likewise. * sysdeps/libm-i387/e_powl.S: Likewise. 1997-04-23 10:08 Andreas Jaeger <aj@arthur.rhein-neckar.de> * math/fenv.h: Correct typos. 1997-04-28 10:04 Richard Henderson <rth@tamu.edu> * sysdeps/unix/sysv/linux/alpha/clone.S: Save the function argument in t0 rather than a4 to avoid it being clobbered. 1997-04-27 23:52 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * manual/summary.awk: Recognize @defmumblex. * manual/signal.texi (Miscellaneous Signals): Use @deftypevrx for second description header. 1997-04-27 23:29 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * manual/arith.texi (Floating-Point Classes): Don't indent text, makeinfo doesn't like that. 1997-04-27 20:52 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * malloc/obstack.h (obstack_specify_allocation_with_arg, obstack_chunkfun, obstack_freefun): Fix casts. 1997-04-27 18:21 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * manual/xtract-typefun.awk: Allow names with only one character. 1997-04-26 14:16 Ulrich Drepper <drepper@cygnus.com> * sysdeps/unix/sysv/linux/netinet/ip_fw.h: Use <netinet/ip_icmp.h> not <netinet/icmp.h>. Reported by Michael Deutschmann <ldeutsch@mail.netshop.net>. 1997-04-25 12:31 Ulrich Drepper <drepper@cygnus.com> * csu/Makefile ($(objpfx)initfini.s): Add CPPFLAGS, CFLAGS and -g0 to command line of compiler. Patch by Marcus G. Daniels <marcus@sysc.pdx.edu>. * sysdeps/generic/sigset.h (__sigandset, __sigorset): Fix typos. Patch by Marcus G. Daniels <marcus@sysc.pdx.edu>. * signal/signal.h (_sys_siglist, sys_siglist): Use _NSIG, not NSIG in declaration. Patch by Michael Widenius <monty@tcx.se>. * time/strptime.c (strptime_internal): Fix %I format specifier being off by one. Patch by Mark Kettenis <kettenis@phys.uva.nl>. 1997-04-24 12:18 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * stdlib/lcong48_r.c: Include <limits.h>. * stdlib/seed48_r.c: Likewise. * stdio-common/printf_size.c (printf_size): Correct type of `units' and make robust against future changes. 1997-04-23 18:58 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * sysdeps/libm-ieee754/s_cproj.c: Use isfinite instead of finite. * sysdeps/libm-ieee754/s_cprojl.c: Likewise. * sysdeps/libm-ieee754/s_cprojf.c: Likewise. 1997-04-23 18:53 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * manual/arith.texi, manual/math.texi: Use @defmumblex for additional description headers. * manual/xtract-typefun.awk: Recognize them. 1997-04-22 15:58 Andreas Jaeger <aj@arthur.rhein-neckar.de> * stdio-common/printf_size.c (printf_size): Correct size of array units.
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/generic/sigset.h4
-rw-r--r--sysdeps/i386/dl-machine.h8
-rw-r--r--sysdeps/libm-i387/e_pow.S7
-rw-r--r--sysdeps/libm-i387/e_powf.S7
-rw-r--r--sysdeps/libm-i387/e_powl.S7
-rw-r--r--sysdeps/libm-i387/s_cexp.S22
-rw-r--r--sysdeps/libm-i387/s_cexpf.S22
-rw-r--r--sysdeps/libm-i387/s_cexpl.S22
-rw-r--r--sysdeps/libm-ieee754/s_ccos.c16
-rw-r--r--sysdeps/libm-ieee754/s_ccosf.c16
-rw-r--r--sysdeps/libm-ieee754/s_ccosh.c14
-rw-r--r--sysdeps/libm-ieee754/s_ccoshf.c16
-rw-r--r--sysdeps/libm-ieee754/s_ccoshl.c14
-rw-r--r--sysdeps/libm-ieee754/s_ccosl.c16
-rw-r--r--sysdeps/libm-ieee754/s_cexpf.c15
-rw-r--r--sysdeps/libm-ieee754/s_cexpl.c15
-rw-r--r--sysdeps/libm-ieee754/s_cproj.c2
-rw-r--r--sysdeps/libm-ieee754/s_cprojf.c2
-rw-r--r--sysdeps/libm-ieee754/s_cprojl.c2
-rw-r--r--sysdeps/libm-ieee754/s_csin.c104
-rw-r--r--sysdeps/libm-ieee754/s_csinf.c104
-rw-r--r--sysdeps/libm-ieee754/s_csinh.c18
-rw-r--r--sysdeps/libm-ieee754/s_csinhf.c18
-rw-r--r--sysdeps/libm-ieee754/s_csinhl.c17
-rw-r--r--sysdeps/libm-ieee754/s_csinl.c104
-rw-r--r--sysdeps/libm-ieee754/s_ctanh.c6
-rw-r--r--sysdeps/libm-ieee754/s_ctanhf.c6
-rw-r--r--sysdeps/libm-ieee754/s_ctanhl.c6
-rw-r--r--sysdeps/stub/abi-tag.h3
-rw-r--r--sysdeps/unix/sysv/linux/abi-tag.h16
-rw-r--r--sysdeps/unix/sysv/linux/alpha/clone.S4
-rw-r--r--sysdeps/unix/sysv/linux/net/route.h10
-rw-r--r--sysdeps/unix/sysv/linux/netinet/ip_fw.h10
33 files changed, 532 insertions, 121 deletions
diff --git a/sysdeps/generic/sigset.h b/sysdeps/generic/sigset.h
index 6f4ea0e5a8..9fad4538d7 100644
--- a/sysdeps/generic/sigset.h
+++ b/sysdeps/generic/sigset.h
@@ -51,9 +51,9 @@ typedef unsigned long int __sigset_t;
#ifdef _GNU_SOURCE
# define __sigisemptyset(set) (*(set) == (__sigset_t) 0)
# define __sigandset(dest, left, right) \
- ((*(set) = (*(left) & *(right))), 0)
+ ((*(dest) = (*(left) & *(right))), 0)
# define __sigorset(dest, left, right) \
- ((*(set) = (*(left) | *(right))), 0)
+ ((*(dest) = (*(left) | *(right))), 0)
#endif
/* These functions needn't check for a bogus signal number -- error
diff --git a/sysdeps/i386/dl-machine.h b/sysdeps/i386/dl-machine.h
index f6b28444a3..7b3336588d 100644
--- a/sysdeps/i386/dl-machine.h
+++ b/sysdeps/i386/dl-machine.h
@@ -55,14 +55,14 @@ static inline Elf32_Addr __attribute__ ((unused))
elf_machine_load_address (void)
{
Elf32_Addr addr;
- asm (" call here\n"
- "here: popl %0\n"
- " subl $here, %0"
+ asm (" call .Lhere\n"
+ ".Lhere: popl %0\n"
+ " subl $.Lhere, %0"
: "=r" (addr));
return addr;
}
/* The `subl' insn above will contain an R_386_32 relocation entry
- intended to insert the run-time address of the label `here'.
+ intended to insert the run-time address of the label `.Lhere'.
This will be the first relocation in the text of the dynamic linker;
we skip it to avoid trying to modify read-only text in this early stage. */
#define ELF_MACHINE_BEFORE_RTLD_RELOC(dynamic_info) \
diff --git a/sysdeps/libm-i387/e_pow.S b/sysdeps/libm-i387/e_pow.S
index e665326438..45c41b48ab 100644
--- a/sysdeps/libm-i387/e_pow.S
+++ b/sysdeps/libm-i387/e_pow.S
@@ -48,9 +48,6 @@ one: .double 1.0
ASM_TYPE_DIRECTIVE(limit,@object)
limit: .double 0.29
ASM_SIZE_DIRECTIVE(limit)
- ASM_TYPE_DIRECTIVE(nan,@object)
-nan: .byte 0, 0, 0, 0, 0, 0, 0xff, 0x7f
- ASM_SIZE_DIRECTIVE(nan)
#ifdef PIC
#define MO(op) op##@GOTOFF(%ecx)
@@ -191,8 +188,8 @@ ENTRY(__ieee754_pow)
ret
.align ALIGNARG(4)
-14: fldl MO(nan)
- faddl MO(zero) // raise invalid exception
+14: fldl MO(infinity)
+ fmull MO(zero) // raise invalid exception
ret
.align ALIGNARG(4)
diff --git a/sysdeps/libm-i387/e_powf.S b/sysdeps/libm-i387/e_powf.S
index 102cd4e3af..d7342bf56f 100644
--- a/sysdeps/libm-i387/e_powf.S
+++ b/sysdeps/libm-i387/e_powf.S
@@ -48,9 +48,6 @@ one: .double 1.0
ASM_TYPE_DIRECTIVE(limit,@object)
limit: .double 0.29
ASM_SIZE_DIRECTIVE(limit)
- ASM_TYPE_DIRECTIVE(nan,@object)
-nan: .byte 0, 0, 0, 0, 0, 0, 0xff, 0x7f
- ASM_SIZE_DIRECTIVE(nan)
#ifdef PIC
#define MO(op) op##@GOTOFF(%ecx)
@@ -187,8 +184,8 @@ ENTRY(__ieee754_powf)
ret
.align ALIGNARG(4)
-14: fldl MO(nan)
- faddl MO(zero) // raise invalid exception
+14: fldl MO(infinity)
+ fmull MO(zero) // raise invalid exception
ret
.align ALIGNARG(4)
diff --git a/sysdeps/libm-i387/e_powl.S b/sysdeps/libm-i387/e_powl.S
index dba725aa77..0ea4829822 100644
--- a/sysdeps/libm-i387/e_powl.S
+++ b/sysdeps/libm-i387/e_powl.S
@@ -48,9 +48,6 @@ one: .double 1.0
ASM_TYPE_DIRECTIVE(limit,@object)
limit: .double 0.29
ASM_SIZE_DIRECTIVE(limit)
- ASM_TYPE_DIRECTIVE(nan,@object)
-nan: .byte 0, 0, 0, 0, 0, 0, 0xff, 0x7f
- ASM_SIZE_DIRECTIVE(nan)
#ifdef PIC
#define MO(op) op##@GOTOFF(%ecx)
@@ -191,8 +188,8 @@ ENTRY(__ieee754_powl)
ret
.align ALIGNARG(4)
-14: fldl MO(nan)
- faddl MO(zero) // raise invalid exception
+14: fldl MO(infinity)
+ fmull MO(zero) // raise invalid exception
ret
.align ALIGNARG(4)
diff --git a/sysdeps/libm-i387/s_cexp.S b/sysdeps/libm-i387/s_cexp.S
index 48e002b2f6..5630d3cb65 100644
--- a/sysdeps/libm-i387/s_cexp.S
+++ b/sysdeps/libm-i387/s_cexp.S
@@ -31,7 +31,8 @@ huge_nan_null_null:
.byte 0, 0, 0, 0, 0, 0, 0xf0, 0x7f
.byte 0, 0, 0, 0, 0, 0, 0xff, 0x7f
.double 0.0
- .double 0.0
+zero: .double 0.0
+infinity:
.byte 0, 0, 0, 0, 0, 0, 0xf0, 0x7f
.byte 0, 0, 0, 0, 0, 0, 0xff, 0x7f
.double 0.0
@@ -90,7 +91,7 @@ ENTRY(__cexp)
Check your FPU manual for more information. */
andb $0x01, %ah
cmpb $0x01, %ah
- je 2f
+ je 20f
/* We have finite numbers in the real and imaginary part. Do
the real work now. */
@@ -139,9 +140,8 @@ ENTRY(__cexp)
1: fxam /* y : x */
fnstsw
movb %ah, %dl
- andb $0x01, %ah /* See above why 0x01 is usable here. */
- cmpb $0x01, %ah
- je 3f
+ testb $0x01, %ah /* See above why 0x01 is usable here. */
+ jne 3f
/* The real part is +-Inf and the imaginary part is finite. */
@@ -220,7 +220,14 @@ ENTRY(__cexp)
.align ALIGNARG(4)
3: fstp %st(0)
fstp %st(0) /* <empty> */
- movl %edx, %eax
+ andb $0x45, %ah
+ andb $0x47, %dh
+ xorb %dh, %ah
+ jnz 30f
+ fldl MO(infinity) /* Raise invalid exception. */
+ fmull MO(zero)
+ fstp %st(0)
+30: movl %edx, %eax
shrl $5, %edx
shll $4, %eax
andl $16, %edx
@@ -236,6 +243,9 @@ ENTRY(__cexp)
/* The real part is NaN. */
.align ALIGNARG(4)
+20: fldl MO(infinity) /* Raise invalid exception. */
+ fmull MO(zero)
+ fstp %st(0)
2: fstp %st(0)
fstp %st(0)
movl 4(%esp), %eax /* Pointer to memory for result. */
diff --git a/sysdeps/libm-i387/s_cexpf.S b/sysdeps/libm-i387/s_cexpf.S
index 6fd414b045..d6dcebcb23 100644
--- a/sysdeps/libm-i387/s_cexpf.S
+++ b/sysdeps/libm-i387/s_cexpf.S
@@ -31,7 +31,8 @@ huge_nan_null_null:
.byte 0, 0, 0x80, 0x7f
.byte 0, 0, 0xc0, 0x7f
.float 0.0
- .float 0.0
+zero: .float 0.0
+infinity:
.byte 0, 0, 0x80, 0x7f
.byte 0, 0, 0xc0, 0x7f
.float 0.0
@@ -90,7 +91,7 @@ ENTRY(__cexpf)
Check your FPU manual for more information. */
andb $0x01, %ah
cmpb $0x01, %ah
- je 2f
+ je 20f
/* We have finite numbers in the real and imaginary part. Do
the real work now. */
@@ -143,9 +144,8 @@ ENTRY(__cexpf)
1: fxam /* y : x */
fnstsw
movb %ah, %dl
- andb $0x01, %ah /* See above why 0x01 is usable here. */
- cmpb $0x01, %ah
- je 3f
+ testb $0x01, %ah /* See above why 0x01 is usable here. */
+ jne 3f
/* The real part is +-Inf and the imaginary part is finite. */
@@ -222,7 +222,14 @@ ENTRY(__cexpf)
.align ALIGNARG(4)
3: fstp %st(0)
fstp %st(0) /* <empty> */
- movl %edx, %eax
+ andb $0x45, %ah
+ andb $0x47, %dh
+ xorb %dh, %ah
+ jnz 30f
+ flds MO(infinity) /* Raise invalid exception. */
+ fmuls MO(zero)
+ fstp %st(0)
+30: movl %edx, %eax
shrl $6, %edx
shll $3, %eax
andl $8, %edx
@@ -235,6 +242,9 @@ ENTRY(__cexpf)
/* The real part is NaN. */
.align ALIGNARG(4)
+20: flds MO(infinity) /* Raise invalid exception. */
+ fmuls MO(zero)
+ fstp %st(0)
2: fstp %st(0)
fstp %st(0)
movl MO(huge_nan_null_null+4), %eax
diff --git a/sysdeps/libm-i387/s_cexpl.S b/sysdeps/libm-i387/s_cexpl.S
index fa31e74162..11c05c52e6 100644
--- a/sysdeps/libm-i387/s_cexpl.S
+++ b/sysdeps/libm-i387/s_cexpl.S
@@ -31,7 +31,8 @@ huge_nan_null_null:
.byte 0, 0, 0, 0, 0, 0, 0xf0, 0x7f
.byte 0, 0, 0, 0, 0, 0, 0xff, 0x7f
.double 0.0
- .double 0.0
+zero: .double 0.0
+infinity:
.byte 0, 0, 0, 0, 0, 0, 0xf0, 0x7f
.byte 0, 0, 0, 0, 0, 0, 0xff, 0x7f
.double 0.0
@@ -90,7 +91,7 @@ ENTRY(__cexpl)
Check your FPU manual for more information. */
andb $0x01, %ah
cmpb $0x01, %ah
- je 2f
+ je 20f
/* We have finite numbers in the real and imaginary part. Do
the real work now. */
@@ -139,9 +140,8 @@ ENTRY(__cexpl)
1: fxam /* y : x */
fnstsw
movb %ah, %dl
- andb $0x01, %ah /* See above why 0x01 is usable here. */
- cmpb $0x01, %ah
- je 3f
+ testb $0x01, %ah /* See above why 0x01 is usable here. */
+ jne 3f
/* The real part is +-Inf and the imaginary part is finite. */
@@ -220,7 +220,14 @@ ENTRY(__cexpl)
.align ALIGNARG(4)
3: fstp %st(0)
fstp %st(0) /* <empty> */
- movl %edx, %eax
+ andb $0x45, %ah
+ andb $0x47, %dh
+ xorb %dh, %ah
+ jnz 30f
+ fldl MO(infinity) /* Raise invalid exception. */
+ fmull MO(zero)
+ fstp %st(0)
+30: movl %edx, %eax
shrl $5, %edx
shll $4, %eax
andl $16, %edx
@@ -236,6 +243,9 @@ ENTRY(__cexpl)
/* The real part is NaN. */
.align ALIGNARG(4)
+20: fldl MO(infinity) /* Raise invalid exception. */
+ fmull MO(zero)
+ fstp %st(0)
2: fstp %st(0)
fstp %st(0)
movl 4(%esp), %eax /* Pointer to memory for result. */
diff --git a/sysdeps/libm-ieee754/s_ccos.c b/sysdeps/libm-ieee754/s_ccos.c
index 8a4b55dd99..f8dfcc8af6 100644
--- a/sysdeps/libm-ieee754/s_ccos.c
+++ b/sysdeps/libm-ieee754/s_ccos.c
@@ -19,6 +19,7 @@
Boston, MA 02111-1307, USA. */
#include <complex.h>
+#include <fenv.h>
#include <math.h>
@@ -33,16 +34,31 @@ __ccos (__complex__ double x)
{
__real__ res = __nan ("");
__imag__ res = 0.0;
+
+#ifdef FE_INVALID
+ if (__isinf (__real__ x))
+ feraiseexcept (FE_INVALID);
+#endif
}
else if (__isinf (__imag__ x))
{
__real__ res = HUGE_VAL;
__imag__ res = __nan ("");
+
+#ifdef FE_INVALID
+ if (__isinf (__real__ x))
+ feraiseexcept (FE_INVALID);
+#endif
}
else
{
__real__ res = __nan ("");
__imag__ res = __nan ("");
+
+#ifdef FE_INVALID
+ if (isfinite (__imag__ x))
+ feraiseexcept (FE_INVALID);
+#endif
}
}
else
diff --git a/sysdeps/libm-ieee754/s_ccosf.c b/sysdeps/libm-ieee754/s_ccosf.c
index 9d1a97239c..b090ae5747 100644
--- a/sysdeps/libm-ieee754/s_ccosf.c
+++ b/sysdeps/libm-ieee754/s_ccosf.c
@@ -19,6 +19,7 @@
Boston, MA 02111-1307, USA. */
#include <complex.h>
+#include <fenv.h>
#include <math.h>
@@ -33,16 +34,31 @@ __ccosf (__complex__ float x)
{
__real__ res = __nanf ("");
__imag__ res = 0.0;
+
+#ifdef FE_INVALID
+ if (__isinff (__real__ x))
+ feraiseexcept (FE_INVALID);
+#endif
}
else if (__isinff (__imag__ x))
{
__real__ res = HUGE_VALF;
__imag__ res = __nanf ("");
+
+#ifdef FE_INVALID
+ if (__isinff (__real__ x))
+ feraiseexcept (FE_INVALID);
+#endif
}
else
{
__real__ res = __nanf ("");
__imag__ res = __nanf ("");
+
+#ifdef FE_INVALID
+ if (isfinite (__imag__ x))
+ feraiseexcept (FE_INVALID);
+#endif
}
}
else
diff --git a/sysdeps/libm-ieee754/s_ccosh.c b/sysdeps/libm-ieee754/s_ccosh.c
index fa958f491b..1e92f03771 100644
--- a/sysdeps/libm-ieee754/s_ccosh.c
+++ b/sysdeps/libm-ieee754/s_ccosh.c
@@ -19,6 +19,7 @@
Boston, MA 02111-1307, USA. */
#include <complex.h>
+#include <fenv.h>
#include <math.h>
#include "math_private.h"
@@ -39,18 +40,24 @@ __ccosh (__complex__ double x)
if (icls >= FP_ZERO)
{
/* Imaginary part is finite. */
+ double sinh_val = __ieee754_sinh (__real__ x);
double cosh_val = __ieee754_cosh (__real__ x);
double sinix, cosix;
__sincos (__imag__ x, &sinix, &cosix);
__real__ retval = cosh_val * cosix;
- __imag__ retval = cosh_val * sinix;
+ __imag__ retval = sinh_val * sinix;
}
else
{
__imag__ retval = __real__ x == 0.0 ? 0.0 : __nan ("");
__real__ retval = __nan ("") + __nan ("");
+
+#ifdef FE_INVALID
+ if (icls == FP_INFINITE)
+ feraiseexcept (FE_INVALID);
+#endif
}
}
else if (rcls == FP_INFINITE)
@@ -77,6 +84,11 @@ __ccosh (__complex__ double x)
/* The addition raises the invalid exception. */
__real__ retval = HUGE_VAL;
__imag__ retval = __nan ("") + __nan ("");
+
+#ifdef FE_INVALID
+ if (icls == FP_INFINITE)
+ feraiseexcept (FE_INVALID);
+#endif
}
}
else
diff --git a/sysdeps/libm-ieee754/s_ccoshf.c b/sysdeps/libm-ieee754/s_ccoshf.c
index aeeacbaed0..573a63367b 100644
--- a/sysdeps/libm-ieee754/s_ccoshf.c
+++ b/sysdeps/libm-ieee754/s_ccoshf.c
@@ -19,6 +19,7 @@
Boston, MA 02111-1307, USA. */
#include <complex.h>
+#include <fenv.h>
#include <math.h>
#include "math_private.h"
@@ -39,18 +40,24 @@ __ccoshf (__complex__ float x)
if (icls >= FP_ZERO)
{
/* Imaginary part is finite. */
+ float sinh_val = __ieee754_sinhf (__real__ x);
float cosh_val = __ieee754_coshf (__real__ x);
float sinix, cosix;
__sincosf (__imag__ x, &sinix, &cosix);
__real__ retval = cosh_val * cosix;
- __imag__ retval = cosh_val * sinix;
+ __imag__ retval = sinh_val * sinix;
}
else
{
__imag__ retval = __real__ x == 0.0 ? 0.0 : __nanf ("");
- __real__ retval = __nanf ("") + __nanf ("");
+ __real__ retval = __nanf ("");
+
+#ifdef FE_INVALID
+ if (icls == FP_INFINITE)
+ feraiseexcept (FE_INVALID);
+#endif
}
}
else if (rcls == FP_INFINITE)
@@ -77,6 +84,11 @@ __ccoshf (__complex__ float x)
/* The addition raises the invalid exception. */
__real__ retval = HUGE_VALF;
__imag__ retval = __nanf ("") + __nanf ("");
+
+#ifdef FE_INVALID
+ if (icls == FP_INFINITE)
+ feraiseexcept (FE_INVALID);
+#endif
}
}
else
diff --git a/sysdeps/libm-ieee754/s_ccoshl.c b/sysdeps/libm-ieee754/s_ccoshl.c
index 9937ba1904..feb1351917 100644
--- a/sysdeps/libm-ieee754/s_ccoshl.c
+++ b/sysdeps/libm-ieee754/s_ccoshl.c
@@ -19,6 +19,7 @@
Boston, MA 02111-1307, USA. */
#include <complex.h>
+#include <fenv.h>
#include <math.h>
#include "math_private.h"
@@ -39,18 +40,24 @@ __ccoshl (__complex__ long double x)
if (icls >= FP_ZERO)
{
/* Imaginary part is finite. */
+ long double sinh_val = __ieee754_sinhl (__real__ x);
long double cosh_val = __ieee754_coshl (__real__ x);
long double sinix, cosix;
__sincosl (__imag__ x, &sinix, &cosix);
__real__ retval = cosh_val * cosix;
- __imag__ retval = cosh_val * sinix;
+ __imag__ retval = sinh_val * sinix;
}
else
{
__imag__ retval = __real__ x == 0.0 ? 0.0 : __nanl ("");
__real__ retval = __nanl ("") + __nanl ("");
+
+#ifdef FE_INVALID
+ if (icls == FP_INFINITE)
+ feraiseexcept (FE_INVALID);
+#endif
}
}
else if (rcls == FP_INFINITE)
@@ -77,6 +84,11 @@ __ccoshl (__complex__ long double x)
/* The addition raises the invalid exception. */
__real__ retval = HUGE_VALL;
__imag__ retval = __nanl ("") + __nanl ("");
+
+#ifdef FE_INVALID
+ if (icls == FP_INFINITE)
+ feraiseexcept (FE_INVALID);
+#endif
}
}
else
diff --git a/sysdeps/libm-ieee754/s_ccosl.c b/sysdeps/libm-ieee754/s_ccosl.c
index a41d48b970..fdcc7a63dd 100644
--- a/sysdeps/libm-ieee754/s_ccosl.c
+++ b/sysdeps/libm-ieee754/s_ccosl.c
@@ -19,6 +19,7 @@
Boston, MA 02111-1307, USA. */
#include <complex.h>
+#include <fenv.h>
#include <math.h>
@@ -33,16 +34,31 @@ __ccosl (__complex__ long double x)
{
__real__ res = __nanl ("");
__imag__ res = 0.0;
+
+#ifdef FE_INVALID
+ if (__isinfl (__real__ x))
+ feraiseexcept (FE_INVALID);
+#endif
}
else if (__isinfl (__imag__ x))
{
__real__ res = HUGE_VALL;
__imag__ res = __nanl ("");
+
+#ifdef FE_INVALID
+ if (__isinfl (__real__ x))
+ feraiseexcept (FE_INVALID);
+#endif
}
else
{
__real__ res = __nanl ("");
__imag__ res = __nanl ("");
+
+#ifdef FE_INVALID
+ if (isfinite (__imag__ x))
+ feraiseexcept (FE_INVALID);
+#endif
}
}
else
diff --git a/sysdeps/libm-ieee754/s_cexpf.c b/sysdeps/libm-ieee754/s_cexpf.c
index 99f33dc873..603e78d716 100644
--- a/sysdeps/libm-ieee754/s_cexpf.c
+++ b/sysdeps/libm-ieee754/s_cexpf.c
@@ -19,6 +19,7 @@
Boston, MA 02111-1307, USA. */
#include <complex.h>
+#include <fenv.h>
#include <math.h>
#include "math_private.h"
@@ -59,6 +60,10 @@ __cexpf (__complex__ float x)
is not +-inf the result is NaN + iNaN. */
__real__ retval = __nanf ("");
__imag__ retval = __nanf ("");
+
+#ifdef FE_INVALID
+ feraiseexcept (FE_INVALID);
+#endif
}
}
else if (rcls == FP_INFINITE)
@@ -89,6 +94,11 @@ __cexpf (__complex__ float x)
{
__real__ retval = HUGE_VALF;
__imag__ retval = __nanf ("");
+
+#ifdef FE_INVALID
+ if (icls == FP_INFINITE)
+ feraiseexcept (FE_INVALID);
+#endif
}
else
{
@@ -101,6 +111,11 @@ __cexpf (__complex__ float x)
/* If the real part is NaN the result is NaN + iNaN. */
__real__ retval = __nanf ("");
__imag__ retval = __nanf ("");
+
+#ifdef FE_INVALID
+ if (rcls != FP_NAN || icls != FP_NAN)
+ feraiseexcept (FE_INVALID);
+#endif
}
return retval;
diff --git a/sysdeps/libm-ieee754/s_cexpl.c b/sysdeps/libm-ieee754/s_cexpl.c
index 1b97dba74d..67fa7a08b9 100644
--- a/sysdeps/libm-ieee754/s_cexpl.c
+++ b/sysdeps/libm-ieee754/s_cexpl.c
@@ -19,6 +19,7 @@
Boston, MA 02111-1307, USA. */
#include <complex.h>
+#include <fenv.h>
#include <math.h>
#include "math_private.h"
@@ -59,6 +60,10 @@ __cexpl (__complex__ long double x)
is not +-inf the result is NaN + iNaN. */
__real__ retval = __nanl ("");
__imag__ retval = __nanl ("");
+
+#ifdef FE_INVALID
+ feraiseexcept (FE_INVALID);
+#endif
}
}
else if (rcls == FP_INFINITE)
@@ -89,6 +94,11 @@ __cexpl (__complex__ long double x)
{
__real__ retval = HUGE_VALL;
__imag__ retval = __nanl ("");
+
+#ifdef FE_INVALID
+ if (icls == FP_INFINITE)
+ feraiseexcept (FE_INVALID);
+#endif
}
else
{
@@ -101,6 +111,11 @@ __cexpl (__complex__ long double x)
/* If the real part is NaN the result is NaN + iNaN. */
__real__ retval = __nanl ("");
__imag__ retval = __nanl ("");
+
+#ifdef FE_INVALID
+ if (rcls != FP_NAN || icls != FP_NAN)
+ feraiseexcept (FE_INVALID);
+#endif
}
return retval;
diff --git a/sysdeps/libm-ieee754/s_cproj.c b/sysdeps/libm-ieee754/s_cproj.c
index 8ad27c0e5b..fb50bb5a88 100644
--- a/sysdeps/libm-ieee754/s_cproj.c
+++ b/sysdeps/libm-ieee754/s_cproj.c
@@ -27,7 +27,7 @@ __cproj (__complex__ double x)
{
__complex__ double res;
- if (!finite (__real__ x) || !finite (__imag__ x))
+ if (!isfinite (__real__ x) || !isfinite (__imag__ x))
{
__real__ res = INFINITY;
__imag__ res = __copysign (0.0, __imag__ x);
diff --git a/sysdeps/libm-ieee754/s_cprojf.c b/sysdeps/libm-ieee754/s_cprojf.c
index 8ee61c727c..b90590835c 100644
--- a/sysdeps/libm-ieee754/s_cprojf.c
+++ b/sysdeps/libm-ieee754/s_cprojf.c
@@ -27,7 +27,7 @@ __cprojf (__complex__ float x)
{
__complex__ float res;
- if (!finite (__real__ x) || !finite (__imag__ x))
+ if (!isfinite (__real__ x) || !isfinite (__imag__ x))
{
__real__ res = INFINITY;
__imag__ res = __copysignf (0.0, __imag__ x);
diff --git a/sysdeps/libm-ieee754/s_cprojl.c b/sysdeps/libm-ieee754/s_cprojl.c
index 34298e1f25..13da4b417d 100644
--- a/sysdeps/libm-ieee754/s_cprojl.c
+++ b/sysdeps/libm-ieee754/s_cprojl.c
@@ -27,7 +27,7 @@ __cprojl (__complex__ long double x)
{
__complex__ long double res;
- if (!finite (__real__ x) || !finite (__imag__ x))
+ if (!isfinite (__real__ x) || !isfinite (__imag__ x))
{
__real__ res = INFINITY;
__imag__ res = __copysignl (0.0, __imag__ x);
diff --git a/sysdeps/libm-ieee754/s_csin.c b/sysdeps/libm-ieee754/s_csin.c
index 4639bcaaa6..6627387d42 100644
--- a/sysdeps/libm-ieee754/s_csin.c
+++ b/sysdeps/libm-ieee754/s_csin.c
@@ -19,46 +19,110 @@
Boston, MA 02111-1307, USA. */
#include <complex.h>
+#include <fenv.h>
#include <math.h>
+#include "math_private.h"
+
__complex__ double
__csin (__complex__ double x)
{
- __complex__ double res;
+ __complex__ double retval;
+ int negate = signbit (__real__ x);
+ int rcls = fpclassify (__real__ x);
+ int icls = fpclassify (__imag__ x);
+
+ __real__ x = fabs (__real__ x);
- if (!isfinite (__real__ x) || isnan (__imag__ x))
+ if (icls >= FP_ZERO)
{
- if (__real__ x == 0.0 || __imag__ x == 0.0)
- {
- __real__ res = __nan ("");
- __imag__ res = 0.0;
- }
- else if (__isinf (__imag__ x))
+ /* Imaginary part is finite. */
+ if (rcls >= FP_ZERO)
{
- __real__ res = __nan ("");
- __imag__ res = __imag__ x;
+ /* Real part is finite. */
+ double sinh_val = __ieee754_sinh (__imag__ x);
+ double cosh_val = __ieee754_cosh (__imag__ x);
+ double sinix, cosix;
+
+ __sincos (__real__ x, &sinix, &cosix);
+
+ __real__ retval = cosh_val * sinix;
+ __imag__ retval = sinh_val * cosix;
+
+ if (negate)
+ __real__ retval = -__real__ retval;
}
else
{
- __real__ res = __nan ("");
- __imag__ res = __nan ("");
+ if (icls == FP_ZERO)
+ {
+ /* Imaginary part is 0.0. */
+ __real__ retval = __nan ("");
+ __imag__ retval = __imag__ x;
+
+#ifdef FE_INVALID
+ if (rcls == FP_INFINITE)
+ feraiseexcept (FE_INVALID);
+#endif
+ }
+ else
+ {
+ __real__ retval = __nan ("");
+ __imag__ retval = __nan ("");
+
+#ifdef FE_INVALID
+ feraiseexcept (FE_INVALID);
+#endif
+ }
}
}
- else
+ else if (icls == FP_INFINITE)
{
- __complex__ double y;
+ /* Imaginary part is infinite. */
+ if (rcls == FP_ZERO)
+ {
+ /* Real part is 0.0. */
+ __real__ retval = __copysign (0.0, negate ? -1.0 : 1.0);
+ __imag__ retval = __imag__ x;
+ }
+ else if (rcls > FP_ZERO)
+ {
+ /* Real part is finite. */
+ double sinix, cosix;
+
+ __sincos (__real__ x, &sinix, &cosix);
- __real__ y = -__imag__ x;
- __imag__ y = __real__ x;
+ __real__ retval = __copysign (HUGE_VAL, sinix);
+ __imag__ retval = __copysign (HUGE_VAL, cosix);
- y = __csinh (y);
+ if (negate)
+ __real__ retval = -__real__ retval;
+ if (signbit (__imag__ x))
+ __imag__ retval = -__imag__ retval;
+ }
+ else
+ {
+ /* The addition raises the invalid exception. */
+ __real__ retval = __nan ("");
+ __imag__ retval = HUGE_VAL;
- __real__ res = __imag__ y;
- __imag__ res = -__real__ y;
+#ifdef FE_INVALID
+ if (rcls == FP_INFINITE)
+ feraiseexcept (FE_INVALID);
+#endif
+ }
+ }
+ else
+ {
+ if (rcls == FP_ZERO)
+ __real__ retval = __copysign (0.0, negate ? -1.0 : 1.0);
+ else
+ __real__ retval = __nan ("");
+ __imag__ retval = __nan ("");
}
- return res;
+ return retval;
}
weak_alias (__csin, csin)
#ifdef NO_LONG_DOUBLE
diff --git a/sysdeps/libm-ieee754/s_csinf.c b/sysdeps/libm-ieee754/s_csinf.c
index f7f10e6b6f..31d2f1fd54 100644
--- a/sysdeps/libm-ieee754/s_csinf.c
+++ b/sysdeps/libm-ieee754/s_csinf.c
@@ -19,45 +19,109 @@
Boston, MA 02111-1307, USA. */
#include <complex.h>
+#include <fenv.h>
#include <math.h>
+#include "math_private.h"
+
__complex__ float
__csinf (__complex__ float x)
{
- __complex__ float res;
+ __complex__ float retval;
+ int negate = signbit (__real__ x);
+ int rcls = fpclassify (__real__ x);
+ int icls = fpclassify (__imag__ x);
+
+ __real__ x = fabsf (__real__ x);
- if (!isfinite (__real__ x) || isnan (__imag__ x))
+ if (icls >= FP_ZERO)
{
- if (__real__ x == 0.0 || __imag__ x == 0.0)
- {
- __real__ res = __nanf ("");
- __imag__ res = 0.0;
- }
- else if (__isinff (__imag__ x))
+ /* Imaginary part is finite. */
+ if (rcls >= FP_ZERO)
{
- __real__ res = __nanf ("");
- __imag__ res = __imag__ x;
+ /* Real part is finite. */
+ float sinh_val = __ieee754_sinhf (__imag__ x);
+ float cosh_val = __ieee754_coshf (__imag__ x);
+ float sinix, cosix;
+
+ __sincosf (__real__ x, &sinix, &cosix);
+
+ __real__ retval = cosh_val * sinix;
+ __imag__ retval = sinh_val * cosix;
+
+ if (negate)
+ __real__ retval = -__real__ retval;
}
else
{
- __real__ res = __nanf ("");
- __imag__ res = __nanf ("");
+ if (icls == FP_ZERO)
+ {
+ /* Imaginary part is 0.0. */
+ __real__ retval = __nanf ("");
+ __imag__ retval = __imag__ x;
+
+#ifdef FE_INVALID
+ if (rcls == FP_INFINITE)
+ feraiseexcept (FE_INVALID);
+#endif
+ }
+ else
+ {
+ __real__ retval = __nanf ("");
+ __imag__ retval = __nanf ("");
+
+#ifdef FE_INVALID
+ feraiseexcept (FE_INVALID);
+#endif
+ }
}
}
- else
+ else if (icls == FP_INFINITE)
{
- __complex__ float y;
+ /* Imaginary part is infinite. */
+ if (rcls == FP_ZERO)
+ {
+ /* Real part is 0.0. */
+ __real__ retval = __copysignf (0.0, negate ? -1.0 : 1.0);
+ __imag__ retval = __imag__ x;
+ }
+ else if (rcls > FP_ZERO)
+ {
+ /* Real part is finite. */
+ float sinix, cosix;
+
+ __sincosf (__real__ x, &sinix, &cosix);
- __real__ y = -__imag__ x;
- __imag__ y = __real__ x;
+ __real__ retval = __copysignf (HUGE_VALF, sinix);
+ __imag__ retval = __copysignf (HUGE_VALF, cosix);
- y = __csinhf (y);
+ if (negate)
+ __real__ retval = -__real__ retval;
+ if (signbit (__imag__ x))
+ __imag__ retval = -__imag__ retval;
+ }
+ else
+ {
+ /* The addition raises the invalid exception. */
+ __real__ retval = __nanf ("");
+ __imag__ retval = HUGE_VALF;
- __real__ res = __imag__ y;
- __imag__ res = -__real__ y;
+#ifdef FE_INVALID
+ if (rcls == FP_INFINITE)
+ feraiseexcept (FE_INVALID);
+#endif
+ }
+ }
+ else
+ {
+ if (rcls == FP_ZERO)
+ __real__ retval = __copysignf (0.0, negate ? -1.0 : 1.0);
+ else
+ __real__ retval = __nanf ("");
+ __imag__ retval = __nanf ("");
}
- return res;
+ return retval;
}
weak_alias (__csinf, csinf)
diff --git a/sysdeps/libm-ieee754/s_csinh.c b/sysdeps/libm-ieee754/s_csinh.c
index 98f06a558f..29a271fec6 100644
--- a/sysdeps/libm-ieee754/s_csinh.c
+++ b/sysdeps/libm-ieee754/s_csinh.c
@@ -19,6 +19,7 @@
Boston, MA 02111-1307, USA. */
#include <complex.h>
+#include <fenv.h>
#include <math.h>
#include "math_private.h"
@@ -41,12 +42,13 @@ __csinh (__complex__ double x)
{
/* Imaginary part is finite. */
double sinh_val = __ieee754_sinh (__real__ x);
+ double cosh_val = __ieee754_cosh (__real__ x);
double sinix, cosix;
__sincos (__imag__ x, &sinix, &cosix);
__real__ retval = sinh_val * cosix;
- __imag__ retval = sinh_val * sinix;
+ __imag__ retval = cosh_val * sinix;
if (negate)
__real__ retval = -__real__ retval;
@@ -58,11 +60,20 @@ __csinh (__complex__ double x)
/* Real part is 0.0. */
__real__ retval = __copysign (0.0, negate ? -1.0 : 1.0);
__imag__ retval = __nan ("") + __nan ("");
+
+#ifdef FE_INVALID
+ if (icls == FP_INFINITE)
+ feraiseexcept (FE_INVALID);
+#endif
}
else
{
__real__ retval = __nan ("");
__imag__ retval = __nan ("");
+
+#ifdef FE_INVALID
+ feraiseexcept (FE_INVALID);
+#endif
}
}
}
@@ -93,6 +104,11 @@ __csinh (__complex__ double x)
/* The addition raises the invalid exception. */
__real__ retval = HUGE_VAL;
__imag__ retval = __nan ("") + __nan ("");
+
+#ifdef FE_INVALID
+ if (icls == FP_INFINITE)
+ feraiseexcept (FE_INVALID);
+#endif
}
}
else
diff --git a/sysdeps/libm-ieee754/s_csinhf.c b/sysdeps/libm-ieee754/s_csinhf.c
index c644d3a5e8..9c479bba95 100644
--- a/sysdeps/libm-ieee754/s_csinhf.c
+++ b/sysdeps/libm-ieee754/s_csinhf.c
@@ -19,6 +19,7 @@
Boston, MA 02111-1307, USA. */
#include <complex.h>
+#include <fenv.h>
#include <math.h>
#include "math_private.h"
@@ -41,12 +42,13 @@ __csinhf (__complex__ float x)
{
/* Imaginary part is finite. */
float sinh_val = __ieee754_sinhf (__real__ x);
+ float cosh_val = __ieee754_coshf (__real__ x);
float sinix, cosix;
__sincosf (__imag__ x, &sinix, &cosix);
__real__ retval = sinh_val * cosix;
- __imag__ retval = sinh_val * sinix;
+ __imag__ retval = cosh_val * sinix;
if (negate)
__real__ retval = -__real__ retval;
@@ -58,11 +60,20 @@ __csinhf (__complex__ float x)
/* Real part is 0.0. */
__real__ retval = __copysignf (0.0, negate ? -1.0 : 1.0);
__imag__ retval = __nanf ("") + __nanf ("");
+
+#ifdef FE_INVALID
+ if (icls == FP_INFINITE)
+ feraiseexcept (FE_INVALID);
+#endif
}
else
{
__real__ retval = __nanf ("");
__imag__ retval = __nanf ("");
+
+#ifdef FE_INVALID
+ feraiseexcept (FE_INVALID);
+#endif
}
}
}
@@ -93,6 +104,11 @@ __csinhf (__complex__ float x)
/* The addition raises the invalid exception. */
__real__ retval = HUGE_VALF;
__imag__ retval = __nanf ("") + __nanf ("");
+
+#ifdef FE_INVALID
+ if (icls == FP_INFINITE)
+ feraiseexcept (FE_INVALID);
+#endif
}
}
else
diff --git a/sysdeps/libm-ieee754/s_csinhl.c b/sysdeps/libm-ieee754/s_csinhl.c
index 4bb9e63680..694b39d670 100644
--- a/sysdeps/libm-ieee754/s_csinhl.c
+++ b/sysdeps/libm-ieee754/s_csinhl.c
@@ -41,12 +41,13 @@ __csinhl (__complex__ long double x)
{
/* Imaginary part is finite. */
long double sinh_val = __ieee754_sinhl (__real__ x);
+ long double cosh_val = __ieee754_coshl (__real__ x);
long double sinix, cosix;
__sincosl (__imag__ x, &sinix, &cosix);
__real__ retval = sinh_val * cosix;
- __imag__ retval = sinh_val * sinix;
+ __imag__ retval = cosh_val * sinix;
if (negate)
__real__ retval = -__real__ retval;
@@ -58,11 +59,20 @@ __csinhl (__complex__ long double x)
/* Real part is 0.0. */
__real__ retval = __copysignl (0.0, negate ? -1.0 : 1.0);
__imag__ retval = __nanl ("") + __nanl ("");
+
+#ifdef FE_INVALID
+ if (icls == FP_INFINITE)
+ feraiseexcept (FE_INVALID);
+#endif
}
else
{
__real__ retval = __nanl ("");
__imag__ retval = __nanl ("");
+
+#ifdef FE_INVALID
+ feraiseexcept (FE_INVALID);
+#endif
}
}
}
@@ -93,6 +103,11 @@ __csinhl (__complex__ long double x)
/* The addition raises the invalid exception. */
__real__ retval = HUGE_VALL;
__imag__ retval = __nanl ("") + __nanl ("");
+
+#ifdef FE_INVALID
+ if (icls == FP_INFINITE)
+ feraiseexcept (FE_INVALID);
+#endif
}
}
else
diff --git a/sysdeps/libm-ieee754/s_csinl.c b/sysdeps/libm-ieee754/s_csinl.c
index 513c144198..bae8648c32 100644
--- a/sysdeps/libm-ieee754/s_csinl.c
+++ b/sysdeps/libm-ieee754/s_csinl.c
@@ -19,45 +19,109 @@
Boston, MA 02111-1307, USA. */
#include <complex.h>
+#include <fenv.h>
#include <math.h>
+#include "math_private.h"
+
__complex__ long double
__csinl (__complex__ long double x)
{
- __complex__ long double res;
+ __complex__ long double retval;
+ int negate = signbit (__real__ x);
+ int rcls = fpclassify (__real__ x);
+ int icls = fpclassify (__imag__ x);
+
+ __real__ x = fabsl (__real__ x);
- if (!isfinite (__real__ x) || isnan (__imag__ x))
+ if (icls >= FP_ZERO)
{
- if (__real__ x == 0.0 || __imag__ x == 0.0)
- {
- __real__ res = __nanl ("");
- __imag__ res = 0.0;
- }
- else if (__isinfl (__imag__ x))
+ /* Imaginary part is finite. */
+ if (rcls >= FP_ZERO)
{
- __real__ res = __nanl ("");
- __imag__ res = __imag__ x;
+ /* Real part is finite. */
+ long double sinh_val = __ieee754_sinhl (__imag__ x);
+ long double cosh_val = __ieee754_coshl (__imag__ x);
+ long double sinix, cosix;
+
+ __sincosl (__real__ x, &sinix, &cosix);
+
+ __real__ retval = cosh_val * sinix;
+ __imag__ retval = sinh_val * cosix;
+
+ if (negate)
+ __real__ retval = -__real__ retval;
}
else
{
- __real__ res = __nanl ("");
- __imag__ res = __nanl ("");
+ if (icls == FP_ZERO)
+ {
+ /* Imaginary part is 0.0. */
+ __real__ retval = __nanl ("");
+ __imag__ retval = __imag__ x;
+
+#ifdef FE_INVALID
+ if (rcls == FP_INFINITE)
+ feraiseexcept (FE_INVALID);
+#endif
+ }
+ else
+ {
+ __real__ retval = __nanl ("");
+ __imag__ retval = __nanl ("");
+
+#ifdef FE_INVALID
+ feraiseexcept (FE_INVALID);
+#endif
+ }
}
}
- else
+ else if (icls == FP_INFINITE)
{
- __complex__ long double y;
+ /* Imaginary part is infinite. */
+ if (rcls == FP_ZERO)
+ {
+ /* Real part is 0.0. */
+ __real__ retval = __copysignl (0.0, negate ? -1.0 : 1.0);
+ __imag__ retval = __imag__ x;
+ }
+ else if (rcls > FP_ZERO)
+ {
+ /* Real part is finite. */
+ long double sinix, cosix;
+
+ __sincosl (__real__ x, &sinix, &cosix);
- __real__ y = -__imag__ x;
- __imag__ y = __real__ x;
+ __real__ retval = __copysignl (HUGE_VALL, sinix);
+ __imag__ retval = __copysignl (HUGE_VALL, cosix);
- y = __csinhl (y);
+ if (negate)
+ __real__ retval = -__real__ retval;
+ if (signbit (__imag__ x))
+ __imag__ retval = -__imag__ retval;
+ }
+ else
+ {
+ /* The addition raises the invalid exception. */
+ __real__ retval = __nanl ("");
+ __imag__ retval = HUGE_VALL;
- __real__ res = __imag__ y;
- __imag__ res = -__real__ y;
+#ifdef FE_INVALID
+ if (rcls == FP_INFINITE)
+ feraiseexcept (FE_INVALID);
+#endif
+ }
+ }
+ else
+ {
+ if (rcls == FP_ZERO)
+ __real__ retval = __copysignl (0.0, negate ? -1.0 : 1.0);
+ else
+ __real__ retval = __nanl ("");
+ __imag__ retval = __nanl ("");
}
- return res;
+ return retval;
}
weak_alias (__csinl, csinl)
diff --git a/sysdeps/libm-ieee754/s_ctanh.c b/sysdeps/libm-ieee754/s_ctanh.c
index eb6ff84817..d8825f35f9 100644
--- a/sysdeps/libm-ieee754/s_ctanh.c
+++ b/sysdeps/libm-ieee754/s_ctanh.c
@@ -19,6 +19,7 @@
Boston, MA 02111-1307, USA. */
#include <complex.h>
+#include <fenv.h>
#include <math.h>
#include "math_private.h"
@@ -44,6 +45,11 @@ __ctanh (__complex__ double x)
{
__real__ res = __nan ("");
__imag__ res = __nan ("");
+
+#ifdef FE_INVALID
+ if (__isinf (__imag__ x))
+ feraiseexcept (FE_INVALID);
+#endif
}
}
else
diff --git a/sysdeps/libm-ieee754/s_ctanhf.c b/sysdeps/libm-ieee754/s_ctanhf.c
index aec02fe7c4..fd66648d79 100644
--- a/sysdeps/libm-ieee754/s_ctanhf.c
+++ b/sysdeps/libm-ieee754/s_ctanhf.c
@@ -19,6 +19,7 @@
Boston, MA 02111-1307, USA. */
#include <complex.h>
+#include <fenv.h>
#include <math.h>
#include "math_private.h"
@@ -44,6 +45,11 @@ __ctanhf (__complex__ float x)
{
__real__ res = __nanf ("");
__imag__ res = __nanf ("");
+
+#ifdef FE_INVALID
+ if (__isinff (__imag__ x))
+ feraiseexcept (FE_INVALID);
+#endif
}
}
else
diff --git a/sysdeps/libm-ieee754/s_ctanhl.c b/sysdeps/libm-ieee754/s_ctanhl.c
index 8ed131e9a6..5ec06a6fa4 100644
--- a/sysdeps/libm-ieee754/s_ctanhl.c
+++ b/sysdeps/libm-ieee754/s_ctanhl.c
@@ -19,6 +19,7 @@
Boston, MA 02111-1307, USA. */
#include <complex.h>
+#include <fenv.h>
#include <math.h>
#include "math_private.h"
@@ -44,6 +45,11 @@ __ctanhl (__complex__ long double x)
{
__real__ res = __nanl ("");
__imag__ res = __nanl ("");
+
+#ifdef FE_INVALID
+ if (__isinfl (__imag__ x))
+ feraiseexcept (FE_INVALID);
+#endif
}
}
else
diff --git a/sysdeps/stub/abi-tag.h b/sysdeps/stub/abi-tag.h
new file mode 100644
index 0000000000..2810552694
--- /dev/null
+++ b/sysdeps/stub/abi-tag.h
@@ -0,0 +1,3 @@
+#error must define an ABI tag for this port
+
+#define ABI_TAG 0xff123abc
diff --git a/sysdeps/unix/sysv/linux/abi-tag.h b/sysdeps/unix/sysv/linux/abi-tag.h
new file mode 100644
index 0000000000..166e6a12f6
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/abi-tag.h
@@ -0,0 +1,16 @@
+/* Define the GNU ABI tag for the Linux kernel we need.
+ The is a 4-byte quantity in native byte order:
+ the high byte is 0 to indicate Linux;
+ the low three bytes are the LINUX_VERSION_CODE for the earliest
+ compatible Linux kernel. */
+
+#define ABI_LINUX_TAG 0
+
+#define ABI_LINUX_MAJOR 2
+#define ABI_LINUX_MINOR 0
+#define ABI_LINUX_PATCH 0
+
+#define ABI_TAG ((ABI_LINUX_TAG << 24) | \
+ (ABI_LINUX_MAJOR << 16) | \
+ (ABI_LINUX_MINOR << 8) | \
+ (ABI_LINUX_PATCH << 0))
diff --git a/sysdeps/unix/sysv/linux/alpha/clone.S b/sysdeps/unix/sysv/linux/alpha/clone.S
index 261bd81e57..5d36e2588d 100644
--- a/sysdeps/unix/sysv/linux/alpha/clone.S
+++ b/sysdeps/unix/sysv/linux/alpha/clone.S
@@ -44,7 +44,7 @@ ENTRY(__clone)
/* Do the system call */
mov a0,pv /* get fn ptr out of the way */
- mov a3,a4 /* get fn arg out of the way */
+ mov a3,t0 /* get fn arg out of the way */
mov a2,a0
ldiq v0,__NR_clone
call_pal PAL_callsys
@@ -74,7 +74,7 @@ thread_start:
.prologue 0
/* Call the user's function */
- mov a4,a0
+ mov t0,a0
jsr ra,(pv)
ldgp gp,0(ra)
diff --git a/sysdeps/unix/sysv/linux/net/route.h b/sysdeps/unix/sysv/linux/net/route.h
index 3518dc5fc9..2450d5154a 100644
--- a/sysdeps/unix/sysv/linux/net/route.h
+++ b/sysdeps/unix/sysv/linux/net/route.h
@@ -56,12 +56,12 @@ struct in6_rtmsg
struct in6_addr rtmsg_dst;
struct in6_addr rtmsg_src;
struct in6_addr rtmsg_gateway;
- unsigned long int rtmsg_type;
- unsigned short int rtmsg_dst_len;
- unsigned short int rtmsg_src_len;
- unsigned long int rtmsg_metric;
+ u_int32_t rtmsg_type;
+ u_int16_t rtmsg_dst_len;
+ u_int16_t rtmsg_src_len;
+ u_int32_t rtmsg_metric;
unsigned long int rtmsg_info;
- unsigned long int rtmsg_flags;
+ u_int32_t rtmsg_flags;
int rtmsg_ifindex;
};
diff --git a/sysdeps/unix/sysv/linux/netinet/ip_fw.h b/sysdeps/unix/sysv/linux/netinet/ip_fw.h
index 3887ca8992..8ba10ae196 100644
--- a/sysdeps/unix/sysv/linux/netinet/ip_fw.h
+++ b/sysdeps/unix/sysv/linux/netinet/ip_fw.h
@@ -41,14 +41,14 @@
* flags and num_*_ports are stored in host byte order (of course).
* Port numbers are stored in HOST byte order.
*/
-
+
#ifndef _NETINET_FW_H
#define _NETINET_FW_H
#include <sys/cdefs.h>
#include <sys/types.h>
-#include <netinet/icmp.h>
+#include <netinet/ip_icmp.h>
#include <netinet/in.h>
#include <netinet/ip.h>
#include <netinet/tcp.h>
@@ -107,11 +107,11 @@ struct ip_fw {
#define IP_FW_F_MASK 0x3FFF /* All possible flag bits mask */
-/*
+/*
* New IP firewall options for [gs]etsockopt at the RAW IP level.
* Unlike BSD Linux inherits IP options so you don't have to use
* a raw socket for this. Instead we check rights in the calls.
- */
+ */
#define IP_FW_BASE_CTL 64 /* base for firewall socket options */
@@ -181,7 +181,7 @@ struct ip_fwpkt
*/
struct ip_fw_masq;
-
+
__END_DECLS
#endif /* _NETINET_IP_FW_H */