diff options
author | Ulrich Drepper <drepper@redhat.com> | 1997-12-04 00:12:34 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 1997-12-04 00:12:34 +0000 |
commit | cbdee2790df9dac548fb3157cfaf7aceb0f40034 (patch) | |
tree | 566a6db9f880efdd95cb05a92d37a4c7ef6b8092 /math/libm-test.c | |
parent | 04be94a87d0a74c022490db7f4f926253f0d69d3 (diff) | |
download | glibc-cbdee2790df9dac548fb3157cfaf7aceb0f40034.tar glibc-cbdee2790df9dac548fb3157cfaf7aceb0f40034.tar.gz glibc-cbdee2790df9dac548fb3157cfaf7aceb0f40034.tar.bz2 glibc-cbdee2790df9dac548fb3157cfaf7aceb0f40034.zip |
Update.cvs/libc-ud-971204
1997-12-03 23:50 Ulrich Drepper <drepper@cygnus.com>
* Makeconfig: Add shared-thread-library variable.
* math/Makfile (CPPFLAGS): Add -D__LIBC_INTERNAL_MATH_INLINES.
* sysdeps/i386/Makefile: Don't define ___LIBC_INTERNAL_MATH_INLINES
here.
* sysdeps/m68k/fpu/e_acos.c: Likewise.
* sysdeps/m68k/fpu/e_atan2.c: Likewise.
* sysdeps/m68k/fpu/e_fmod.c: Likewise.
* sysdeps/m68k/fpu/e_pow.c: Likewise.
* sysdeps/m68k/fpu/e_scalb.c: Likewise.
* sysdeps/m68k/fpu/k_cos.c: Likewise.
* sysdeps/m68k/fpu/k_sin.c: Likewise.
* sysdeps/m68k/fpu/k_tan.c: Likewise.
* sysdeps/m68k/fpu/s_atan.c: Likewise.
* sysdeps/m68k/fpu/s_ccos.c: Likewise.
* sysdeps/m68k/fpu/s_ccosh.c: Likewise.
* sysdeps/m68k/fpu/s_cexp.c: Likewise.
* sysdeps/m68k/fpu/s_csin.c: Likewise.
* sysdeps/m68k/fpu/s_csinh.c: Likewise.
* sysdeps/m68k/fpu/s_frexp.c: Likewise.
* sysdeps/m68k/fpu/s_ilogb.c: Likewise.
* sysdeps/m68k/fpu/s_isinf.c: Likewise.
* sysdeps/m68k/fpu/s_llrint.c: Likewise.
* sysdeps/m68k/fpu/s_llrintf.c: Likewise.
* sysdeps/m68k/fpu/s_llrintl.c: Likewise.
* sysdeps/m68k/fpu/s_lrint.c: Likewise.
* sysdeps/m68k/fpu/s_modf.c: Likewise.
* sysdeps/m68k/fpu/s_remquo.c: Likewise.
* sysdeps/m68k/fpu/s_scalbn.c: Likewise.
* sysdeps/m68k/fpu/s_sincos.c: Likewise.
* libc.map: Add __libc_current_sigrtmin, __libc_current_sigrtmax,
__libc_allocate_rtsig, sigqueue, sigtimedwait, sigwaitinfo.
* signal/Makefile (headers): Add bits/siginfo.h.
(routines): Add allocrtsig, sigtimedwait, sigwaitinfo, sigqueue.
(distribute): Add testrtsig.h.
* signal/allocrtsig.c: New file.
* signal/signal.h: Define `union sigval'. Include <bits/siginfo.h>.
Declare sigwaitinfo, sigtimedwait, sigqueue, __libc_current_sigrtmin,
__libc_current_sigrtmax.
* sysdeps/generic/sigqueue.c: New file.
* sysdeps/generic/sigtimedwait.c: New file.
* sysdeps/generic/sigwaitinfo.c: New file.
* sysdeps/generic/testrtsig.h: New file.
* sysdeps/generic/bits/siginfo.h: New file.
* sysdeps/unix/sysv/linux/bits/siginfo.h: New file.
* sysdeps/unix/sysv/linux/kernel_sigaction.h: Define struct as
old_kernel_sigaction and rename sa_handler member to k_sa_handler.
* sysdeps/unix/sysv/linux/rt_sigaction.c: New file.
* sysdeps/unix/sysv/linux/rt_sigprocmask.c: New file.
* sysdeps/unix/sysv/linux/rt_sigqueueinfo.c: New file.
* sysdeps/unix/sysv/linux/rt_sigreturn.c: New file.
* sysdeps/unix/sysv/linux/rt_sigsuspend.c: New file.
* sysdeps/unix/sysv/linux/rt_sigtimedwait.c: New file.
* sysdeps/unix/sysv/linux/sigpending.c: New file.
* sysdeps/unix/sysv/linux/sigprocmask.c: New file.
* sysdeps/unix/sysv/linux/sigqueue.c: New file.
* sysdeps/unix/sysv/linux/sigreturn.c: New file.
* sysdeps/unix/sysv/linux/sigtimedwait.c: New file.
* sysdeps/unix/sysv/linux/sigwaitinfo.c: New file.
* sysdeps/unix/sysv/linux/testrtsig.h: New file.
* sysdeps/unix/sysv/linux/sigsuspend.c: Update for AIO.
* sysdeps/unix/sysv/linux/syscalls.list: Update for AIO.
* sysdeps/unix/sysv/linux/sigaction.c: Update for AIO.
* sysdeps/unix/sysv/linux/bits/local_lim.h: Define AIO_PRIO_DELTA_MAX.
* sysdeps/unix/sysv/linux/bits/posix_opt.h: Define _XOPEN_REALTIME
and _POSIX_REALTIME_SIGNALS.
* sysdeps/unix/sysv/linux/bits/sigaction.h: Update for AIO.
* sysdeps/unix/sysv/linux/bits/signum.h: Define SIGRTMIN/MAX and
update _NSIG.
* sysdeps/unix/sysv/linux/i386/sigaction.c: Update for AIO.
* sysdeps/unix/sysv/linux/i386/sys/ucontext.h: Linux/i386 specific
definitions.
* Makefile (subdirs): Add rt.
* shlib-versions: Add entry for librt.
* rt/Makefile: New file.
* rt/aio.h: New file.
* rt/aio_cancel.c: New file.
* rt/aio_error.c: New file.
* rt/aio_fsync.c: New file.
* rt/aio_misc.c: New file.
* rt/aio_misc.h: New file.
* rt/aio_read.c: New file.
* rt/aio_read64.c: New file.
* rt/aio_return.c: New file.
* rt/aio_suspend.c: New file.
* rt/aio_write.c: New file.
* rt/aio_write64.c: New file.
* rt/lio_listio.c: New file.
* rt/lio_listio64.c: New file.
* sysdeps/generic/aio_sigqueue.c: New file.
* sysdeps/unix/sysv/linux/aio_sigqueue.c: New file.
* sysdeps/unix/sysv/linux/Dist: Add new files
* sysdeps/unix/sysv/linux/Makefile [$(subdir)=signal]
(sysdep_routines): Add rt_sigsuspend, rt_sigprocmask, rt_sigtimedwait,
rt_sigqueueinfo, rt_sigaction.
* posix/Makefile (headers): Add bits/environments.h.
* posix/confstr.c: Correctly handle _CS_XBS5_ILP32_OFFBIG_CFLAGS
and _CS_LFS_CFLAGS on 64bit platforms.
* posix/unistd.h: Define _XOPEN_LEGACY. Explain _XOPEN_REALTIME
and _XOPEN_REALTIME_THREADS. Include bits/environments.h.
* sysdeps/generic/bits/confname.h: Define _SC_* constants for
compilation modules.
* sysdeps/wordsize-32/bits/environments.h: New file.
* sysdeps/wordsize-64/bits/environments.h: New file.
* posix/getopt.c: Remove declaration of getpid and __libc_pid.
* posix/getopt_init.c: Test for value 0xf00baa of uninitialized
__libc_pid.
* sysdeps/unix/sysv/linux/init-first.c: Initialize __libc_pid to
0xf00baa.
* string/string.h: Add declaration of __strverscmp.
* string/strverscmp.c: Rename function ot __strverscmp and make old
name weak alias.
* sysdeps/generic/dl-sysdep.c: Declare and define __libc_uid.
* sysdeps/generic/enbl-secure.c: Likewise.
* sysdeps/mach/hurd/dl-sysdep.c: Likewise.
* sysdeps/unix/sysv/linux/bits/sigset.h: Pretty print.
* sysdeps/unix/sysv/linux/sys/pci.h: New file.
1997-12-03 Ulrich Drepper <drepper@cygnus.com>
* posix/sys/wait.h: Use __transparent_union__ instead of
transparent_union. Reported by Roland McGrath.
1997-12-03 Andreas Jaeger <aj@arthur.rhein-neckar.de>
* resolv/inet_neta.c (inet_neta): Change type of first parameter
to u_int32_t. Suggested by John Lavagnino <John_Lavagnino@Brown.edu>
[PR libc/366].
* resolv/inet_addr.c (inet_addr): Change return type to u_int32_t.
* inet/arpa/inet.h: Change types of inet_neta and inet_addr.
1997-12-03 20:40 Thorsten Kukuk <kukuk@vt.uni-paderborn.de>
* grp/initgroups.c: Increase buffer if it is too small.
1997-12-03 Ulrich Drepper <drepper@cygnus.com>
* sysdeps/unix/sysv/linux/netinet/ip.h: Don't use u_int8_t for bit
fields, this is no ISO C. Reported by Andreas Jaeger.
1997-12-03 Andreas Jaeger <aj@arthur.rhein-neckar.de>
* sysdeps/i386/sys/ucontext.h (enum): Add missing commata.
1997-12-03 08:58 Philip Blundell <pb@nexus.co.uk>
* sysdeps/generic/bits/utsname.h: <sys/utsname.h> defines
_SYS_UTSNAME_H not _UTSNAME_H.
1997-11-28 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* elf/dl-profile.c (_dl_start_profile): Avoid overflow when
computing s_scale.
1997-11-29 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* sysdeps/libm-ieee754/s_csqrt.c: Use different formula for now.
* sysdeps/libm-ieee754/s_csqrtf.c: Likewise.
* sysdeps/libm-ieee754/s_csqrtl.c: Likewise.
* math/libm-test.c (csqrt_test): Add testcase.
1997-12-03 15:44 Ulrich Drepper <drepper@cygnus.com>
* sysdeps/unix/sysv/linux/sys/ultrasound.h: New file.
* sysdeps/unix/sysv/linux/sys/Dist: Add it.
* sysdeps/unix/sysv/linux/sys/Makefile [$(subdir)=misc]: Likewise.
1997-11-30 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* sysdeps/unix/sysv/linux/sys/timex.h: Fix declaration.
1997-12-01 Andreas Jaeger <aj@arthur.rhein-neckar.de>
* math/libm-test.c (acos_test): Add more tests.
(asin_test): Likewise.
(atan_test): Likewise.
(exp_test): Likewise.
(sin_test): Likewise.
(sqrt_test): Likewise.
(cpow_test): Likewise.
(csqrt_test): Likewise.
(cexp_test): Correct typo in gcc version test.
1997-12-02 17:14 Philip Blundell <pb@nexus.co.uk>
* sysdeps/arm/__longjmp.S: Define _SETJMP_H before including
<bits/setjmp.h>.
* sysdeps/arm/setjmp.S: Likewise.
* sysdeps/unix/sysv/linux/arm/bits/mman.h: New file.
1997-12-02 18:07 Philip Blundell <pb@nexus.co.uk>
* stdio/stdio.h: Add prototype for tmpfile64().
1997-12-02 17:47 Philip Blundell <pb@nexus.co.uk>
* stdio/stdio.h (__stdio_gen_tempname): Add extra argument to
prototype to keep in step with libio version.
* stdio-common/tmpfile64.c: Include <errno.h> for ENOSYS.
1997-12-02 17:41 Philip Blundell <pb@nexus.co.uk>
* sysdeps/generic/Makefile: Don't try to use make_siglist if
cross-compiling.
1997-12-02 01:18 Ulrich Drepper <drepper@cygnus.com>
* sysdeps/unix/sysv/linux/i386/clone.S: When cloned process returns
load GOT ptr before jumping to _exit.
Reported by Xavier Leroy.
Diffstat (limited to 'math/libm-test.c')
-rw-r--r-- | math/libm-test.c | 75 |
1 files changed, 62 insertions, 13 deletions
diff --git a/math/libm-test.c b/math/libm-test.c index a4b31a6929..c9b3b4d06e 100644 --- a/math/libm-test.c +++ b/math/libm-test.c @@ -78,12 +78,13 @@ /* "Philosophy": - This suite tests the correct implementation of mathematical - functions in libm. Some simple, specific parameters are tested for - correctness. Handling of specific inputs (e.g. infinity, - not-a-number) is also tested. Correct handling of exceptions is - checked against. These implemented tests should check all cases - that are specified in ISO C 9X. + This suite tests some aspects of the correct implementation of + mathematical functions in libm. Some simple, specific parameters + are tested for correctness but there's no exhaustive + testing. Handling of specific inputs (e.g. infinity, not-a-number) + is also tested. Correct handling of exceptions is checked + against. These implemented tests should check all cases that are + specified in ISO C 9X. Exception testing: At the moment only divide-by-zero and invalid exceptions are tested. Overflow/underflow and inexact exceptions @@ -837,9 +838,15 @@ acos_test (void) FUNC(acos) (x), INVALID_EXCEPTION); #endif + check ("acos (0) == pi/2", FUNC(acos) (0), M_PI_2); + check ("acos (-0) == pi/2", FUNC(acos) (minus_zero), M_PI_2); check ("acos (1) == 0", FUNC(acos) (1), 0); check ("acos (-1) == pi", FUNC(acos) (-1), M_PI); + + check ("acos (0.5) == pi/3", FUNC(acos) (0.5), M_PI_6 * 2.0); + check ("acos (-0.5) == 2*pi/3", FUNC(acos) (-0.5), M_PI_6 * 4.0); + } @@ -878,9 +885,14 @@ asin_test (void) #endif check ("asin (0) == 0", FUNC(asin) (0), 0); + check ("asin (-0) == -0", FUNC(asin) (minus_zero), minus_zero); check_eps ("asin (0.5) == pi/6", FUNC(asin) (0.5), M_PI_6, CHOOSE(3.5e-18, 0, 2e-7)); + check_eps ("asin (-0.5) == -pi/6", FUNC(asin) (-0.5), -M_PI_6, + CHOOSE(3.5e-18, 0, 2e-7)); check ("asin (1.0) == pi/2", FUNC(asin) (1.0), M_PI_2); + check ("asin (-1.0) == -pi/2", FUNC(asin) (-1.0), -M_PI_2); + } @@ -906,6 +918,10 @@ atan_test (void) check ("atan (+inf) == pi/2", FUNC(atan) (plus_infty), M_PI_2); check ("atan (-inf) == -pi/2", FUNC(atan) (minus_infty), -M_PI_2); + + check ("atan (1) == pi/4", FUNC(atan) (1), M_PI_4); + check ("atan (-1) == -pi/4", FUNC(atan) (1), M_PI_4); + } @@ -1062,6 +1078,8 @@ cos_test (void) check_eps ("cos (pi/3) == 0.5", FUNC(cos) (M_PI_6 * 2.0), 0.5, CHOOSE (4e-18L, 1e-15L, 1e-7L)); + check_eps ("cos (2*pi/3) == -0.5", FUNC(cos) (M_PI_6 * 4.0), + -0.5, CHOOSE (4e-18L, 1e-15L, 1e-7L)); check_eps ("cos (pi/2) == 0", FUNC(cos) (M_PI_2), 0, CHOOSE (1e-19L, 1e-16L, 1e-7L)); @@ -1123,6 +1141,9 @@ exp_test (void) check ("exp (-inf) == 0", FUNC(exp) (minus_infty), 0); #endif check_eps ("exp (1) == e", FUNC(exp) (1), M_E, CHOOSE (4e-18L, 5e-16, 0)); + + check ("exp (2) == e^2", FUNC(exp) (2), M_E * M_E); + check ("exp (3) == e^3", FUNC(exp) (3), M_E * M_E * M_E); } @@ -1724,8 +1745,11 @@ sin_test (void) INVALID_EXCEPTION); check_eps ("sin (pi/6) == 0.5", FUNC(sin) (M_PI_6), - 0.5,CHOOSE (4e-18L, 0, 0)); + 0.5, CHOOSE (4e-18L, 0, 0)); + check_eps ("sin (-pi/6) == -0.5", FUNC(sin) (-M_PI_6), + -0.5, CHOOSE (4e-18L, 0, 0)); check ("sin (pi/2) == 1", FUNC(sin) (M_PI_2), 1); + check ("sin (-pi/2) == -1", FUNC(sin) (-M_PI_2), -1); } @@ -2328,6 +2352,9 @@ sqrt_test (void) check_ext ("sqrt (x*x) == x", FUNC(sqrt) (x*x), x, x); check ("sqrt (4) == 2", FUNC(sqrt) (4), 2); check ("sqrt (0.25) == 0.5", FUNC(sqrt) (0.25), 0.5); + check ("sqrt (6642.25) == 81.5", FUNC(sqrt) (6642.25), 81.5); + check_eps ("sqrt (15239.903) == 123.45", FUNC(sqrt) (15239.903), 123.45, + CHOOSE (3e-6L, 3e-6, 8e-6)); } @@ -2459,7 +2486,7 @@ cexp_test (void) check_isnan ("imag(cexp(0 + i inf)) = NaN plus invalid exception", __imag__ result); -#if defined __GNUC__ && __GNUC__ <= 2 && __GNUC_MINOR <= 7 +#if defined __GNUC__ && __GNUC__ <= 2 && __GNUC_MINOR__ <= 7 if (verbose) printf ("The following test for cexp might fail due to a gcc compiler error!\n"); #endif @@ -4767,9 +4794,21 @@ csqrt_test (void) check_isnan ("real(csqrt(NaN + i NaN)) = NaN", __real__ result); check_isnan ("imag(csqrt(NaN + i NaN)) = NaN", __imag__ result); + result = FUNC(csqrt) (BUILD_COMPLEX (16.0, -30.0)); + check ("real(csqrt(16 - 30i)) = 5", __real__ result, 5.0); + check ("imag(csqrt(16 - 30i)) = -3", __imag__ result, -3.0); + result = FUNC(csqrt) (BUILD_COMPLEX (-1, 0)); check ("real(csqrt(1 + i0) = 0", __real__ result, 0); check ("imag(csqrt(1 + i0) = 1", __imag__ result, 1); + + result = FUNC(csqrt) (BUILD_COMPLEX (0, 2)); + check ("real(csqrt(0 + i 2) = 1", __real__ result, 1); + check ("imag(csqrt(0 + i 2) = 1", __imag__ result, 1); + + result = FUNC(csqrt) (BUILD_COMPLEX (119, 120)); + check ("real(csqrt(119 + i 120) = 12", __real__ result, 12); + check ("imag(csqrt(119 + i 120) = 5", __imag__ result, 5); } @@ -4779,14 +4818,24 @@ cpow_test (void) __complex__ MATHTYPE result; result = FUNC (cpow) (BUILD_COMPLEX (1, 0), BUILD_COMPLEX (0, 0)); - check ("real(cpow (1 + i0), (0 + i0)) = 0", __real__ result, 1); - check ("imag(cpow (1 + i0), (0 + i0)) = 0", __imag__ result, 0); + check ("real(cpow (1 + i0), (0 + i0)) == 0", __real__ result, 1); + check ("imag(cpow (1 + i0), (0 + i0)) == 0", __imag__ result, 0); result = FUNC (cpow) (BUILD_COMPLEX (2, 0), BUILD_COMPLEX (10, 0)); - check_eps ("real(cpow (2 + i0), (10 + i0)) = 1024", __real__ result, 1024, + check_eps ("real(cpow (2 + i0), (10 + i0)) == 1024", __real__ result, 1024, CHOOSE (2e-16L, 0, 0)); - check ("imag(cpow (2 + i0), (10 + i0)) = 0", __imag__ result, 0); - + check ("imag(cpow (2 + i0), (10 + i0)) == 0", __imag__ result, 0); + + result = FUNC (cpow) (BUILD_COMPLEX (M_E, 0), BUILD_COMPLEX (0, 2*M_PI)); + check ("real(cpow (e + i0), (0 + i 2*PI)) == 1", __real__ result, 1); + check_eps ("imag(cpow (e + i0), (0 + i 2*PI)) == 0", __imag__ result, 0, + CHOOSE (1e-18L, 3e-16, 4e-7)); + + result = FUNC (cpow) (BUILD_COMPLEX (2, 3), BUILD_COMPLEX (4, 0)); + check_eps ("real(cpow (2 + i3), (4 + i0)) == -119", __real__ result, -119, + CHOOSE (2e-17L, 2e-14, 4e-5)); + check_eps ("imag(cpow (2 + i3), (4 + i0)) == -120", __imag__ result, -120, + CHOOSE (4e-17L, 0, 8e-6)); } |