mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-10 23:30:07 +00:00
* sysdeps/i386/fpu/s_tan.S: Set errno for ±Inf.
* sysdeps/i386/fpu/s_tanf.S: Likewise. * sysdeps/i386/fpu/s_tanl.S: Likewise. * sysdeps/ieee754/dbl-64/s_tan.c: Likewise. * sysdeps/ieee754/flt-32/s_tanf.c: Likewise. * sysdeps/x86_64/fpu/s_tanl.S: Likewise. * math/libm-test.inc: Add tests for errno after tan calls with ±Inf.
This commit is contained in:
parent
002a604fd6
commit
337c270829
@ -1,5 +1,14 @@
|
||||
2009-04-25 Ulrich Drepper <drepper@redhat.com>
|
||||
|
||||
* sysdeps/i386/fpu/s_tan.S: Set errno for ±Inf.
|
||||
* sysdeps/i386/fpu/s_tanf.S: Likewise.
|
||||
* sysdeps/i386/fpu/s_tanl.S: Likewise.
|
||||
* sysdeps/ieee754/dbl-64/s_tan.c: Likewise.
|
||||
* sysdeps/ieee754/flt-32/s_tanf.c: Likewise.
|
||||
* sysdeps/x86_64/fpu/s_tanl.S: Likewise.
|
||||
* math/libm-test.inc: Add tests for errno after tan calls with
|
||||
±Inf.
|
||||
|
||||
* sysdeps/ieee754/k_standard.c (__kernel_standard): Use correct
|
||||
errno value vor pow(+-0,neg).
|
||||
* math/libm-test.inc (pow_test): Add tests for errno value for
|
||||
|
@ -5653,9 +5653,15 @@ tan_test (void)
|
||||
|
||||
TEST_f_f (tan, 0, 0);
|
||||
TEST_f_f (tan, minus_zero, minus_zero);
|
||||
errno = 0;
|
||||
TEST_f_f (tan, plus_infty, nan_value, INVALID_EXCEPTION);
|
||||
check_int ("errno for tan(Inf) == EDOM", errno, EDOM, 0, 0, 0);
|
||||
errno = 0;
|
||||
TEST_f_f (tan, minus_infty, nan_value, INVALID_EXCEPTION);
|
||||
check_int ("errno for tan(-Inf) == EDOM", errno, EDOM, 0, 0, 0);
|
||||
errno = 0;
|
||||
TEST_f_f (tan, nan_value, nan_value);
|
||||
check_int ("errno for tan(NaN) == 0", errno, 0, 0, 0, 0);
|
||||
|
||||
TEST_f_f (tan, M_PI_4l, 1);
|
||||
TEST_f_f (tan, 0.75L, 0.931596459944072461165202756573936428L);
|
||||
|
@ -1,15 +1,24 @@
|
||||
/*
|
||||
* Written by J.T. Conklin <jtc@netbsd.org>.
|
||||
* Fixed errno handling by Ulrich Drepper <drepper@redhat.com>.
|
||||
* Public domain.
|
||||
*/
|
||||
|
||||
#define __need_Emath
|
||||
#include <bits/errno.h>
|
||||
#include <machine/asm.h>
|
||||
|
||||
RCSID("$NetBSD: s_tan.S,v 1.5 1995/05/09 00:30:00 jtc Exp $")
|
||||
|
||||
ENTRY(__tan)
|
||||
fldl 4(%esp)
|
||||
fptan
|
||||
fxam
|
||||
fstsw %ax
|
||||
movb $0x45, %dh
|
||||
andb %ah, %dh
|
||||
cmpb $0x05, %dh
|
||||
je 3f
|
||||
4: fptan
|
||||
fnstsw %ax
|
||||
testl $0x400,%eax
|
||||
jnz 1f
|
||||
@ -26,5 +35,21 @@ ENTRY(__tan)
|
||||
fptan
|
||||
fstp %st(0)
|
||||
ret
|
||||
3:
|
||||
#ifdef PIC
|
||||
pushl %ebx
|
||||
cfi_adjust_cfa_offset (4)
|
||||
cfi_rel_offset (ebx, 0)
|
||||
LOAD_PIC_REG (bx)
|
||||
call __errno_location@PLT
|
||||
movl $EDOM, (%eax)
|
||||
popl %ebx
|
||||
cfi_adjust_cfa_offset (-4)
|
||||
cfi_restore (ebx)
|
||||
#else
|
||||
call __errno_location@PLT
|
||||
movl $EDOM, (%eax)
|
||||
#endif
|
||||
jmp 4b
|
||||
END (__tan)
|
||||
weak_alias (__tan, tan)
|
||||
|
@ -1,15 +1,24 @@
|
||||
/*
|
||||
* Written by J.T. Conklin <jtc@netbsd.org>.
|
||||
* Fixed errno handling by Ulrich Drepper <drepper@redhat.com>.
|
||||
* Public domain.
|
||||
*/
|
||||
|
||||
#define __need_Emath
|
||||
#include <bits/errno.h>
|
||||
#include <machine/asm.h>
|
||||
|
||||
RCSID("$NetBSD: s_tanf.S,v 1.3 1995/05/09 00:31:09 jtc Exp $")
|
||||
|
||||
ENTRY(__tanf)
|
||||
flds 4(%esp)
|
||||
fptan
|
||||
fxam
|
||||
fstsw %ax
|
||||
movb $0x45, %dh
|
||||
andb %ah, %dh
|
||||
cmpb $0x05, %dh
|
||||
je 3f
|
||||
4: fptan
|
||||
fnstsw %ax
|
||||
testl $0x400,%eax
|
||||
jnz 1f
|
||||
@ -26,5 +35,21 @@ ENTRY(__tanf)
|
||||
fptan
|
||||
fstp %st(0)
|
||||
ret
|
||||
3:
|
||||
#ifdef PIC
|
||||
pushl %ebx
|
||||
cfi_adjust_cfa_offset (4)
|
||||
cfi_rel_offset (ebx, 0)
|
||||
LOAD_PIC_REG (bx)
|
||||
call __errno_location@PLT
|
||||
movl $EDOM, (%eax)
|
||||
popl %ebx
|
||||
cfi_adjust_cfa_offset (-4)
|
||||
cfi_restore (ebx)
|
||||
#else
|
||||
call __errno_location@PLT
|
||||
movl $EDOM, (%eax)
|
||||
#endif
|
||||
jmp 4b
|
||||
END (__tanf)
|
||||
weak_alias (__tanf, tanf)
|
||||
|
@ -3,15 +3,22 @@
|
||||
* Public domain.
|
||||
*
|
||||
* Adapted for `long double' by Ulrich Drepper <drepper@cygnus.com>.
|
||||
* Fixed errno handling by Ulrich Drepper <drepper@redhat.com>.
|
||||
*/
|
||||
|
||||
#define __need_Emath
|
||||
#include <bits/errno.h>
|
||||
#include <machine/asm.h>
|
||||
|
||||
RCSID("$NetBSD: $")
|
||||
|
||||
ENTRY(__tanl)
|
||||
fldt 4(%esp)
|
||||
fptan
|
||||
fxam
|
||||
fstsw %ax
|
||||
movb $0x45, %dh
|
||||
andb %ah, %dh
|
||||
cmpb $0x05, %dh
|
||||
je 3f
|
||||
4: fptan
|
||||
fnstsw %ax
|
||||
testl $0x400,%eax
|
||||
jnz 1f
|
||||
@ -28,5 +35,21 @@ ENTRY(__tanl)
|
||||
fptan
|
||||
fstp %st(0)
|
||||
ret
|
||||
3:
|
||||
#ifdef PIC
|
||||
pushl %ebx
|
||||
cfi_adjust_cfa_offset (4)
|
||||
cfi_rel_offset (ebx, 0)
|
||||
LOAD_PIC_REG (bx)
|
||||
call __errno_location@PLT
|
||||
movl $EDOM, (%eax)
|
||||
popl %ebx
|
||||
cfi_adjust_cfa_offset (-4)
|
||||
cfi_restore (ebx)
|
||||
#else
|
||||
call __errno_location@PLT
|
||||
movl $EDOM, (%eax)
|
||||
#endif
|
||||
jmp 4b
|
||||
END (__tanl)
|
||||
weak_alias (__tanl, tanl)
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* IBM Accurate Mathematical Library
|
||||
* written by International Business Machines Corp.
|
||||
* Copyright (C) 2001 Free Software Foundation
|
||||
* Copyright (C) 2001, 2009 Free Software Foundation
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
@ -33,6 +33,8 @@
|
||||
/* round to nearest mode of IEEE 754 standard. */
|
||||
/* */
|
||||
/*********************************************************************/
|
||||
|
||||
#include <errno.h>
|
||||
#include "endian.h"
|
||||
#include "dla.h"
|
||||
#include "mpa.h"
|
||||
@ -61,7 +63,11 @@ double tan(double x) {
|
||||
|
||||
/* x=+-INF, x=NaN */
|
||||
num.d = x; ux = num.i[HIGH_HALF];
|
||||
if ((ux&0x7ff00000)==0x7ff00000) return x-x;
|
||||
if ((ux&0x7ff00000)==0x7ff00000) {
|
||||
if ((ux&0x7fffffff)==0x7ff00000)
|
||||
__set_errno (EDOM);
|
||||
return x-x;
|
||||
}
|
||||
|
||||
w=(x<ZERO) ? -x : x;
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
* Developed at SunPro, a Sun Microsystems, Inc. business.
|
||||
* Permission to use, copy, modify, and distribute this
|
||||
* software is freely granted, provided that this notice
|
||||
* software is freely granted, provided that this notice
|
||||
* is preserved.
|
||||
* ====================================================
|
||||
*/
|
||||
@ -17,6 +17,7 @@
|
||||
static char rcsid[] = "$NetBSD: s_tanf.c,v 1.4 1995/05/10 20:48:20 jtc Exp $";
|
||||
#endif
|
||||
|
||||
#include <errno.h>
|
||||
#include "math.h"
|
||||
#include "math_private.h"
|
||||
|
||||
@ -37,7 +38,11 @@ static char rcsid[] = "$NetBSD: s_tanf.c,v 1.4 1995/05/10 20:48:20 jtc Exp $";
|
||||
if(ix <= 0x3f490fda) return __kernel_tanf(x,z,1);
|
||||
|
||||
/* tan(Inf or NaN) is NaN */
|
||||
else if (ix>=0x7f800000) return x-x; /* NaN */
|
||||
else if (ix>=0x7f800000) {
|
||||
if (ix==0x7f800000)
|
||||
__set_errno (EDOM);
|
||||
return x-x; /* NaN */
|
||||
}
|
||||
|
||||
/* argument reduction needed */
|
||||
else {
|
||||
|
@ -4,15 +4,24 @@
|
||||
*
|
||||
* Adapted for `long double' by Ulrich Drepper <drepper@cygnus.com>.
|
||||
* Adapted for x86-64 by Andreas Jaeger <aj@suse.de>.
|
||||
* Fixed errno handling by Ulrich Drepper <drepper@redhat.com>.
|
||||
*/
|
||||
|
||||
#define __need_Emath
|
||||
#include <bits/errno.h>
|
||||
#include <machine/asm.h>
|
||||
|
||||
RCSID("$NetBSD: $")
|
||||
|
||||
ENTRY(__tanl)
|
||||
fldt 8(%rsp)
|
||||
fptan
|
||||
fxam
|
||||
fstsw %ax
|
||||
movb $0x45, %dh
|
||||
andb %ah, %dh
|
||||
cmpb $0x05, %dh
|
||||
je 3f
|
||||
4: fptan
|
||||
fnstsw %ax
|
||||
testl $0x400,%eax
|
||||
jnz 1f
|
||||
@ -29,5 +38,8 @@ ENTRY(__tanl)
|
||||
fptan
|
||||
fstp %st(0)
|
||||
ret
|
||||
3: call __errno_location@PLT
|
||||
movl $EDOM, (%rax)
|
||||
jmp 4b
|
||||
END (__tanl)
|
||||
weak_alias (__tanl, tanl)
|
||||
|
Loading…
Reference in New Issue
Block a user