mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-05 21:00:05 +00:00
Update.
1997-04-13 01:06 Ulrich Drepper <drepper@cygnus.com> * isomac.c: Improve messages. * math/Makefile (libm-calls): Add s_nearbyint, s_catan, s_casin, s_ccos, s_csin, s_ctan, s_ctanh, s_cacos, s_casinh, s_cacosh, s_catanh, s_csqrt, and s_cpow. * math/libm-test.c: New functions ccos_test, cacos_test, cacosh_test, casin_test, casinh_test, catan_test, catanh_test, ctanh_test, csqrt_test, cpow_test, rint_test. * math/math.h: Include new header mathbits.h which defines some more (system dependent) types and some macros. (isfinite): Use __finite instead of fpclassify. * sysdeps/generic/mathbits.h: New file. * sysdeps/i386/fpu/mathbits.h: New file. * sysdeps/i386/huge_val.h: Don't define INFINITY. * sysdeps/ieee754/huge_val.h: Likewise. * sysdeps/m68k/huge_val.h: Likewise. * sysdeps/i386/fpu/fenvbits.h: Define FE_NOMASK_ENV. * sysdeps/i386/fpu/fesetenv.c: Handle FE_NOMASK_ENV. * math/complex.h (_Imaginary_I): Define correctly. I misread the standard first. * sysdeps/libm-i387/s_finite.S: Optimized rewrite. * sysdeps/libm-i387/s_finitef.S: Likewise. * sysdeps/libm-i387/s_finitel.S: Likewise. Provided by Joe Keane <jgk@jgk.org>. * sysdeps/libm-i387/s_nearbyint.S: New file. * sysdeps/libm-i387/s_nearbyintf.S: New file. * sysdeps/libm-i387/s_nearbyintl.S: New file. * sysdeps/libm-ieee754/s_nearbyint.S: New file. * sysdeps/libm-ieee754/s_nearbyintf.S: New file. * sysdeps/libm-ieee754/s_nearbyintl.S: New file. * sysdeps/libm-ieee754/s_cacos.c: New file. * sysdeps/libm-ieee754/s_cacosf.c: New file. * sysdeps/libm-ieee754/s_cacosl.c: New file. * sysdeps/libm-ieee754/s_cacosh.c: New file. * sysdeps/libm-ieee754/s_cacoshf.c: New file. * sysdeps/libm-ieee754/s_cacoshl.c: New file. * sysdeps/libm-ieee754/s_casin.c: New file. * sysdeps/libm-ieee754/s_casinf.c: New file. * sysdeps/libm-ieee754/s_casinl.c: New file. * sysdeps/libm-ieee754/s_casinh.c: New file. * sysdeps/libm-ieee754/s_casinhf.c: New file. * sysdeps/libm-ieee754/s_casinhl.c: New file. * sysdeps/libm-ieee754/s_catan.c: New file. * sysdeps/libm-ieee754/s_catanf.c: New file. * sysdeps/libm-ieee754/s_catanl.c: New file. * sysdeps/libm-ieee754/s_catanh.c: New file. * sysdeps/libm-ieee754/s_catanhf.c: New file. * sysdeps/libm-ieee754/s_catanhl.c: New file. * sysdeps/libm-ieee754/s_ccos.c: New file. * sysdeps/libm-ieee754/s_ccosf.c: New file. * sysdeps/libm-ieee754/s_ccosl.c: New file. * sysdeps/libm-ieee754/s_cpow.c: New file. * sysdeps/libm-ieee754/s_cpowf.c: New file. * sysdeps/libm-ieee754/s_cpowl.c: New file. * sysdeps/libm-ieee754/s_csin.c: New file. * sysdeps/libm-ieee754/s_csinf.c: New file. * sysdeps/libm-ieee754/s_csinl.c: New file. * sysdeps/libm-ieee754/s_csqrt.c: New file. * sysdeps/libm-ieee754/s_csqrtf.c: New file. * sysdeps/libm-ieee754/s_csqrtl.c: New file. * sysdeps/libm-ieee754/s_ctan.c: New file. * sysdeps/libm-ieee754/s_ctanf.c: New file. * sysdeps/libm-ieee754/s_ctanl.c: New file. * sysdeps/libm-ieee754/s_ctanh.c: New file. * sysdeps/libm-ieee754/s_ctanhf.c: New file. * sysdeps/libm-ieee754/s_ctanhl.c: New file. * time/strftime.c (memset_space): Increment pointer. * time/strptime.c: Interpret year number 00-59 as 2000--2059. Patches by Karl Heuer <kwzh@gnu.ai.mit.edu>. 1997-04-11 11:57 Miguel de Icaza <miguel@nuclecu.unam.mx> * sysdeps/unix/sysv/linux/sparc/syscalls.list: Remove fork, pipe, syscall. 1997-04-05 00:57 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * sysdeps/libm-ieee754/s_remquo.c: Change algorithm, although probably still wrong. * sysdeps/libm-ieee754/s_remquof.c: Likewise. * sysdeps/libm-ieee754/s_remquol.c: Likewise. * math/libm-test.c (remquo_test): Corrected. 1997-04-11 00:01 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * sysdeps/m68k/fpu/__math.h (__rinttol, rinttol): New inline. * sysdeps/m68k/fpu/s_rinttol.c: New file. * sysdeps/m68k/fpu/s_rinttoll.c: New file. * math/libm-test.c (remquo_test): Use check_long to test the quotient. (cbrt_test): Add epsilons for long double. 1997-04-10 18:48 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * locale/localeinfo.h: Update declaration of _nl_current. 1997-04-11 11:27 Ulrich Drepper <drepper@cygnus.com> * rellnsh-sh: Use explicitely /bin/pwd to find the external program. * math/Makefile (headers): Add fenv.h and fenvbits.h. (libm-support): Add s_rountol, s_roundtoll, fclrexcpt, fgetexcptflg, fraiseexcpt, fsetexcptflg, ftestexcept, fegetround, fesetround, fegetenv, feholdexcpt, fesetenv, feupdateenv. (libm-calls): Add s_round. * math/fenv.h: New file. * math/libm-test.c: Correct tests for s_rinttol and s_rinttoll. Add roundtol_check and roundtoll_check. * math/math.h: Pretty printing. * sysdeps/i386/fpu/fclrexcpt.c: New file. * sysdeps/i386/fpu/fegetenv.c: New file. * sysdeps/i386/fpu/fegetround.c: New file. * sysdeps/i386/fpu/feholdexcpt.c: New file. * sysdeps/i386/fpu/fenvbits.h: New file. * sysdeps/i386/fpu/fesetenv.c: New file. * sysdeps/i386/fpu/fesetround.c: New file. * sysdeps/i386/fpu/fgetexcptflg.c: New file. * sysdeps/i386/fpu/fraiseexcpt.c: New file. * sysdeps/i386/fpu/fsetexcptflg.c: New file. * sysdeps/i386/fpu/ftestexcept.c: New file. * sysdeps/stub/fclrexcpt.c: New file. * sysdeps/stub/fegetenv.c: New file. * sysdeps/stub/fegetround.c: New file. * sysdeps/stub/feholdexcpt.c: New file. * sysdeps/stub/fenvbits.h: New file. * sysdeps/stub/fesetenv.c: New file. * sysdeps/stub/fesetround.c: New file. * sysdeps/stub/fgetexcptflg.c: New file. * sysdeps/stub/fraiseexcpt.c: New file. * sysdeps/stub/fsetexcptflg.c: New file. * sysdeps/stub/ftestexcept.c: New file. * sysdeps/libm-i387/s_trunc.S: New file. * sysdeps/libm-i387/s_truncf.S: New file. * sysdeps/libm-i387/s_truncl.S: New file. * sysdeps/libm-ieee754/s_round.c: New file. * sysdeps/libm-ieee754/s_roundf.c: New file. * sysdeps/libm-ieee754/s_roundl.c: New file. * sysdeps/libm-ieee754/s_ccosh.c: Rewritten to use fpclassify. * 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_clog.c: Likewise. * sysdeps/libm-ieee754/s_clogf.c: Likewise. * sysdeps/libm-ieee754/s_clogl.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_ceill.c: Corrected. The mantissa has only 63 bits. * sysdeps/libm-ieee754/s_floorl.c: Likewise. * po/pl.po: Updated. * string/swab.c: Correctly handle array of odd length. * sysdeps/generic/memmem.c: Update copyright. 1997-04-10 20:22 Ulrich Drepper <drepper@cygnus.com> * hurd/Makefile (sunrpc-headers): Add clnt.h. Proposed by Thomas Bushnell <thomas@gnu.ai.mit.edu>. 1997-04-09 14:21 Miguel de Icaza <miguel@nuclecu.unam.mx> * sysdeps/sparc/dl-machine.h: Bug fix: I was not loading the proper value from the GOT. Pass argument block to init function. * sysdeps/sparc/elf/start.c: Call atexit (_fini) after calling _init (). * sysdeps/sparc/fpu_control.h: Fix the FPU constants. I got them wrong the first time. * sysdeps/sparc/setjmp.S: PIC code was clobbering a callee saved register. * sysdeps/sparc/udiv_qrnnd.S: Add type @function. * sysdeps/unix/sysv/linux/sparc/init-first.h: Linux/SPARC specific SYSDEP_CALL_INIT. * sysdeps/unix/sysv/linux/sparc/signum.h: Remove definition for NSIG and duplicated SIGIOT. 1997-04-05 00:57 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * sysdeps/libm-ieee754/s_remquo.c: Change algorithm, although probably still wrong. * sysdeps/libm-ieee754/s_remquof.c: Likewise. * sysdeps/libm-ieee754/s_remquol.c: Likewise. * math/libm-test.c (remquo_test): Corrected. 1997-04-03 18:35 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * Makefile (parent-tests): New target to run the tests to that they are executed even if some subdir tests have failed. (tests): Depend on parent-tests instead of running the tests directly. 1997-04-03 12:26 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> Clean up name space pollution in libnss_*.so: * nis/nss_compat/compat-pwd.c, resolv/mapv4v6addr.h, resolv/nss_dns/dns-host.c: Replace bzero by memset, bcopy by memcpy and bcmp by memcmp to clean up namespace. * nss/nss_db/db-XXX.c (internal_setent): Use __dbopen instead of dbopen. * nss/nss_db/db-alias.c (internal_setent): Likewise. * nss/nss_db/db-netgrp.c (_nss_db_setnetgrent): Likewise. * db/db/db.c [_LIBC]: Define __dbopen instead of dbopen and make the latter a weak alias. * db/db.h: Declare __dbopen. * db/btree/btree.h [_LIBC]: Prepend __ to all mpool functions. * db/mpool/mpool.c [_LIBC]: Define all external functions with __ prefix and make the old names weak aliases. * db/mpool.h: Declare the new internal names. 1997-04-04 23:57 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * stdio-common/vfscanf.c: Fix scanning of hexadecimal fp number. * stdio-common/tstscanf.c: Add test case for this. 1997-04-04 17:26 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * math/libm-test.c: Fix more typos. 1997-04-03 17:15 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * math/libm-test.c (csinh_test): Fix test names. (ccosh_test): Likewise. * sysdeps/libm-ieee754/s_csinh.c: Use sinh function instead of computing it directly. * sysdeps/libm-ieee754/s_csinhf.c: Likewise. * sysdeps/libm-ieee754/s_csinhl.c: Likewise. * sysdeps/libm-ieee754/s_ccosh.c: Use cosh function instead of computing it directly. * sysdeps/libm-ieee754/s_ccoshf.c: Likewise. * sysdeps/libm-ieee754/s_ccoshl.c: Likewise. * sysdeps/libm-ieee754/s_cexp.c: Use internal exp function instead of wrapper. * sysdeps/libm-ieee754/s_cexpf.c: Likewise. * sysdeps/libm-ieee754/s_cexpl.c: Likewise. * sysdeps/m68k/fpu/s_cexp.c: Likewise. Correct handling of special values. Avoid use of fsincos if all that is needed is the quadrant. * sysdeps/m68k/fpu/s_ccosh.c: New file. * sysdeps/m68k/fpu/s_ccoshf.c: New file. * sysdeps/m68k/fpu/s_ccoshl.c: New file. * sysdeps/m68k/fpu/s_csinh.c: New file. * sysdeps/m68k/fpu/s_csinhl.c: New file. * sysdeps/m68k/fpu/s_csinhf.c: New file. 1997-04-03 10:18 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * manual/Makefile (dir-add.texi): Simplify. * libio/genops.c (_IO_flush_all_linebuffered): Don't flush on
This commit is contained in:
parent
c131718ccc
commit
6355131153
280
ChangeLog
280
ChangeLog
@ -1,3 +1,281 @@
|
||||
1997-04-13 01:06 Ulrich Drepper <drepper@cygnus.com>
|
||||
|
||||
* isomac.c: Improve messages.
|
||||
|
||||
* math/Makefile (libm-calls): Add s_nearbyint, s_catan, s_casin,
|
||||
s_ccos, s_csin, s_ctan, s_ctanh, s_cacos, s_casinh, s_cacosh,
|
||||
s_catanh, s_csqrt, and s_cpow.
|
||||
* math/libm-test.c: New functions ccos_test, cacos_test, cacosh_test,
|
||||
casin_test, casinh_test, catan_test, catanh_test, ctanh_test,
|
||||
csqrt_test, cpow_test, rint_test.
|
||||
* math/math.h: Include new header mathbits.h which defines some
|
||||
more (system dependent) types and some macros.
|
||||
(isfinite): Use __finite instead of fpclassify.
|
||||
* sysdeps/generic/mathbits.h: New file.
|
||||
* sysdeps/i386/fpu/mathbits.h: New file.
|
||||
* sysdeps/i386/huge_val.h: Don't define INFINITY.
|
||||
* sysdeps/ieee754/huge_val.h: Likewise.
|
||||
* sysdeps/m68k/huge_val.h: Likewise.
|
||||
|
||||
* sysdeps/i386/fpu/fenvbits.h: Define FE_NOMASK_ENV.
|
||||
* sysdeps/i386/fpu/fesetenv.c: Handle FE_NOMASK_ENV.
|
||||
|
||||
* math/complex.h (_Imaginary_I): Define correctly. I misread the
|
||||
standard first.
|
||||
|
||||
* sysdeps/libm-i387/s_finite.S: Optimized rewrite.
|
||||
* sysdeps/libm-i387/s_finitef.S: Likewise.
|
||||
* sysdeps/libm-i387/s_finitel.S: Likewise.
|
||||
Provided by Joe Keane <jgk@jgk.org>.
|
||||
|
||||
* sysdeps/libm-i387/s_nearbyint.S: New file.
|
||||
* sysdeps/libm-i387/s_nearbyintf.S: New file.
|
||||
* sysdeps/libm-i387/s_nearbyintl.S: New file.
|
||||
* sysdeps/libm-ieee754/s_nearbyint.S: New file.
|
||||
* sysdeps/libm-ieee754/s_nearbyintf.S: New file.
|
||||
* sysdeps/libm-ieee754/s_nearbyintl.S: New file.
|
||||
|
||||
* sysdeps/libm-ieee754/s_cacos.c: New file.
|
||||
* sysdeps/libm-ieee754/s_cacosf.c: New file.
|
||||
* sysdeps/libm-ieee754/s_cacosl.c: New file.
|
||||
* sysdeps/libm-ieee754/s_cacosh.c: New file.
|
||||
* sysdeps/libm-ieee754/s_cacoshf.c: New file.
|
||||
* sysdeps/libm-ieee754/s_cacoshl.c: New file.
|
||||
* sysdeps/libm-ieee754/s_casin.c: New file.
|
||||
* sysdeps/libm-ieee754/s_casinf.c: New file.
|
||||
* sysdeps/libm-ieee754/s_casinl.c: New file.
|
||||
* sysdeps/libm-ieee754/s_casinh.c: New file.
|
||||
* sysdeps/libm-ieee754/s_casinhf.c: New file.
|
||||
* sysdeps/libm-ieee754/s_casinhl.c: New file.
|
||||
* sysdeps/libm-ieee754/s_catan.c: New file.
|
||||
* sysdeps/libm-ieee754/s_catanf.c: New file.
|
||||
* sysdeps/libm-ieee754/s_catanl.c: New file.
|
||||
* sysdeps/libm-ieee754/s_catanh.c: New file.
|
||||
* sysdeps/libm-ieee754/s_catanhf.c: New file.
|
||||
* sysdeps/libm-ieee754/s_catanhl.c: New file.
|
||||
* sysdeps/libm-ieee754/s_ccos.c: New file.
|
||||
* sysdeps/libm-ieee754/s_ccosf.c: New file.
|
||||
* sysdeps/libm-ieee754/s_ccosl.c: New file.
|
||||
* sysdeps/libm-ieee754/s_cpow.c: New file.
|
||||
* sysdeps/libm-ieee754/s_cpowf.c: New file.
|
||||
* sysdeps/libm-ieee754/s_cpowl.c: New file.
|
||||
* sysdeps/libm-ieee754/s_csin.c: New file.
|
||||
* sysdeps/libm-ieee754/s_csinf.c: New file.
|
||||
* sysdeps/libm-ieee754/s_csinl.c: New file.
|
||||
* sysdeps/libm-ieee754/s_csqrt.c: New file.
|
||||
* sysdeps/libm-ieee754/s_csqrtf.c: New file.
|
||||
* sysdeps/libm-ieee754/s_csqrtl.c: New file.
|
||||
* sysdeps/libm-ieee754/s_ctan.c: New file.
|
||||
* sysdeps/libm-ieee754/s_ctanf.c: New file.
|
||||
* sysdeps/libm-ieee754/s_ctanl.c: New file.
|
||||
* sysdeps/libm-ieee754/s_ctanh.c: New file.
|
||||
* sysdeps/libm-ieee754/s_ctanhf.c: New file.
|
||||
* sysdeps/libm-ieee754/s_ctanhl.c: New file.
|
||||
|
||||
* time/strftime.c (memset_space): Increment pointer.
|
||||
* time/strptime.c: Interpret year number 00-59 as 2000--2059.
|
||||
Patches by Karl Heuer <kwzh@gnu.ai.mit.edu>.
|
||||
|
||||
1997-04-11 11:57 Miguel de Icaza <miguel@nuclecu.unam.mx>
|
||||
|
||||
* sysdeps/unix/sysv/linux/sparc/syscalls.list: Remove fork,
|
||||
pipe, syscall.
|
||||
|
||||
1997-04-05 00:57 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
|
||||
|
||||
* sysdeps/libm-ieee754/s_remquo.c: Change algorithm, although
|
||||
probably still wrong.
|
||||
* sysdeps/libm-ieee754/s_remquof.c: Likewise.
|
||||
* sysdeps/libm-ieee754/s_remquol.c: Likewise.
|
||||
|
||||
* math/libm-test.c (remquo_test): Corrected.
|
||||
|
||||
1997-04-11 00:01 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
|
||||
|
||||
* sysdeps/m68k/fpu/__math.h (__rinttol, rinttol): New inline.
|
||||
* sysdeps/m68k/fpu/s_rinttol.c: New file.
|
||||
* sysdeps/m68k/fpu/s_rinttoll.c: New file.
|
||||
|
||||
* math/libm-test.c (remquo_test): Use check_long to test the
|
||||
quotient.
|
||||
(cbrt_test): Add epsilons for long double.
|
||||
|
||||
1997-04-10 18:48 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
|
||||
|
||||
* locale/localeinfo.h: Update declaration of _nl_current.
|
||||
|
||||
1997-04-11 11:27 Ulrich Drepper <drepper@cygnus.com>
|
||||
|
||||
* rellnsh-sh: Use explicitely /bin/pwd to find the external program.
|
||||
|
||||
* math/Makefile (headers): Add fenv.h and fenvbits.h.
|
||||
(libm-support): Add s_rountol, s_roundtoll, fclrexcpt, fgetexcptflg,
|
||||
fraiseexcpt, fsetexcptflg, ftestexcept, fegetround, fesetround,
|
||||
fegetenv, feholdexcpt, fesetenv, feupdateenv.
|
||||
(libm-calls): Add s_round.
|
||||
* math/fenv.h: New file.
|
||||
* math/libm-test.c: Correct tests for s_rinttol and s_rinttoll.
|
||||
Add roundtol_check and roundtoll_check.
|
||||
* math/math.h: Pretty printing.
|
||||
* sysdeps/i386/fpu/fclrexcpt.c: New file.
|
||||
* sysdeps/i386/fpu/fegetenv.c: New file.
|
||||
* sysdeps/i386/fpu/fegetround.c: New file.
|
||||
* sysdeps/i386/fpu/feholdexcpt.c: New file.
|
||||
* sysdeps/i386/fpu/fenvbits.h: New file.
|
||||
* sysdeps/i386/fpu/fesetenv.c: New file.
|
||||
* sysdeps/i386/fpu/fesetround.c: New file.
|
||||
* sysdeps/i386/fpu/fgetexcptflg.c: New file.
|
||||
* sysdeps/i386/fpu/fraiseexcpt.c: New file.
|
||||
* sysdeps/i386/fpu/fsetexcptflg.c: New file.
|
||||
* sysdeps/i386/fpu/ftestexcept.c: New file.
|
||||
* sysdeps/stub/fclrexcpt.c: New file.
|
||||
* sysdeps/stub/fegetenv.c: New file.
|
||||
* sysdeps/stub/fegetround.c: New file.
|
||||
* sysdeps/stub/feholdexcpt.c: New file.
|
||||
* sysdeps/stub/fenvbits.h: New file.
|
||||
* sysdeps/stub/fesetenv.c: New file.
|
||||
* sysdeps/stub/fesetround.c: New file.
|
||||
* sysdeps/stub/fgetexcptflg.c: New file.
|
||||
* sysdeps/stub/fraiseexcpt.c: New file.
|
||||
* sysdeps/stub/fsetexcptflg.c: New file.
|
||||
* sysdeps/stub/ftestexcept.c: New file.
|
||||
|
||||
* sysdeps/libm-i387/s_trunc.S: New file.
|
||||
* sysdeps/libm-i387/s_truncf.S: New file.
|
||||
* sysdeps/libm-i387/s_truncl.S: New file.
|
||||
|
||||
* sysdeps/libm-ieee754/s_round.c: New file.
|
||||
* sysdeps/libm-ieee754/s_roundf.c: New file.
|
||||
* sysdeps/libm-ieee754/s_roundl.c: New file.
|
||||
|
||||
* sysdeps/libm-ieee754/s_ccosh.c: Rewritten to use fpclassify.
|
||||
* 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_clog.c: Likewise.
|
||||
* sysdeps/libm-ieee754/s_clogf.c: Likewise.
|
||||
* sysdeps/libm-ieee754/s_clogl.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_ceill.c: Corrected. The mantissa has only
|
||||
63 bits.
|
||||
* sysdeps/libm-ieee754/s_floorl.c: Likewise.
|
||||
|
||||
* po/pl.po: Updated.
|
||||
|
||||
* string/swab.c: Correctly handle array of odd length.
|
||||
|
||||
* sysdeps/generic/memmem.c: Update copyright.
|
||||
|
||||
1997-04-10 20:22 Ulrich Drepper <drepper@cygnus.com>
|
||||
|
||||
* hurd/Makefile (sunrpc-headers): Add clnt.h.
|
||||
Proposed by Thomas Bushnell <thomas@gnu.ai.mit.edu>.
|
||||
|
||||
1997-04-09 14:21 Miguel de Icaza <miguel@nuclecu.unam.mx>
|
||||
|
||||
* sysdeps/sparc/dl-machine.h: Bug fix: I was not loading
|
||||
the proper value from the GOT. Pass argument block to
|
||||
init function.
|
||||
|
||||
* sysdeps/sparc/elf/start.c: Call atexit (_fini) after calling
|
||||
_init ().
|
||||
|
||||
* sysdeps/sparc/fpu_control.h: Fix the FPU constants. I got them
|
||||
wrong the first time.
|
||||
|
||||
* sysdeps/sparc/setjmp.S: PIC code was clobbering a callee saved
|
||||
register.
|
||||
|
||||
* sysdeps/sparc/udiv_qrnnd.S: Add type @function.
|
||||
|
||||
* sysdeps/unix/sysv/linux/sparc/init-first.h: Linux/SPARC specific
|
||||
SYSDEP_CALL_INIT.
|
||||
|
||||
* sysdeps/unix/sysv/linux/sparc/signum.h: Remove definition for
|
||||
NSIG and duplicated SIGIOT.
|
||||
|
||||
1997-04-05 00:57 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
|
||||
|
||||
* sysdeps/libm-ieee754/s_remquo.c: Change algorithm, although
|
||||
probably still wrong.
|
||||
* sysdeps/libm-ieee754/s_remquof.c: Likewise.
|
||||
* sysdeps/libm-ieee754/s_remquol.c: Likewise.
|
||||
|
||||
* math/libm-test.c (remquo_test): Corrected.
|
||||
|
||||
1997-04-03 18:35 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
|
||||
|
||||
* Makefile (parent-tests): New target to run the tests to that
|
||||
they are executed even if some subdir tests have failed.
|
||||
(tests): Depend on parent-tests instead of running the tests
|
||||
directly.
|
||||
|
||||
1997-04-03 12:26 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
|
||||
|
||||
Clean up name space pollution in libnss_*.so:
|
||||
* nis/nss_compat/compat-pwd.c, resolv/mapv4v6addr.h,
|
||||
resolv/nss_dns/dns-host.c: Replace bzero by memset, bcopy by
|
||||
memcpy and bcmp by memcmp to clean up namespace.
|
||||
* nss/nss_db/db-XXX.c (internal_setent): Use __dbopen instead of
|
||||
dbopen.
|
||||
* nss/nss_db/db-alias.c (internal_setent): Likewise.
|
||||
* nss/nss_db/db-netgrp.c (_nss_db_setnetgrent): Likewise.
|
||||
* db/db/db.c [_LIBC]: Define __dbopen instead of dbopen and make
|
||||
the latter a weak alias.
|
||||
* db/db.h: Declare __dbopen.
|
||||
* db/btree/btree.h [_LIBC]: Prepend __ to all mpool functions.
|
||||
* db/mpool/mpool.c [_LIBC]: Define all external functions with __
|
||||
prefix and make the old names weak aliases.
|
||||
* db/mpool.h: Declare the new internal names.
|
||||
|
||||
1997-04-04 23:57 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
|
||||
|
||||
* stdio-common/vfscanf.c: Fix scanning of hexadecimal fp number.
|
||||
* stdio-common/tstscanf.c: Add test case for this.
|
||||
|
||||
1997-04-04 17:26 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
|
||||
|
||||
* math/libm-test.c: Fix more typos.
|
||||
|
||||
1997-04-03 17:15 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
|
||||
|
||||
* math/libm-test.c (csinh_test): Fix test names.
|
||||
(ccosh_test): Likewise.
|
||||
|
||||
* sysdeps/libm-ieee754/s_csinh.c: Use sinh function instead of
|
||||
computing it directly.
|
||||
* sysdeps/libm-ieee754/s_csinhf.c: Likewise.
|
||||
* sysdeps/libm-ieee754/s_csinhl.c: Likewise.
|
||||
|
||||
* sysdeps/libm-ieee754/s_ccosh.c: Use cosh function instead of
|
||||
computing it directly.
|
||||
* sysdeps/libm-ieee754/s_ccoshf.c: Likewise.
|
||||
* sysdeps/libm-ieee754/s_ccoshl.c: Likewise.
|
||||
|
||||
* sysdeps/libm-ieee754/s_cexp.c: Use internal exp function instead
|
||||
of wrapper.
|
||||
* sysdeps/libm-ieee754/s_cexpf.c: Likewise.
|
||||
* sysdeps/libm-ieee754/s_cexpl.c: Likewise.
|
||||
* sysdeps/m68k/fpu/s_cexp.c: Likewise. Correct handling of
|
||||
special values. Avoid use of fsincos if all that is needed is the
|
||||
quadrant.
|
||||
|
||||
* sysdeps/m68k/fpu/s_ccosh.c: New file.
|
||||
* sysdeps/m68k/fpu/s_ccoshf.c: New file.
|
||||
* sysdeps/m68k/fpu/s_ccoshl.c: New file.
|
||||
* sysdeps/m68k/fpu/s_csinh.c: New file.
|
||||
* sysdeps/m68k/fpu/s_csinhl.c: New file.
|
||||
* sysdeps/m68k/fpu/s_csinhf.c: New file.
|
||||
|
||||
1997-04-03 10:18 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
|
||||
|
||||
* manual/Makefile (dir-add.texi): Simplify.
|
||||
|
||||
1997-04-09 01:24 Ulrich Drepper <drepper@cygnus.com>
|
||||
|
||||
* rellns-sh: Rewrite to work also in presence of symlinks.
|
||||
@ -38,7 +316,7 @@
|
||||
|
||||
1997-04-08 07:19 H.J. Lu <hjl@gnu.ai.mit.edu>
|
||||
|
||||
* libio/genops.c (_IO_flush_all_linebuffered): don't flush on
|
||||
* libio/genops.c (_IO_flush_all_linebuffered): Don't flush on
|
||||
a read-only stream.
|
||||
|
||||
1997-04-09 01:19 Ulrich Drepper <drepper@cygnus.com>
|
||||
|
8
Makefile
8
Makefile
@ -280,10 +280,12 @@ parent_echo-distinfo:
|
||||
$(addprefix +nodist+,$(generated))
|
||||
|
||||
|
||||
.PHONY: parent-tests
|
||||
tests: parent-tests
|
||||
|
||||
# Run a test on the header files we use.
|
||||
tests: $(objpfx)isomac
|
||||
$(objpfx)./isomac '$(CC)' '$(+sysdep-includes)' \
|
||||
>$(common-objpfx)isomac.out
|
||||
parent-tests: $(objpfx)isomac
|
||||
$(dir $<)$(notdir $<) '$(CC)' '$(+sysdep-includes)' > $<.out
|
||||
|
||||
$(objpfx)isomac: isomac.c
|
||||
$(native-compile)
|
||||
|
3
PROJECTS
3
PROJECTS
@ -58,9 +58,6 @@ contact <bug-glibc@prep.ai.mit.edu>
|
||||
|
||||
- exp2
|
||||
- nearbyint
|
||||
- round
|
||||
- roundtol
|
||||
- roundtoll
|
||||
|
||||
each with float, double, and long double arguments. Writing these
|
||||
functions should be possible when following the implementation of
|
||||
|
@ -43,6 +43,18 @@
|
||||
|
||||
#include <mpool.h>
|
||||
|
||||
#ifdef _LIBC
|
||||
/* In the GNU C library we must not pollute the namespace because libdb is
|
||||
needed by libnss_db. */
|
||||
#define mpool_open __mpool_open
|
||||
#define mpool_filter __mpool_filter
|
||||
#define mpool_new __mpool_new
|
||||
#define mpool_get __mpool_get
|
||||
#define mpool_put __mpool_put
|
||||
#define mpool_sync __mpool_sync
|
||||
#define mpool_close __mpool_close
|
||||
#endif
|
||||
|
||||
#define DEFMINKEYPAGE (2) /* Minimum keys per page */
|
||||
#define MINCACHE (5) /* Minimum cached pages */
|
||||
#define MINPSIZE (512) /* Minimum page size */
|
||||
|
1
db/db.h
1
db/db.h
@ -224,6 +224,7 @@ typedef struct {
|
||||
#endif
|
||||
|
||||
__BEGIN_DECLS
|
||||
DB *__dbopen __P((const char *, int, int, DBTYPE, const void *));
|
||||
DB *dbopen __P((const char *, int, int, DBTYPE, const void *));
|
||||
|
||||
#ifdef __DBINTERFACE_PRIVATE
|
||||
|
10
db/db/db.c
10
db/db/db.c
@ -44,6 +44,12 @@ static char sccsid[] = "@(#)db.c 8.4 (Berkeley) 2/21/94";
|
||||
|
||||
#include <db.h>
|
||||
|
||||
#ifdef _LIBC
|
||||
/* In the GNU C library we must not pollute the namespace, because libdb
|
||||
is needed by libnss_db. */
|
||||
#define dbopen __dbopen
|
||||
#endif
|
||||
|
||||
DB *
|
||||
dbopen(fname, flags, mode, type, openinfo)
|
||||
const char *fname;
|
||||
@ -72,6 +78,10 @@ dbopen(fname, flags, mode, type, openinfo)
|
||||
errno = EINVAL;
|
||||
return (NULL);
|
||||
}
|
||||
#ifdef _LIBC
|
||||
#undef dbopen
|
||||
weak_alias (__dbopen, dbopen)
|
||||
#endif
|
||||
|
||||
static int
|
||||
__dberr __P((void))
|
||||
|
@ -85,13 +85,21 @@ typedef struct MPOOL {
|
||||
} MPOOL;
|
||||
|
||||
__BEGIN_DECLS
|
||||
MPOOL *__mpool_open __P((void *, int, pgno_t, pgno_t));
|
||||
MPOOL *mpool_open __P((void *, int, pgno_t, pgno_t));
|
||||
void __mpool_filter __P((MPOOL *, void (*)(void *, pgno_t, void *),
|
||||
void (*)(void *, pgno_t, void *), void *));
|
||||
void mpool_filter __P((MPOOL *, void (*)(void *, pgno_t, void *),
|
||||
void (*)(void *, pgno_t, void *), void *));
|
||||
void *__mpool_new __P((MPOOL *, pgno_t *));
|
||||
void *mpool_new __P((MPOOL *, pgno_t *));
|
||||
void *__mpool_get __P((MPOOL *, pgno_t, u_int));
|
||||
void *mpool_get __P((MPOOL *, pgno_t, u_int));
|
||||
int __mpool_put __P((MPOOL *, void *, u_int));
|
||||
int mpool_put __P((MPOOL *, void *, u_int));
|
||||
int __mpool_sync __P((MPOOL *));
|
||||
int mpool_sync __P((MPOOL *));
|
||||
int __mpool_close __P((MPOOL *));
|
||||
int mpool_close __P((MPOOL *));
|
||||
#ifdef STATISTICS
|
||||
void mpool_stat __P((MPOOL *));
|
||||
|
@ -50,6 +50,18 @@ static char sccsid[] = "@(#)mpool.c 8.5 (Berkeley) 7/26/94";
|
||||
#define __MPOOLINTERFACE_PRIVATE
|
||||
#include <mpool.h>
|
||||
|
||||
#ifdef _LIBC
|
||||
/* In the GNU C library we must not pollute the namespace because libdb is
|
||||
needed by libnss_db. */
|
||||
#define mpool_open __mpool_open
|
||||
#define mpool_filter __mpool_filter
|
||||
#define mpool_new __mpool_new
|
||||
#define mpool_get __mpool_get
|
||||
#define mpool_put __mpool_put
|
||||
#define mpool_sync __mpool_sync
|
||||
#define mpool_close __mpool_close
|
||||
#endif
|
||||
|
||||
static BKT *mpool_bkt __P((MPOOL *));
|
||||
static BKT *mpool_look __P((MPOOL *, pgno_t));
|
||||
static int mpool_write __P((MPOOL *, BKT *));
|
||||
@ -301,6 +313,23 @@ mpool_sync(mp)
|
||||
return (fsync(mp->fd) ? RET_ERROR : RET_SUCCESS);
|
||||
}
|
||||
|
||||
#ifdef _LIBC
|
||||
#undef mpool_open
|
||||
#undef mpool_filter
|
||||
#undef mpool_new
|
||||
#undef mpool_get
|
||||
#undef mpool_put
|
||||
#undef mpool_close
|
||||
#undef mpool_sync
|
||||
weak_alias (__mpool_open, mpool_open)
|
||||
weak_alias (__mpool_filter, mpool_filter)
|
||||
weak_alias (__mpool_new, mpool_new)
|
||||
weak_alias (__mpool_get, mpool_get)
|
||||
weak_alias (__mpool_put, mpool_put)
|
||||
weak_alias (__mpool_close, mpool_close)
|
||||
weak_alias (__mpool_sync, mpool_sync)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* mpool_bkt
|
||||
* Get a page from the cache (or create one).
|
||||
|
@ -73,7 +73,7 @@ include ../Rules
|
||||
# from $(subdirs), and this rule arranges for the headers in question
|
||||
# to get installed.
|
||||
sunrpc-headers = netdb.h pmap_prot.h xdr.h types.h auth.h \
|
||||
rpc_msg.h auth_unix.h
|
||||
rpc_msg.h auth_unix.h clnt.h
|
||||
installed-sunrpc-headers = $(addprefix $(inst_includedir)/rpc/, \
|
||||
$(sunrpc-headers))
|
||||
install-headers-nosubdir: $(installed-sunrpc-headers)
|
||||
|
2
isomac.c
2
isomac.c
@ -207,6 +207,8 @@ main (int argc, char *argv[])
|
||||
/* First get list of symbols which are defined by the compiler. */
|
||||
ignore_list = get_null_defines ();
|
||||
|
||||
fputs ("Tested files:\n", stdout);
|
||||
|
||||
for (h = 0; h < NUMBER_OF_HEADERS; ++h)
|
||||
{
|
||||
char file_name[HEADER_MAX];
|
||||
|
@ -615,7 +615,7 @@ DEFUN_VOID(_IO_flush_all_linebuffered)
|
||||
{
|
||||
_IO_FILE *fp;
|
||||
for (fp = _IO_list_all; fp != NULL; fp = fp->_chain)
|
||||
if (fp->_flags & _IO_LINE_BUF)
|
||||
if ((fp->_flags & _IO_NO_WRITES) == 0 && fp->_flags & _IO_LINE_BUF)
|
||||
_IO_OVERFLOW (fp, EOF);
|
||||
}
|
||||
|
||||
|
@ -104,7 +104,7 @@ extern struct locale_data *_nl_current_##category;
|
||||
|
||||
extern const char *const _nl_category_names[LC_ALL + 1];
|
||||
extern const size_t _nl_category_name_sizes[LC_ALL + 1];
|
||||
extern struct locale_data * *const _nl_current[LC_ALL];
|
||||
extern struct locale_data * *const _nl_current[LC_ALL + 1];
|
||||
|
||||
/* Name of the standard locale. */
|
||||
extern const char _nl_C_name[];
|
||||
|
@ -67,12 +67,8 @@ stamp-summary: summary.awk $(chapters) $(chapters-incl)
|
||||
# access to the documentation of the function, variables, and other
|
||||
# definitions.
|
||||
dir-add.texi: xtract-typefun.awk $(chapters)
|
||||
if test -n "$(chapters)"; then \
|
||||
(for i in $(chapters); do \
|
||||
$(GAWK) -f $< < $$i; \
|
||||
done) | sort > $@.new; \
|
||||
./move-if-change $@.new $@; \
|
||||
fi
|
||||
$(GAWK) -f $^ | sort > $@.new;
|
||||
mv -f $@.new $@
|
||||
|
||||
# Generate Texinfo files from the C source for the example programs.
|
||||
%.c.texi: examples/%.c
|
||||
|
@ -881,7 +881,7 @@ strstr ("hello, world", "wo")
|
||||
|
||||
@comment string.h
|
||||
@comment GNU
|
||||
@deftypefun {void *} memmem (const void *@var{needle}, size_t @var{needle-len},@*const void *@var{haystack}, size_t @var{haystack-len})
|
||||
@deftypefun {void *} memmem (const void *@var{haystack}, size_t @var{haystack-len},@*const void *@var{needle}, size_t @var{needle-len})
|
||||
This is like @code{strstr}, but @var{needle} and @var{haystack} are byte
|
||||
arrays rather than null-terminated strings. @var{needle-len} is the
|
||||
length of @var{needle} and @var{haystack-len} is the length of
|
||||
|
@ -22,7 +22,8 @@ subdir := math
|
||||
|
||||
# Installed header files.
|
||||
headers := math.h mathcalls.h __math.h huge_val.h nan.h \
|
||||
fpu_control.h complex.h cmathcalls.h
|
||||
fpu_control.h complex.h cmathcalls.h fenv.h \
|
||||
fenvbits.h
|
||||
|
||||
# Internal header files.
|
||||
distribute := math_private.h machine/asm.h machine/endian.h
|
||||
@ -36,7 +37,10 @@ extra-libs := libm
|
||||
extra-libs-others = $(extra-libs)
|
||||
|
||||
libm-support = k_standard s_lib_version s_matherr s_signgam \
|
||||
s_rinttol s_rinttoll
|
||||
s_rinttol s_rinttoll s_roundtol s_roundtoll \
|
||||
fclrexcpt fgetexcptflg fraiseexcpt fsetexcptflg \
|
||||
ftestexcept fegetround fesetround fegetenv feholdexcpt \
|
||||
fesetenv feupdateenv
|
||||
libm-calls = e_acos e_acosh e_asin e_atan2 e_atanh e_cosh e_exp e_fmod \
|
||||
e_hypot e_j0 e_j1 e_jn e_lgamma_r e_log e_log10 e_pow \
|
||||
e_rem_pio2 e_remainder e_scalb e_sinh e_sqrt k_cos \
|
||||
@ -49,8 +53,10 @@ libm-calls = e_acos e_acosh e_asin e_atan2 e_atanh e_cosh e_exp e_fmod \
|
||||
w_gamma_r w_hypot w_j0 w_j1 w_jn w_lgamma w_lgamma_r \
|
||||
w_log w_log10 w_pow w_remainder w_scalb w_sinh w_sqrt \
|
||||
s_signbit s_fpclassify s_fmax s_fmin s_fdim s_nan s_trunc \
|
||||
s_remquo s_log2 s_exp2 \
|
||||
conj cimag creal cabs carg s_cexp s_csinh s_ccosh s_clog
|
||||
s_remquo s_log2 s_exp2 s_round s_nearbyint \
|
||||
conj cimag creal cabs carg s_cexp s_csinh s_ccosh s_clog \
|
||||
s_catan s_casin s_ccos s_csin s_ctan s_ctanh s_cacos \
|
||||
s_casinh s_cacosh s_catanh s_csqrt s_cpow
|
||||
libm-routines = $(libm-support) $(libm-calls) \
|
||||
$(patsubst %_rf,%f_r,$(libm-calls:=f)) \
|
||||
$(long-m-$(long-double-fcts))
|
||||
|
@ -38,7 +38,7 @@ __BEGIN_DECLS
|
||||
/* Narrowest imaginary unit. This depends on the floating-point
|
||||
evaluation method.
|
||||
XXX This probably has to go into a gcc related file. */
|
||||
#define _Imaginary_I (DBL_EPSISON * 1.0i)
|
||||
#define _Imaginary_I (1.0iF)
|
||||
|
||||
/* Another more descriptive name is `I'. */
|
||||
#undef I
|
||||
|
114
math/fenv.h
Normal file
114
math/fenv.h
Normal file
@ -0,0 +1,114 @@
|
||||
/* Copyright (C) 1997 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
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
/*
|
||||
* ISO C 9X 7.6: Floating-point environment <fenv.h>
|
||||
*/
|
||||
|
||||
#ifndef _FENV_H
|
||||
|
||||
#define __FENV_H 1
|
||||
#include <features.h>
|
||||
|
||||
/* Get the architecture dependend definitions. The following definitions
|
||||
are expected to be done:
|
||||
|
||||
fenv_t type for object representing an entire floating-point
|
||||
environment
|
||||
|
||||
FE_DFL_ENV macro of type pointer to fenv_t to be used as the argument
|
||||
to functions taking an argument of type fenv_t; in this
|
||||
case the default environment will be used
|
||||
|
||||
fexcept_t type for object representing the floating-point exception
|
||||
flags including status associated with the flags
|
||||
|
||||
The following macros are defined iff the implementation supports this
|
||||
kind of exception.
|
||||
FE_INEXACT inxeact result
|
||||
FE_DIVBYZERO devision by zero
|
||||
FE_UNDERFLOW result not representable due to underflow
|
||||
FE_OVERFLOW result not representable due to overflow
|
||||
FE_INVALID invalid operation
|
||||
|
||||
FE_ALL_EXCEPT bitwise OR of all supported exceptions
|
||||
|
||||
The next macros are defined iff the appropriate rounding mode is
|
||||
supported by the implementation.
|
||||
FE_TONEAREST round to nearest
|
||||
FE_UPWARD round toward +Inf
|
||||
FE_DOWNWARD round toward -Inf
|
||||
FE_TOWARDZERO round toward 0
|
||||
*/
|
||||
#include <fenvbits.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
/* Floating-point exception handling. */
|
||||
|
||||
/* Clear the supported exceptions represented by EXCEPTS. */
|
||||
extern void feclearexcept __P ((int __excepts));
|
||||
|
||||
/* Store implementation-defined representation of the exception flags
|
||||
indicated by EXCEPTS in the object pointed to by FLAGP. */
|
||||
extern void fegetexceptflag __P ((fexcept_t *__flagp, int __excepts));
|
||||
|
||||
/* Raise the supported exceptions represented by EXCEPTS. */
|
||||
extern void feraiseexcept __P ((int __excepts));
|
||||
|
||||
/* Set complete status for exceptions inidicated by EXCEPTS according to
|
||||
the representation in the object pointed to by FLAGP. */
|
||||
extern void fesetexceptflag __P ((__const fexcept_t *__flagp, int __excepts));
|
||||
|
||||
/* Determine which of subset of the exceptions specified by EXCEPTS are
|
||||
currently set. */
|
||||
extern int fetestexcept __P ((int __excepts));
|
||||
|
||||
|
||||
/* Rounding control. */
|
||||
|
||||
/* Get current rounding direction. */
|
||||
extern int fegetround __P ((void));
|
||||
|
||||
/* Establish the rounding direction represented by ROUND. */
|
||||
extern int fesetround __P ((int __round));
|
||||
|
||||
|
||||
/* Floating-point environment. */
|
||||
|
||||
/* Store the current floating-point environment in the object pointed
|
||||
to by ENVP. */
|
||||
extern void fegetenv __P ((fenv_t *__envp));
|
||||
|
||||
/* Save the current environment in the object pointed to by ENVP, clear
|
||||
exception flags and install a non-stop mode (if available) for all
|
||||
exceptions. */
|
||||
extern int feholdexcept __P ((fenv_t *__envp));
|
||||
|
||||
/* Establish the floating-point environment represented by the object
|
||||
pointed to by ENVP. */
|
||||
extern void fesetenv __P ((__const fenv_t *__envp));
|
||||
|
||||
/* Save current exceptions in temporary storage, install environment
|
||||
represented by object pointed to by ENVP and raise exceptions
|
||||
according to saved exceptions. */
|
||||
extern void feupdateenv __P ((__const fenv_t *__envp));
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* fenv.h */
|
633
math/libm-test.c
633
math/libm-test.c
@ -633,8 +633,9 @@ cbrt_test (void)
|
||||
check_isinfn ("cbrt (-inf) == -inf", FUNC(cbrt) (minus_infty));
|
||||
check_isnan ("cbrt (NaN) == NaN", FUNC(cbrt) (nan_value));
|
||||
|
||||
check ("cbrt (8) == 2", FUNC(cbrt) (8), 2);
|
||||
check ("cbrt (-27) == -3", FUNC(cbrt) (-27.0), -3.0);
|
||||
check_eps ("cbrt (8) == 2", FUNC(cbrt) (8), 2, CHOOSE (5e-17L, 0, 0));
|
||||
check_eps ("cbrt (-27) == -3", FUNC(cbrt) (-27.0), -3.0,
|
||||
CHOOSE (3e-16L, 0, 0));
|
||||
}
|
||||
|
||||
|
||||
@ -1573,19 +1574,19 @@ remquo_test (void)
|
||||
|
||||
result = FUNC(remquo) (1.625, 1.0, &quo);
|
||||
check ("remquo(1.625, 1.0, &x) == -0.375", result, -0.375);
|
||||
check ("remquo(1.625, 1.0, &x) puts 1 in x", quo, 1);
|
||||
check_long ("remquo(1.625, 1.0, &x) puts 1 in x", quo, 1);
|
||||
|
||||
result = FUNC(remquo) (-1.625, 1.0, &quo);
|
||||
check ("remquo(-1.625, 1.0, &x) == 0.375", result, 0.375);
|
||||
check ("remquo(-1.625, 1.0, &x) puts -1 in x", quo, -1);
|
||||
check_long ("remquo(-1.625, 1.0, &x) puts -1 in x", quo, -1);
|
||||
|
||||
result = FUNC(remquo) (1.625, -1.0, &quo);
|
||||
check ("remquo(1.125, -1.0, &x) == 0.125", result, 0.125);
|
||||
check ("remquo(1.125, -1.0, &x) puts -1 in x", quo, -1);
|
||||
check ("remquo(1.625, -1.0, &x) == -0.375", result, -0.375);
|
||||
check_long ("remquo(1.625, -1.0, &x) puts -1 in x", quo, -1);
|
||||
|
||||
result = FUNC(remquo) (-1.625, -1.0, &quo);
|
||||
check ("remquo(-1.125, -1.0, &x) == 0.125", result, 0.125);
|
||||
check ("remquo(-1.125, -1.0, &x) puts 1 in x", quo, 1);
|
||||
check ("remquo(-1.625, -1.0, &x) == 0.375", result, 0.375);
|
||||
check_long ("remquo(-1.625, -1.0, &x) puts 1 in x", quo, 1);
|
||||
}
|
||||
|
||||
|
||||
@ -1667,10 +1668,10 @@ cexp_test (void)
|
||||
result = FUNC(cexp) (BUILD_COMPLEX (nan_value, 1.0));
|
||||
check_isnan ("real(cexp(NaN + 1i)) = NaN", __real__ result);
|
||||
check_isnan ("imag(cexp(NaN + 1i)) = NaN", __imag__ result);
|
||||
result = FUNC(cexp) (BUILD_COMPLEX (nan_value, 1.0));
|
||||
result = FUNC(cexp) (BUILD_COMPLEX (nan_value, plus_infty));
|
||||
check_isnan ("real(cexp(NaN + i inf)) = NaN", __real__ result);
|
||||
check_isnan ("imag(cexp(NaN + i inf)) = NaN", __imag__ result);
|
||||
result = FUNC(cexp) (BUILD_COMPLEX (nan_value, 1.0));
|
||||
result = FUNC(cexp) (BUILD_COMPLEX (nan_value, nan_value));
|
||||
check_isnan ("real(cexp(NaN + i NaN)) = NaN", __real__ result);
|
||||
check_isnan ("imag(cexp(NaN + i NaN)) = NaN", __imag__ result);
|
||||
|
||||
@ -1702,16 +1703,16 @@ csinh_test (void)
|
||||
check ("imag(csinh(-0 - 0i)) = -0", __imag__ result, minus_zero);
|
||||
|
||||
result = FUNC(csinh) (BUILD_COMPLEX (0.0, plus_infty));
|
||||
check ("real(csinh(0 + i Inf)) = 0", FUNC(fabs) (__real__ result), 0);
|
||||
check ("real(csinh(0 + i Inf)) = +-0", FUNC(fabs) (__real__ result), 0);
|
||||
check_isnan ("imag(csinh(0 + i Inf)) = NaN", __imag__ result);
|
||||
result = FUNC(csinh) (BUILD_COMPLEX (minus_zero, plus_infty));
|
||||
check ("real(csinh(-0 + i Inf)) = -0", FUNC(fabs) (__real__ result), 0);
|
||||
check ("real(csinh(-0 + i Inf)) = +-0", FUNC(fabs) (__real__ result), 0);
|
||||
check_isnan ("imag(csinh(-0 + i Inf)) = NaN", __imag__ result);
|
||||
result = FUNC(csinh) (BUILD_COMPLEX (0.0, minus_infty));
|
||||
check ("real(csinh(0 - i Inf)) = 0", FUNC(fabs) (__real__ result), 0);
|
||||
check ("real(csinh(0 - i Inf)) = +-0", FUNC(fabs) (__real__ result), 0);
|
||||
check_isnan ("imag(csinh(0 - i Inf)) = NaN", __imag__ result);
|
||||
result = FUNC(csinh) (BUILD_COMPLEX (minus_zero, minus_infty));
|
||||
check ("real(csinh(-0 - i Inf)) = -0", FUNC(fabs) (__real__ result), 0);
|
||||
check ("real(csinh(-0 - i Inf)) = +-0", FUNC(fabs) (__real__ result), 0);
|
||||
check_isnan ("imag(csinh(-0 - i Inf)) = NaN", __imag__ result);
|
||||
|
||||
result = FUNC(csinh) (BUILD_COMPLEX (plus_infty, 0.0));
|
||||
@ -1740,7 +1741,7 @@ csinh_test (void)
|
||||
FUNC(fabs) (__real__ result));
|
||||
check_isnan ("imag(csinh(Inf - i Inf)) = NaN", __imag__ result);
|
||||
result = FUNC(csinh) (BUILD_COMPLEX (minus_infty, minus_infty));
|
||||
check_isinfp ("real(csinh(-Inf - i Inf)) = -Inf",
|
||||
check_isinfp ("real(csinh(-Inf - i Inf)) = +-Inf",
|
||||
FUNC(fabs) (__real__ result));
|
||||
check_isnan ("imag(csinh(-Inf - i Inf)) = NaN", __imag__ result);
|
||||
|
||||
@ -1771,10 +1772,10 @@ csinh_test (void)
|
||||
check_isnan ("imag(csinh(-6.75 - i Inf)) = NaN", __imag__ result);
|
||||
|
||||
result = FUNC(csinh) (BUILD_COMPLEX (0.0, nan_value));
|
||||
check ("real(csinh(0 + i NaN)) = 0", FUNC(fabs) (__real__ result), 0);
|
||||
check ("real(csinh(0 + i NaN)) = +-0", FUNC(fabs) (__real__ result), 0);
|
||||
check_isnan ("imag(csinh(0 + i NaN)) = NaN", __imag__ result);
|
||||
result = FUNC(csinh) (BUILD_COMPLEX (minus_zero, nan_value));
|
||||
check ("real(csinh(-0 + i NaN)) = -0", FUNC(fabs) (__real__ result), 0);
|
||||
check ("real(csinh(-0 + i NaN)) = +-0", FUNC(fabs) (__real__ result), 0);
|
||||
check_isnan ("imag(csinh(-0 + i NaN)) = NaN", __imag__ result);
|
||||
|
||||
result = FUNC(csinh) (BUILD_COMPLEX (plus_infty, nan_value));
|
||||
@ -1784,7 +1785,7 @@ csinh_test (void)
|
||||
result = FUNC(csinh) (BUILD_COMPLEX (minus_infty, nan_value));
|
||||
check_isinfp ("real(csinh(-Inf + i NaN)) = +-Inf",
|
||||
FUNC(fabs) (__real__ result));
|
||||
check_isnan ("imag(csinh(-0 + i NaN)) = NaN", __imag__ result);
|
||||
check_isnan ("imag(csinh(-Inf + i NaN)) = NaN", __imag__ result);
|
||||
|
||||
result = FUNC(csinh) (BUILD_COMPLEX (9.0, nan_value));
|
||||
check_isnan ("real(csinh(9.0 + i NaN)) = NaN", __real__ result);
|
||||
@ -1795,10 +1796,10 @@ csinh_test (void)
|
||||
|
||||
result = FUNC(csinh) (BUILD_COMPLEX (nan_value, 0.0));
|
||||
check_isnan ("real(csinh(NaN + i0)) = NaN", __real__ result);
|
||||
check ("imag(csinh(NaN + i0)) = NaN", __imag__ result, 0.0);
|
||||
check ("imag(csinh(NaN + i0)) = 0", __imag__ result, 0.0);
|
||||
result = FUNC(csinh) (BUILD_COMPLEX (nan_value, minus_zero));
|
||||
check_isnan ("real(csinh(NaN - i0)) = NaN", __real__ result);
|
||||
check ("imag(csinh(NaN - i0)) = NaN", __imag__ result, minus_zero);
|
||||
check ("imag(csinh(NaN - i0)) = -0", __imag__ result, minus_zero);
|
||||
|
||||
result = FUNC(csinh) (BUILD_COMPLEX (nan_value, 10.0));
|
||||
check_isnan ("real(csinh(NaN + i10)) = NaN", __real__ result);
|
||||
@ -1820,22 +1821,153 @@ csinh_test (void)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
ccos_test (void)
|
||||
{
|
||||
__complex__ MATHTYPE result;
|
||||
|
||||
result = FUNC(ccos) (BUILD_COMPLEX (0.0, 0.0));
|
||||
check ("real(ccos(0 + 0i)) = 1.0", __real__ result, 1.0);
|
||||
check ("imag(ccos(0 + 0i)) = 0", __imag__ result, 0);
|
||||
result = FUNC(ccos) (BUILD_COMPLEX (minus_zero, 0.0));
|
||||
check ("real(ccos(-0 + 0i)) = 1.0", __real__ result, 1.0);
|
||||
check ("imag(ccos(-0 + 0i)) = -0", __imag__ result, minus_zero);
|
||||
result = FUNC(ccos) (BUILD_COMPLEX (0.0, minus_zero));
|
||||
check ("real(ccos(0 - 0i)) = 1.0", __real__ result, 1.0);
|
||||
check ("imag(ccos(0 - 0i)) = 0", __imag__ result, 0.0);
|
||||
result = FUNC(ccos) (BUILD_COMPLEX (minus_zero, minus_zero));
|
||||
check ("real(ccos(-0 - 0i)) = 1.0", __real__ result, 1.0);
|
||||
check ("imag(ccos(-0 - 0i)) = -0", __imag__ result, minus_zero);
|
||||
|
||||
result = FUNC(ccos) (BUILD_COMPLEX (plus_infty, 0.0));
|
||||
check_isnan ("real(ccos(+Inf + i0)) = NaN", __real__ result);
|
||||
check ("imag(ccos(Inf + i0)) = +-0", FUNC(fabs) (__imag__ result), 0);
|
||||
result = FUNC(ccos) (BUILD_COMPLEX (plus_infty, minus_zero));
|
||||
check_isnan ("real(ccos(Inf - i0)) = NaN", __real__ result);
|
||||
check ("imag(ccos(Inf - i0)) = +-0", FUNC(fabs) (__imag__ result), 0);
|
||||
result = FUNC(ccos) (BUILD_COMPLEX (minus_infty, 0.0));
|
||||
check_isnan ("real(ccos(-Inf + i0)) = NaN", __real__ result);
|
||||
check ("imag(ccos(-Inf + i0)) = +-0", FUNC(fabs) (__imag__ result), 0);
|
||||
result = FUNC(ccos) (BUILD_COMPLEX (minus_infty, minus_zero));
|
||||
check_isnan ("real(ccos(-Inf - i0)) = NaN", __real__ result);
|
||||
check ("imag(ccos(-Inf - i0)) = +-0", FUNC(fabs) (__imag__ result), 0);
|
||||
|
||||
result = FUNC(ccos) (BUILD_COMPLEX (0.0, plus_infty));
|
||||
check_isinfp ("real(ccos(0 + i Inf)) = +Inf", __real__ result);
|
||||
check ("imag(ccos(0 + i Inf)) = 0", __imag__ result, 0);
|
||||
result = FUNC(ccos) (BUILD_COMPLEX (0.0, minus_infty));
|
||||
check_isinfp ("real(ccos(0 - i Inf)) = +Inf", __real__ result);
|
||||
check ("imag(ccos(0 - i Inf)) = 0", __imag__ result, 0);
|
||||
result = FUNC(ccos) (BUILD_COMPLEX (minus_zero, plus_infty));
|
||||
check_isinfp ("real(ccos(-0 + i Inf)) = +Inf", __real__ result);
|
||||
check ("imag(ccos(-0 + i Inf)) = -0", __imag__ result, minus_zero);
|
||||
result = FUNC(ccos) (BUILD_COMPLEX (minus_zero, minus_infty));
|
||||
check_isinfp ("real(ccos(-0 - i Inf)) = +Inf", __real__ result);
|
||||
check ("imag(ccos(-0 - i Inf)) = -0", __imag__ result, minus_zero);
|
||||
|
||||
result = FUNC(ccos) (BUILD_COMPLEX (plus_infty, plus_infty));
|
||||
check_isinfp ("real(ccos(+Inf + i Inf)) = +Inf", __real__ result);
|
||||
check_isnan ("imag(ccos(+Inf + i Inf)) = NaN", __imag__ result);
|
||||
result = FUNC(ccos) (BUILD_COMPLEX (minus_infty, plus_infty));
|
||||
check_isinfp ("real(ccos(-Inf + i Inf)) = +Inf", __real__ result);
|
||||
check_isnan ("imag(ccos(-Inf + i Inf)) = NaN", __imag__ result);
|
||||
result = FUNC(ccos) (BUILD_COMPLEX (plus_infty, minus_infty));
|
||||
check_isinfp ("real(ccos(Inf - i Inf)) = +Inf", __real__ result);
|
||||
check_isnan ("imag(ccos(Inf - i Inf)) = NaN", __imag__ result);
|
||||
result = FUNC(ccos) (BUILD_COMPLEX (minus_infty, minus_infty));
|
||||
check_isinfp ("real(ccos(-Inf - i Inf)) = +Inf", __real__ result);
|
||||
check_isnan ("imag(ccos(-Inf - i Inf)) = NaN", __imag__ result);
|
||||
|
||||
result = FUNC(ccos) (BUILD_COMPLEX (4.625, plus_infty));
|
||||
check_isinfn ("real(ccos(4.625 + i Inf)) = -Inf", __real__ result);
|
||||
check_isinfn ("imag(ccos(4.625 + i Inf)) = -Inf", __imag__ result);
|
||||
result = FUNC(ccos) (BUILD_COMPLEX (4.625, minus_infty));
|
||||
check_isinfn ("real(ccos(4.625 - i Inf)) = -Inf", __real__ result);
|
||||
check_isinfn ("imag(ccos(4.625 - i Inf)) = -Inf", __imag__ result);
|
||||
result = FUNC(ccos) (BUILD_COMPLEX (-4.625, plus_infty));
|
||||
check_isinfn ("real(ccos(-4.625 + i Inf)) = -Inf", __real__ result);
|
||||
check_isinfp ("imag(ccos(-4.625 + i Inf)) = +Inf", __imag__ result);
|
||||
result = FUNC(ccos) (BUILD_COMPLEX (-4.625, minus_infty));
|
||||
check_isinfn ("real(ccos(-4.625 - i Inf)) = -Inf", __real__ result);
|
||||
check_isinfp ("imag(ccos(-4.625 - i Inf)) = +Inf", __imag__ result);
|
||||
|
||||
result = FUNC(ccos) (BUILD_COMPLEX (plus_infty, 6.75));
|
||||
check_isnan ("real(ccos(+Inf + i6.75)) = NaN", __real__ result);
|
||||
check_isnan ("imag(ccos(+Inf + i6.75)) = NaN", __imag__ result);
|
||||
result = FUNC(ccos) (BUILD_COMPLEX (plus_infty, -6.75));
|
||||
check_isnan ("real(ccos(+Inf - i6.75)) = NaN", __real__ result);
|
||||
check_isnan ("imag(ccos(+Inf - i6.75)) = NaN", __imag__ result);
|
||||
result = FUNC(ccos) (BUILD_COMPLEX (minus_infty, 6.75));
|
||||
check_isnan ("real(ccos(-Inf + i6.75)) = NaN", __real__ result);
|
||||
check_isnan ("imag(ccos(-Inf + i6.75)) = NaN", __imag__ result);
|
||||
result = FUNC(ccos) (BUILD_COMPLEX (minus_infty, -6.75));
|
||||
check_isnan ("real(ccos(-Inf - i6.75)) = NaN", __real__ result);
|
||||
check_isnan ("imag(ccos(-Inf - i6.75)) = NaN", __imag__ result);
|
||||
|
||||
result = FUNC(ccos) (BUILD_COMPLEX (nan_value, 0.0));
|
||||
check_isnan ("real(ccos(NaN + i0)) = NaN", __real__ result);
|
||||
check ("imag(ccos(NaN + i0)) = +-0", FUNC(fabs) (__imag__ result), 0);
|
||||
result = FUNC(ccos) (BUILD_COMPLEX (nan_value, minus_zero));
|
||||
check_isnan ("real(ccos(NaN - i0)) = NaN", __real__ result);
|
||||
check ("imag(ccos(NaN - i0)) = +-0", FUNC(fabs) (__imag__ result), 0);
|
||||
|
||||
result = FUNC(ccos) (BUILD_COMPLEX (nan_value, plus_infty));
|
||||
check_isinfp ("real(ccos(NaN + i Inf)) = +Inf", __real__ result);
|
||||
check_isnan ("imag(ccos(NaN + i Inf)) = NaN", __imag__ result);
|
||||
result = FUNC(ccos) (BUILD_COMPLEX (nan_value, minus_infty));
|
||||
check_isinfp ("real(ccos(NaN - i Inf)) = +Inf", __real__ result);
|
||||
check_isnan ("imag(ccos(NaN - i Inf)) = NaN", __imag__ result);
|
||||
|
||||
result = FUNC(ccos) (BUILD_COMPLEX (nan_value, 9.0));
|
||||
check_isnan ("real(ccos(NaN + i9.0)) = NaN", __real__ result);
|
||||
check_isnan ("imag(ccos(NaN + i9.0)) = NaN", __imag__ result);
|
||||
result = FUNC(ccos) (BUILD_COMPLEX (nan_value, -9.0));
|
||||
check_isnan ("real(ccos(NaN - i9.0)) = NaN", __real__ result);
|
||||
check_isnan ("imag(ccos(NaN - i9.0)) = NaN", __imag__ result);
|
||||
|
||||
result = FUNC(ccos) (BUILD_COMPLEX (0.0, nan_value));
|
||||
check_isnan ("real(ccos(0 + i NaN)) = NaN", __real__ result);
|
||||
check ("imag(ccos(0 + i NaN)) = +-0", FUNC(fabs) (__imag__ result), 0.0);
|
||||
result = FUNC(ccos) (BUILD_COMPLEX (minus_zero, nan_value));
|
||||
check_isnan ("real(ccos(-0 + i NaN)) = NaN", __real__ result);
|
||||
check ("imag(ccos(-0 + i NaN)) = +-0", FUNC(fabs) (__imag__ result), 0.0);
|
||||
|
||||
result = FUNC(ccos) (BUILD_COMPLEX (10.0, nan_value));
|
||||
check_isnan ("real(ccos(10 + i NaN)) = NaN", __real__ result);
|
||||
check_isnan ("imag(ccos(10 + i NaN)) = NaN", __imag__ result);
|
||||
result = FUNC(ccos) (BUILD_COMPLEX (-10.0, nan_value));
|
||||
check_isnan ("real(ccos(-10 + i NaN)) = NaN", __real__ result);
|
||||
check_isnan ("imag(ccos(-10 + i NaN)) = NaN", __imag__ result);
|
||||
|
||||
result = FUNC(ccos) (BUILD_COMPLEX (plus_infty, nan_value));
|
||||
check_isnan ("real(ccos(+Inf + i NaN)) = NaN", __real__ result);
|
||||
check_isnan ("imag(ccos(+Inf + i NaN)) = NaN", __imag__ result);
|
||||
result = FUNC(ccos) (BUILD_COMPLEX (minus_infty, nan_value));
|
||||
check_isnan ("real(ccos(-Inf + i NaN)) = NaN", __real__ result);
|
||||
check_isnan ("imag(ccos(-Inf + i NaN)) = NaN", __imag__ result);
|
||||
|
||||
result = FUNC(ccos) (BUILD_COMPLEX (nan_value, nan_value));
|
||||
check_isnan ("real(ccos(NaN + i NaN)) = NaN", __real__ result);
|
||||
check_isnan ("imag(ccos(NaN + i NaN)) = NaN", __imag__ result);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
ccosh_test (void)
|
||||
{
|
||||
__complex__ MATHTYPE result;
|
||||
|
||||
result = FUNC(ccosh) (BUILD_COMPLEX (0.0, 0.0));
|
||||
check ("real(ccosh(0 + 0i)) = 0", __real__ result, 1.0);
|
||||
check ("real(ccosh(0 + 0i)) = 1.0", __real__ result, 1.0);
|
||||
check ("imag(ccosh(0 + 0i)) = 0", __imag__ result, 0);
|
||||
result = FUNC(ccosh) (BUILD_COMPLEX (minus_zero, 0.0));
|
||||
check ("real(ccosh(-0 + 0i)) = -0", __real__ result, 1.0);
|
||||
check ("real(ccosh(-0 + 0i)) = 1.0", __real__ result, 1.0);
|
||||
check ("imag(ccosh(-0 + 0i)) = 0", __imag__ result, 0);
|
||||
result = FUNC(ccosh) (BUILD_COMPLEX (0.0, minus_zero));
|
||||
check ("real(ccosh(0 - 0i)) = 0", __real__ result, 1.0);
|
||||
check ("real(ccosh(0 - 0i)) = 1.0", __real__ result, 1.0);
|
||||
check ("imag(ccosh(0 - 0i)) = -0", __imag__ result, minus_zero);
|
||||
result = FUNC(ccosh) (BUILD_COMPLEX (minus_zero, minus_zero));
|
||||
check ("real(ccosh(-0 - 0i)) = -0", __real__ result, 1.0);
|
||||
check ("real(ccosh(-0 - 0i)) = 1.0", __real__ result, 1.0);
|
||||
check ("imag(ccosh(-0 - 0i)) = -0", __imag__ result, minus_zero);
|
||||
|
||||
result = FUNC(ccosh) (BUILD_COMPLEX (0.0, plus_infty));
|
||||
@ -1843,13 +1975,13 @@ ccosh_test (void)
|
||||
check ("imag(ccosh(0 + i Inf)) = +-0", FUNC(fabs) (__imag__ result), 0);
|
||||
result = FUNC(ccosh) (BUILD_COMPLEX (minus_zero, plus_infty));
|
||||
check_isnan ("real(ccosh(-0 + i Inf)) = NaN", __real__ result);
|
||||
check ("imag(ccosh(-0 + i Inf)) = -0", FUNC(fabs) (__imag__ result), 0);
|
||||
check ("imag(ccosh(-0 + i Inf)) = +-0", FUNC(fabs) (__imag__ result), 0);
|
||||
result = FUNC(ccosh) (BUILD_COMPLEX (0.0, minus_infty));
|
||||
check_isnan ("real(ccosh(0 - i Inf)) = NaN", __real__ result);
|
||||
check ("imag(ccosh(0 - i Inf)) = 0", FUNC(fabs) (__imag__ result), 0);
|
||||
check ("imag(ccosh(0 - i Inf)) = +-0", FUNC(fabs) (__imag__ result), 0);
|
||||
result = FUNC(ccosh) (BUILD_COMPLEX (minus_zero, minus_infty));
|
||||
check_isnan ("real(ccosh(-0 - i Inf)) = NaN", __real__ result);
|
||||
check ("imag(ccosh(-0 - i Inf)) = -0", FUNC(fabs) (__imag__ result), 0);
|
||||
check ("imag(ccosh(-0 - i Inf)) = +-0", FUNC(fabs) (__imag__ result), 0);
|
||||
|
||||
result = FUNC(ccosh) (BUILD_COMPLEX (plus_infty, 0.0));
|
||||
check_isinfp ("real(ccosh(+Inf + 0i)) = +Inf", __real__ result);
|
||||
@ -1915,7 +2047,7 @@ ccosh_test (void)
|
||||
check_isnan ("imag(ccosh(+Inf + i NaN)) = NaN", __imag__ result);
|
||||
result = FUNC(ccosh) (BUILD_COMPLEX (minus_infty, nan_value));
|
||||
check_isinfp ("real(ccosh(-Inf + i NaN)) = +Inf", __real__ result);
|
||||
check_isnan ("imag(ccosh(-0 + i NaN)) = NaN", __imag__ result);
|
||||
check_isnan ("imag(ccosh(-Inf + i NaN)) = NaN", __imag__ result);
|
||||
|
||||
result = FUNC(ccosh) (BUILD_COMPLEX (9.0, nan_value));
|
||||
check_isnan ("real(ccosh(9.0 + i NaN)) = NaN", __real__ result);
|
||||
@ -1926,10 +2058,10 @@ ccosh_test (void)
|
||||
|
||||
result = FUNC(ccosh) (BUILD_COMPLEX (nan_value, 0.0));
|
||||
check_isnan ("real(ccosh(NaN + i0)) = NaN", __real__ result);
|
||||
check ("imag(ccosh(NaN + i0)) = NaN", __imag__ result, 0.0);
|
||||
check ("imag(ccosh(NaN + i0)) = +-0", FUNC(fabs) (__imag__ result), 0.0);
|
||||
result = FUNC(ccosh) (BUILD_COMPLEX (nan_value, minus_zero));
|
||||
check_isnan ("real(ccosh(NaN - i0)) = NaN", __real__ result);
|
||||
check ("imag(ccosh(NaN - i0)) = NaN", __imag__ result, minus_zero);
|
||||
check ("imag(ccosh(NaN - i0)) = +-0", FUNC(fabs) (__imag__ result), 0.0);
|
||||
|
||||
result = FUNC(ccosh) (BUILD_COMPLEX (nan_value, 10.0));
|
||||
check_isnan ("real(ccosh(NaN + i10)) = NaN", __real__ result);
|
||||
@ -1951,8 +2083,6 @@ ccosh_test (void)
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
/* Enable these tests as soon as the functions are available. */
|
||||
static void
|
||||
cacos_test (void)
|
||||
{
|
||||
@ -2193,6 +2323,131 @@ cacosh_test (void)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
casin_test (void)
|
||||
{
|
||||
__complex__ MATHTYPE result;
|
||||
|
||||
result = FUNC(casin) (BUILD_COMPLEX (0, 0));
|
||||
check ("real(casin(0 + i0)) = 0", __real__ result, 0);
|
||||
check ("imag(casin(0 + i0)) = 0", __imag__ result, 0);
|
||||
result = FUNC(casin) (BUILD_COMPLEX (minus_zero, 0));
|
||||
check ("real(casin(-0 + i0)) = -0", __real__ result, minus_zero);
|
||||
check ("imag(casin(-0 + i0)) = 0", __imag__ result, 0);
|
||||
result = FUNC(casin) (BUILD_COMPLEX (0, minus_zero));
|
||||
check ("real(casin(0 - i0)) = 0", __real__ result, 0);
|
||||
check ("imag(casin(0 - i0)) = -0", __imag__ result, minus_zero);
|
||||
result = FUNC(casin) (BUILD_COMPLEX (minus_zero, minus_zero));
|
||||
check ("real(casin(-0 - i0)) = -0", __real__ result, minus_zero);
|
||||
check ("imag(casin(-0 - i0)) = -0", __imag__ result, minus_zero);
|
||||
|
||||
result = FUNC(casin) (BUILD_COMPLEX (plus_infty, plus_infty));
|
||||
check ("real(casin(+Inf + i Inf)) = pi/4", __real__ result, M_PI_4);
|
||||
check_isinfp ("imag(casin(+Inf + i Inf)) = +Inf", __imag__ result);
|
||||
result = FUNC(casin) (BUILD_COMPLEX (plus_infty, minus_infty));
|
||||
check ("real(casin(+Inf - i Inf)) = pi/4", __real__ result, M_PI_4);
|
||||
check_isinfn ("imag(casin(+Inf - i Inf)) = -Inf", __imag__ result);
|
||||
result = FUNC(casin) (BUILD_COMPLEX (minus_infty, plus_infty));
|
||||
check ("real(casin(-Inf + i Inf)) = -pi/4", __real__ result, -M_PI_4);
|
||||
check_isinfp ("imag(casin(-Inf + i Inf)) = +Inf", __imag__ result);
|
||||
result = FUNC(casin) (BUILD_COMPLEX (minus_infty, minus_infty));
|
||||
check ("real(casin(-Inf - i Inf)) = -pi/4", __real__ result, -M_PI_4);
|
||||
check_isinfn ("imag(casin(-Inf - i Inf)) = -Inf", __imag__ result);
|
||||
|
||||
result = FUNC(casin) (BUILD_COMPLEX (-10.0, plus_infty));
|
||||
check ("real(casin(-10.0 + i Inf)) = -0", __real__ result, minus_zero);
|
||||
check_isinfp ("imag(casin(-10.0 + i Inf)) = +Inf", __imag__ result);
|
||||
result = FUNC(casin) (BUILD_COMPLEX (-10.0, minus_infty));
|
||||
check ("real(casin(-10.0 - i Inf)) = -0", __real__ result, minus_zero);
|
||||
check_isinfn ("imag(casin(-10.0 - i Inf)) = -Inf", __imag__ result);
|
||||
result = FUNC(casin) (BUILD_COMPLEX (0, plus_infty));
|
||||
check ("real(casin(0 + i Inf)) = 0", __real__ result, 0.0);
|
||||
check_isinfp ("imag(casin(0 + i Inf)) = +Inf", __imag__ result);
|
||||
result = FUNC(casin) (BUILD_COMPLEX (0, minus_infty));
|
||||
check ("real(casin(0 - i Inf)) = 0", __real__ result, 0.0);
|
||||
check_isinfn ("imag(casin(0 - i Inf)) = -Inf", __imag__ result);
|
||||
result = FUNC(casin) (BUILD_COMPLEX (minus_zero, plus_infty));
|
||||
check ("real(casin(-0 + i Inf)) = -0", __real__ result, minus_zero);
|
||||
check_isinfp ("imag(casin(-0 + i Inf)) = +Inf", __imag__ result);
|
||||
result = FUNC(casin) (BUILD_COMPLEX (minus_zero, minus_infty));
|
||||
check ("real(casin(-0 - i Inf)) = -0", __real__ result, minus_zero);
|
||||
check_isinfn ("imag(casin(-0 - i Inf)) = -Inf", __imag__ result);
|
||||
result = FUNC(casin) (BUILD_COMPLEX (0.1, plus_infty));
|
||||
check ("real(casin(0.1 + i Inf)) = 0", __real__ result, 0);
|
||||
check_isinfp ("imag(casin(0.1 + i Inf)) = +Inf", __imag__ result);
|
||||
result = FUNC(casin) (BUILD_COMPLEX (0.1, minus_infty));
|
||||
check ("real(casin(0.1 - i Inf)) = 0", __real__ result, 0);
|
||||
check_isinfn ("imag(casin(0.1 - i Inf)) = -Inf", __imag__ result);
|
||||
|
||||
result = FUNC(casin) (BUILD_COMPLEX (minus_infty, 0));
|
||||
check ("real(casin(-Inf + i0)) = -pi/2", __real__ result, -M_PI_2);
|
||||
check_isinfp ("imag(casin(-Inf + i0)) = +Inf", __imag__ result);
|
||||
result = FUNC(casin) (BUILD_COMPLEX (minus_infty, minus_zero));
|
||||
check ("real(casin(-Inf - i0)) = -pi/2", __real__ result, -M_PI_2);
|
||||
check_isinfn ("imag(casin(-Inf - i0)) = -Inf", __imag__ result);
|
||||
result = FUNC(casin) (BUILD_COMPLEX (minus_infty, 100));
|
||||
check ("real(casin(-Inf + i100)) = -pi/2", __real__ result, -M_PI_2);
|
||||
check_isinfp ("imag(casin(-Inf + i100)) = +Inf", __imag__ result);
|
||||
result = FUNC(casin) (BUILD_COMPLEX (minus_infty, -100));
|
||||
check ("real(casin(-Inf - i100)) = -pi/2", __real__ result, -M_PI_2);
|
||||
check_isinfn ("imag(casin(-Inf - i100)) = -Inf", __imag__ result);
|
||||
|
||||
result = FUNC(casin) (BUILD_COMPLEX (plus_infty, 0));
|
||||
check ("real(casin(+Inf + i0)) = pi/2", __real__ result, M_PI_2);
|
||||
check_isinfp ("imag(casin(+Inf + i0)) = +Inf", __imag__ result);
|
||||
result = FUNC(casin) (BUILD_COMPLEX (plus_infty, minus_zero));
|
||||
check ("real(casin(+Inf - i0)) = pi/2", __real__ result, M_PI_2);
|
||||
check_isinfn ("imag(casin(+Inf - i0)) = -Inf", __imag__ result);
|
||||
result = FUNC(casin) (BUILD_COMPLEX (plus_infty, 0.5));
|
||||
check ("real(casin(+Inf + i0.5)) = pi/2", __real__ result, M_PI_2);
|
||||
check_isinfp ("imag(casin(+Inf + i0.5)) = +Inf", __imag__ result);
|
||||
result = FUNC(casin) (BUILD_COMPLEX (plus_infty, -0.5));
|
||||
check ("real(casin(+Inf - i0.5)) = pi/2", __real__ result, M_PI_2);
|
||||
check_isinfn ("imag(casin(+Inf - i0.5)) = -Inf", __imag__ result);
|
||||
|
||||
result = FUNC(casin) (BUILD_COMPLEX (nan_value, plus_infty));
|
||||
check_isnan ("real(casin(NaN + i Inf)) = NaN", __real__ result);
|
||||
check_isinfp ("imag(casin(NaN + i Inf)) = +Inf", __imag__ result);
|
||||
result = FUNC(casin) (BUILD_COMPLEX (nan_value, minus_infty));
|
||||
check_isnan ("real(casin(NaN - i Inf)) = NaN", __real__ result);
|
||||
check_isinfn ("imag(casin(NaN - i Inf)) = -Inf", __imag__ result);
|
||||
|
||||
result = FUNC(casin) (BUILD_COMPLEX (0.0, nan_value));
|
||||
check ("real(casin(0 + i NaN)) = 0", __real__ result, 0.0);
|
||||
check_isnan ("imag(casin(0 + i NaN)) = NaN", __imag__ result);
|
||||
result = FUNC(casin) (BUILD_COMPLEX (minus_zero, nan_value));
|
||||
check ("real(casin(-0 + i NaN)) = -0", __real__ result, minus_zero);
|
||||
check_isnan ("imag(casin(-0 + i NaN)) = NaN", __imag__ result);
|
||||
|
||||
result = FUNC(casin) (BUILD_COMPLEX (plus_infty, nan_value));
|
||||
check_isnan ("real(casin(+Inf + i NaN)) = NaN", __real__ result);
|
||||
check_isinfp ("imag(casin(+Inf + i NaN)) = +-Inf",
|
||||
FUNC(fabs) (__imag__ result));
|
||||
result = FUNC(casin) (BUILD_COMPLEX (minus_infty, nan_value));
|
||||
check_isnan ("real(casin(-Inf + i NaN)) = NaN", __real__ result);
|
||||
check_isinfp ("imag(casin(-Inf + NaN)) = +-Inf",
|
||||
FUNC(fabs) (__imag__ result));
|
||||
|
||||
result = FUNC(casin) (BUILD_COMPLEX (nan_value, 10.5));
|
||||
check_isnan ("real(casin(NaN + i10.5)) = NaN", __real__ result);
|
||||
check_isnan ("imag(casin(NaN + i10.5)) = NaN", __imag__ result);
|
||||
result = FUNC(casin) (BUILD_COMPLEX (nan_value, -10.5));
|
||||
check_isnan ("real(casin(NaN - i10.5)) = NaN", __real__ result);
|
||||
check_isnan ("imag(casin(NaN - i10.5)) = NaN", __imag__ result);
|
||||
|
||||
result = FUNC(casin) (BUILD_COMPLEX (0.75, nan_value));
|
||||
check_isnan ("real(casin(0.75 + i NaN)) = NaN", __real__ result);
|
||||
check_isnan ("imag(casin(0.75 + i NaN)) = NaN", __imag__ result);
|
||||
result = FUNC(casin) (BUILD_COMPLEX (-0.75, nan_value));
|
||||
check_isnan ("real(casin(-0.75 + i NaN)) = NaN", __real__ result);
|
||||
check_isnan ("imag(casin(-0.75 + i NaN)) = NaN", __imag__ result);
|
||||
|
||||
result = FUNC(casin) (BUILD_COMPLEX (nan_value, nan_value));
|
||||
check_isnan ("real(casin(NaN + i NaN)) = NaN", __real__ result);
|
||||
check_isnan ("imag(casin(NaN + i NaN)) = NaN", __imag__ result);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
casinh_test (void)
|
||||
{
|
||||
@ -2236,6 +2491,12 @@ casinh_test (void)
|
||||
result = FUNC(casinh) (BUILD_COMPLEX (0, minus_infty));
|
||||
check_isinfp ("real(casinh(0 - i Inf)) = +Inf", __real__ result);
|
||||
check ("imag(casinh(0 - i Inf)) = -pi/2", __imag__ result, -M_PI_2);
|
||||
result = FUNC(casinh) (BUILD_COMPLEX (minus_zero, plus_infty));
|
||||
check_isinfn ("real(casinh(-0 + i Inf)) = -Inf", __real__ result);
|
||||
check ("imag(casinh(-0 + i Inf)) = pi/2", __imag__ result, M_PI_2);
|
||||
result = FUNC(casinh) (BUILD_COMPLEX (minus_zero, minus_infty));
|
||||
check_isinfn ("real(casinh(-0 - i Inf)) = -Inf", __real__ result);
|
||||
check ("imag(casinh(-0 - i Inf)) = -pi/2", __imag__ result, -M_PI_2);
|
||||
result = FUNC(casinh) (BUILD_COMPLEX (0.1, plus_infty));
|
||||
check_isinfp ("real(casinh(0.1 + i Inf)) = +Inf", __real__ result);
|
||||
check ("imag(casinh(0.1 + i Inf)) = pi/2", __imag__ result, M_PI_2);
|
||||
@ -2278,17 +2539,17 @@ casinh_test (void)
|
||||
|
||||
result = FUNC(casinh) (BUILD_COMPLEX (nan_value, 0));
|
||||
check_isnan ("real(casinh(NaN + i0)) = NaN", __real__ result);
|
||||
check ("imag(casinh(NaN + i0)) = 0", __imag__ resul, 0);
|
||||
result = FUNC(casinh) (BUILD_COMPLEX (minus_zero, nan_value));
|
||||
check ("imag(casinh(NaN + i0)) = 0", __imag__ result, 0);
|
||||
result = FUNC(casinh) (BUILD_COMPLEX (nan_value, minus_zero));
|
||||
check_isnan ("real(casinh(NaN - i0)) = NaN", __real__ result);
|
||||
check ("imag(casinh(NaN - i0)) = -0", __imag__ result, minus_zero);
|
||||
|
||||
result = FUNC(casinh) (BUILD_COMPLEX (nan_value, plus_infty));
|
||||
check_isinfp ("real(casinh(NaN + i Inf)) = +Inf",
|
||||
check_isinfp ("real(casinh(NaN + i Inf)) = +-Inf",
|
||||
FUNC(fabs) (__real__ result));
|
||||
check_isnan ("imag(casinh(NaN + i Inf)) = NaN", __imag__ result);
|
||||
result = FUNC(casinh) (BUILD_COMPLEX (nan_value, minus_infty));
|
||||
check_isinfp ("real(casinh(NaN - i Inf)) = +Inf",
|
||||
check_isinfp ("real(casinh(NaN - i Inf)) = +-Inf",
|
||||
FUNC(fabs) (__real__ result));
|
||||
check_isnan ("imag(casinh(NaN - i Inf)) = NaN", __imag__ result);
|
||||
|
||||
@ -2302,7 +2563,7 @@ casinh_test (void)
|
||||
result = FUNC(casinh) (BUILD_COMPLEX (nan_value, 0.75));
|
||||
check_isnan ("real(casinh(NaN + i0.75)) = NaN", __real__ result);
|
||||
check_isnan ("imag(casinh(NaN + i0.75)) = NaN", __imag__ result);
|
||||
result = FUNC(casinh) (BUILD_COMPLEX (-10.5, nan_value));
|
||||
result = FUNC(casinh) (BUILD_COMPLEX (-0.75, nan_value));
|
||||
check_isnan ("real(casinh(NaN - i0.75)) = NaN", __real__ result);
|
||||
check_isnan ("imag(casinh(NaN - i0.75)) = NaN", __imag__ result);
|
||||
|
||||
@ -2312,6 +2573,136 @@ casinh_test (void)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
catan_test (void)
|
||||
{
|
||||
__complex__ MATHTYPE result;
|
||||
|
||||
result = FUNC(catan) (BUILD_COMPLEX (0, 0));
|
||||
check ("real(catan(0 + i0)) = 0", __real__ result, 0);
|
||||
check ("imag(catan(0 + i0)) = 0", __imag__ result, 0);
|
||||
result = FUNC(catan) (BUILD_COMPLEX (minus_zero, 0));
|
||||
check ("real(catan(-0 + i0)) = -0", __real__ result, minus_zero);
|
||||
check ("imag(catan(-0 + i0)) = 0", __imag__ result, 0);
|
||||
result = FUNC(catan) (BUILD_COMPLEX (0, minus_zero));
|
||||
check ("real(catan(0 - i0)) = 0", __real__ result, 0);
|
||||
check ("imag(catan(0 - i0)) = -0", __imag__ result, minus_zero);
|
||||
result = FUNC(catan) (BUILD_COMPLEX (minus_zero, minus_zero));
|
||||
check ("real(catan(-0 - i0)) = -0", __real__ result, minus_zero);
|
||||
check ("imag(catan(-0 - i0)) = -0", __imag__ result, minus_zero);
|
||||
|
||||
result = FUNC(catan) (BUILD_COMPLEX (plus_infty, plus_infty));
|
||||
check ("real(catan(+Inf + i Inf)) = pi/2", __real__ result, M_PI_2);
|
||||
check ("imag(catan(+Inf + i Inf)) = 0", __imag__ result, 0);
|
||||
result = FUNC(catan) (BUILD_COMPLEX (plus_infty, minus_infty));
|
||||
check ("real(catan(+Inf - i Inf)) = pi/2", __real__ result, M_PI_2);
|
||||
check ("imag(catan(+Inf - i Inf)) = -0", __imag__ result, minus_zero);
|
||||
result = FUNC(catan) (BUILD_COMPLEX (minus_infty, plus_infty));
|
||||
check ("real(catan(-Inf + i Inf)) = -pi/2", __real__ result, -M_PI_2);
|
||||
check ("imag(catan(-Inf + i Inf)) = 0", __imag__ result, 0.0);
|
||||
result = FUNC(catan) (BUILD_COMPLEX (minus_infty, minus_infty));
|
||||
check ("real(catan(-Inf - i Inf)) = -pi/2", __real__ result, -M_PI_2);
|
||||
check ("imag(catan(-Inf - i Inf)) = -0", __imag__ result, minus_zero);
|
||||
|
||||
result = FUNC(catan) (BUILD_COMPLEX (plus_infty, -10.0));
|
||||
check ("real(catan(+Inf - i10.0)) = pi/2", __real__ result, M_PI_2);
|
||||
check ("imag(catan(+Inf - i10.0)) = -0", __imag__ result, minus_zero);
|
||||
result = FUNC(catan) (BUILD_COMPLEX (minus_infty, -10.0));
|
||||
check ("real(catan(-Inf - i10.0)) = -pi/2", __real__ result, -M_PI_2);
|
||||
check ("imag(catan(-Inf - i10.0)) = -0", __imag__ result, minus_zero);
|
||||
result = FUNC(catan) (BUILD_COMPLEX (plus_infty, minus_zero));
|
||||
check ("real(catan(Inf - i0)) = pi/2", __real__ result, M_PI_2);
|
||||
check ("imag(catan(Inf - i0)) = -0", __imag__ result, minus_zero);
|
||||
result = FUNC(catan) (BUILD_COMPLEX (minus_infty, minus_zero));
|
||||
check ("real(catan(-Inf - i0)) = -pi/2", __real__ result, -M_PI_2);
|
||||
check ("imag(catan(-Inf - i0)) = -0", __imag__ result, minus_zero);
|
||||
result = FUNC(catan) (BUILD_COMPLEX (plus_infty, 0.0));
|
||||
check ("real(catan(Inf + i0)) = pi/2", __real__ result, M_PI_2);
|
||||
check ("imag(catan(Inf + i0)) = 0", __imag__ result, 0.0);
|
||||
result = FUNC(catan) (BUILD_COMPLEX (minus_infty, 0.0));
|
||||
check ("real(catan(-Inf + i0)) = -pi/2", __real__ result, -M_PI_2);
|
||||
check ("imag(catan(-Inf + i0)) = 0", __imag__ result, 0.0);
|
||||
result = FUNC(catan) (BUILD_COMPLEX (plus_infty, 0.1));
|
||||
check ("real(catan(+Inf + i0.1)) = pi/2", __real__ result, M_PI_2);
|
||||
check ("imag(catan(+Inf + i0.1)) = 0", __imag__ result, 0);
|
||||
result = FUNC(catan) (BUILD_COMPLEX (minus_infty, 0.1));
|
||||
check ("real(catan(-Inf + i0.1)) = -pi/2", __real__ result, -M_PI_2);
|
||||
check ("imag(catan(-Inf + i0.1)) = 0", __imag__ result, 0);
|
||||
|
||||
result = FUNC(catan) (BUILD_COMPLEX (0.0, minus_infty));
|
||||
check ("real(catan(0 - i Inf)) = pi/2", __real__ result, M_PI_2);
|
||||
check ("imag(catan(0 - i Inf)) = -0", __imag__ result, minus_zero);
|
||||
result = FUNC(catan) (BUILD_COMPLEX (minus_zero, minus_infty));
|
||||
check ("real(catan(-0 - i Inf)) = -pi/2", __real__ result, -M_PI_2);
|
||||
check ("imag(catan(-0 - i Inf)) = -0", __imag__ result, minus_zero);
|
||||
result = FUNC(catan) (BUILD_COMPLEX (100.0, minus_infty));
|
||||
check ("real(catan(100 - i Inf)) = pi/2", __real__ result, M_PI_2);
|
||||
check ("imag(catan(100 - i Inf)) = -0", __imag__ result, minus_zero);
|
||||
result = FUNC(catan) (BUILD_COMPLEX (-100.0, minus_infty));
|
||||
check ("real(catan(-100 - i Inf)) = -pi/2", __real__ result, -M_PI_2);
|
||||
check ("imag(catan(-100 - i Inf)) = -0", __imag__ result, minus_zero);
|
||||
|
||||
result = FUNC(catan) (BUILD_COMPLEX (0.0, plus_infty));
|
||||
check ("real(catan(0 + i Inf)) = pi/2", __real__ result, M_PI_2);
|
||||
check ("imag(catan(0 + i Inf)) = 0", __imag__ result, 0);
|
||||
result = FUNC(catan) (BUILD_COMPLEX (minus_zero, plus_infty));
|
||||
check ("real(catan(-0 + i Inf)) = -pi/2", __real__ result, -M_PI_2);
|
||||
check ("imag(catan(-0 + i Inf)) = 0", __imag__ result, 0);
|
||||
result = FUNC(catan) (BUILD_COMPLEX (0.5, plus_infty));
|
||||
check ("real(catan(0.5 + i Inf)) = pi/2", __real__ result, M_PI_2);
|
||||
check ("imag(catan(0.5 + i Inf)) = 0", __imag__ result, 0);
|
||||
result = FUNC(catan) (BUILD_COMPLEX (-0.5, plus_infty));
|
||||
check ("real(catan(-0.5 + i Inf)) = -pi/2", __real__ result, -M_PI_2);
|
||||
check ("imag(catan(-0.5 + i Inf)) = 0", __imag__ result, 0);
|
||||
|
||||
result = FUNC(catan) (BUILD_COMPLEX (nan_value, 0.0));
|
||||
check_isnan ("real(catan(NaN + i0)) = NaN", __real__ result);
|
||||
check ("imag(catan(NaN + i0)) = 0", __imag__ result, 0.0);
|
||||
result = FUNC(catan) (BUILD_COMPLEX (nan_value, minus_zero));
|
||||
check_isnan ("real(catan(NaN - i0)) = NaN", __real__ result);
|
||||
check ("imag(catan(NaN - i0)) = -0", __imag__ result, minus_zero);
|
||||
|
||||
result = FUNC(catan) (BUILD_COMPLEX (nan_value, plus_infty));
|
||||
check_isnan ("real(catan(NaN + i Inf)) = NaN", __real__ result);
|
||||
check ("imag(catan(NaN + i Inf)) = 0", __imag__ result, 0);
|
||||
result = FUNC(catan) (BUILD_COMPLEX (nan_value, minus_infty));
|
||||
check_isnan ("real(catan(NaN - i Inf)) = NaN", __real__ result);
|
||||
check ("imag(catan(NaN - i Inf)) = -0", __imag__ result, minus_zero);
|
||||
|
||||
result = FUNC(catan) (BUILD_COMPLEX (0.0, nan_value));
|
||||
check_isnan ("real(catan(0 + i NaN)) = NaN", __real__ result);
|
||||
check_isnan ("imag(catan(0 + i NaN)) = NaN", __imag__ result);
|
||||
result = FUNC(catan) (BUILD_COMPLEX (minus_zero, nan_value));
|
||||
check_isnan ("real(catan(-0 + i NaN)) = NaN", __real__ result);
|
||||
check_isnan ("imag(catan(-0 + i NaN)) = NaN", __imag__ result);
|
||||
|
||||
result = FUNC(catan) (BUILD_COMPLEX (plus_infty, nan_value));
|
||||
check ("real(catan(+Inf + i NaN)) = pi/2", __real__ result, M_PI_2);
|
||||
check ("imag(catan(+Inf + i NaN)) = +-0", FUNC(fabs) (__imag__ result), 0);
|
||||
result = FUNC(catan) (BUILD_COMPLEX (minus_infty, nan_value));
|
||||
check ("real(catan(-Inf + i NaN)) = -pi/2", __real__ result, -M_PI_2);
|
||||
check ("imag(catan(-Inf + i NaN)) = +-0", FUNC(fabs) (__imag__ result), 0);
|
||||
|
||||
result = FUNC(catan) (BUILD_COMPLEX (nan_value, 10.5));
|
||||
check_isnan ("real(catan(NaN + i10.5)) = NaN", __real__ result);
|
||||
check_isnan ("imag(catan(NaN + i10.5)) = NaN", __imag__ result);
|
||||
result = FUNC(catan) (BUILD_COMPLEX (nan_value, -10.5));
|
||||
check_isnan ("real(catan(NaN - i10.5)) = NaN", __real__ result);
|
||||
check_isnan ("imag(catan(NaN - i10.5)) = NaN", __imag__ result);
|
||||
|
||||
result = FUNC(catan) (BUILD_COMPLEX (0.75, nan_value));
|
||||
check_isnan ("real(catan(0.75 + i NaN)) = NaN", __real__ result);
|
||||
check_isnan ("imag(catan(0.75 + i NaN)) = NaN", __imag__ result);
|
||||
result = FUNC(catan) (BUILD_COMPLEX (-0.75, nan_value));
|
||||
check_isnan ("real(catan(-0.75 + i NaN)) = NaN", __real__ result);
|
||||
check_isnan ("imag(catan(-0.75 + i NaN)) = NaN", __imag__ result);
|
||||
|
||||
result = FUNC(catan) (BUILD_COMPLEX (nan_value, nan_value));
|
||||
check_isnan ("real(catan(NaN + i NaN)) = NaN", __real__ result);
|
||||
check_isnan ("imag(catan(NaN + i NaN)) = NaN", __imag__ result);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
catanh_test (void)
|
||||
{
|
||||
@ -2344,11 +2735,17 @@ catanh_test (void)
|
||||
check ("imag(catanh(-Inf - i Inf)) = -pi/2", __imag__ result, -M_PI_2);
|
||||
|
||||
result = FUNC(catanh) (BUILD_COMPLEX (-10.0, plus_infty));
|
||||
check ("real(catanh(-10.0 + i Inf)) = -0", __real__ result, -minus_zero);
|
||||
check ("real(catanh(-10.0 + i Inf)) = -0", __real__ result, minus_zero);
|
||||
check ("imag(catanh(-10.0 + i Inf)) = pi/2", __imag__ result, M_PI_2);
|
||||
result = FUNC(catanh) (BUILD_COMPLEX (-10.0, minus_infty));
|
||||
check ("real(catanh(-10.0 - i Inf)) = -0", __real__ result, minus_infty);
|
||||
check ("real(catanh(-10.0 - i Inf)) = -0", __real__ result, minus_zero);
|
||||
check ("imag(catanh(-10.0 - i Inf)) = -pi/2", __imag__ result, -M_PI_2);
|
||||
result = FUNC(catanh) (BUILD_COMPLEX (minus_zero, plus_infty));
|
||||
check ("real(catanh(-0 + i Inf)) = -0", __real__ result, minus_zero);
|
||||
check ("imag(catanh(-0 + i Inf)) = pi/2", __imag__ result, M_PI_2);
|
||||
result = FUNC(catanh) (BUILD_COMPLEX (minus_zero, minus_infty));
|
||||
check ("real(catanh(-0 - i Inf)) = -0", __real__ result, minus_zero);
|
||||
check ("imag(catanh(-0 - i Inf)) = -pi/2", __imag__ result, -M_PI_2);
|
||||
result = FUNC(catanh) (BUILD_COMPLEX (0, plus_infty));
|
||||
check ("real(catanh(0 + i Inf)) = 0", __real__ result, 0);
|
||||
check ("imag(catanh(0 + i Inf)) = pi/2", __imag__ result, M_PI_2);
|
||||
@ -2390,10 +2787,10 @@ catanh_test (void)
|
||||
|
||||
result = FUNC(catanh) (BUILD_COMPLEX (0, nan_value));
|
||||
check ("real(catanh(0 + i NaN)) = 0", __real__ result, 0);
|
||||
check_isnan ("imag(catanh(+Inf + i NaN)) = NaN", __imag__ result);
|
||||
check_isnan ("imag(catanh(0 + i NaN)) = NaN", __imag__ result);
|
||||
result = FUNC(catanh) (BUILD_COMPLEX (minus_zero, nan_value));
|
||||
check ("real(catanh(-0 + i NaN)) = -0", __real__ result, minus_zero);
|
||||
check_isnan ("imag(catanh(-Inf + i NaN)) = NaN", __imag__ result);
|
||||
check_isnan ("imag(catanh(-0 + i NaN)) = NaN", __imag__ result);
|
||||
|
||||
result = FUNC(catanh) (BUILD_COMPLEX (plus_infty, nan_value));
|
||||
check ("real(catanh(+Inf + i NaN)) = 0", __real__ result, 0);
|
||||
@ -2404,8 +2801,8 @@ catanh_test (void)
|
||||
|
||||
result = FUNC(catanh) (BUILD_COMPLEX (nan_value, 0));
|
||||
check_isnan ("real(catanh(NaN + i0)) = NaN", __real__ result);
|
||||
check_isnan ("imag(catanh(NaN + i0)) = NaN", __imag__ resul);
|
||||
result = FUNC(catanh) (BUILD_COMPLEX (minus_zero, nan_value));
|
||||
check_isnan ("imag(catanh(NaN + i0)) = NaN", __imag__ result);
|
||||
result = FUNC(catanh) (BUILD_COMPLEX (nan_value, minus_zero));
|
||||
check_isnan ("real(catanh(NaN - i0)) = NaN", __real__ result);
|
||||
check_isnan ("imag(catanh(NaN - i0)) = NaN", __imag__ result);
|
||||
|
||||
@ -2426,7 +2823,7 @@ catanh_test (void)
|
||||
result = FUNC(catanh) (BUILD_COMPLEX (nan_value, 0.75));
|
||||
check_isnan ("real(catanh(NaN + i0.75)) = NaN", __real__ result);
|
||||
check_isnan ("imag(catanh(NaN + i0.75)) = NaN", __imag__ result);
|
||||
result = FUNC(catanh) (BUILD_COMPLEX (-10.5, nan_value));
|
||||
result = FUNC(catanh) (BUILD_COMPLEX (nan_value, -0.75));
|
||||
check_isnan ("real(catanh(NaN - i0.75)) = NaN", __real__ result);
|
||||
check_isnan ("imag(catanh(NaN - i0.75)) = NaN", __imag__ result);
|
||||
|
||||
@ -2449,7 +2846,7 @@ ctanh_test (void)
|
||||
check ("imag(ctanh(0 - i0)) = -0", __imag__ result, minus_zero);
|
||||
result = FUNC(ctanh) (BUILD_COMPLEX (minus_zero, 0));
|
||||
check ("real(ctanh(-0 + i0)) = -0", __real__ result, minus_zero);
|
||||
check ("imag(ctanh(-0 + i0)) = -0", __imag__ result, 0);
|
||||
check ("imag(ctanh(-0 + i0)) = 0", __imag__ result, 0);
|
||||
result = FUNC(ctanh) (BUILD_COMPLEX (minus_zero, minus_zero));
|
||||
check ("real(ctanh(-0 - i0)) = -0", __real__ result, minus_zero);
|
||||
check ("imag(ctanh(-0 - i0)) = -0", __imag__ result, minus_zero);
|
||||
@ -2472,7 +2869,7 @@ ctanh_test (void)
|
||||
result = FUNC(ctanh) (BUILD_COMPLEX (minus_infty, 1));
|
||||
check ("real(ctanh(-Inf + i1)) = -1", __real__ result, -1);
|
||||
check ("imag(ctanh(-Inf + i1)) = 0", __imag__ result, 0);
|
||||
result = FUNC(ctanh) (BUILD_COMPLEX (pminus_infty, minus_zero));
|
||||
result = FUNC(ctanh) (BUILD_COMPLEX (minus_infty, minus_zero));
|
||||
check ("real(ctanh(-Inf - i0)) = -1", __real__ result, -1);
|
||||
check ("imag(ctanh(-Inf - i0)) = -0", __imag__ result, minus_zero);
|
||||
result = FUNC(ctanh) (BUILD_COMPLEX (minus_infty, -1));
|
||||
@ -2514,9 +2911,9 @@ ctanh_test (void)
|
||||
result = FUNC(ctanh) (BUILD_COMPLEX (nan_value, 0));
|
||||
check_isnan ("real(ctanh(NaN + i0)) = NaN", __real__ result);
|
||||
check ("imag(ctanh(NaN + i0)) = 0", __imag__ result, 0);
|
||||
result = FUNC(ctanh) (BUILD_COMPLEX (nan_value, minus_infty));
|
||||
result = FUNC(ctanh) (BUILD_COMPLEX (nan_value, minus_zero));
|
||||
check_isnan ("real(ctanh(NaN - i0)) = NaN", __real__ result);
|
||||
check ("imag(ctanh(NaN - i0)) = -0", __imag__ result, minus_infty);
|
||||
check ("imag(ctanh(NaN - i0)) = -0", __imag__ result, minus_zero);
|
||||
|
||||
result = FUNC(ctanh) (BUILD_COMPLEX (nan_value, 0.5));
|
||||
check_isnan ("real(ctanh(NaN + i0.5)) = NaN", __real__ result);
|
||||
@ -2542,7 +2939,6 @@ ctanh_test (void)
|
||||
check_isnan ("real(ctanh(NaN + i NaN)) = NaN", __real__ result);
|
||||
check_isnan ("imag(ctanh(NaN + i NaN)) = NaN", __imag__ result);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
static void
|
||||
@ -2639,7 +3035,7 @@ clog_test (void)
|
||||
result = FUNC(clog) (BUILD_COMPLEX (nan_value, plus_infty));
|
||||
check_isinfp ("real(clog(NaN + i Inf)) = +Inf", __real__ result);
|
||||
check_isnan ("imag(clog(NaN + i Inf)) = NaN", __imag__ result);
|
||||
result = FUNC(clog) (BUILD_COMPLEX (minus_infty, nan_value));
|
||||
result = FUNC(clog) (BUILD_COMPLEX (nan_value, minus_infty));
|
||||
check_isinfp ("real(clog(NaN - i Inf)) = +Inf", __real__ result);
|
||||
check_isnan ("imag(clog(NaN - i Inf)) = NaN", __imag__ result);
|
||||
|
||||
@ -2675,7 +3071,6 @@ clog_test (void)
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
static void
|
||||
csqrt_test (void)
|
||||
{
|
||||
@ -2709,16 +3104,16 @@ csqrt_test (void)
|
||||
|
||||
result = FUNC(csqrt) (BUILD_COMPLEX (plus_infty, 0));
|
||||
check_isinfp ("real(csqrt(+Inf + i0)) = +Inf", __real__ result);
|
||||
check ("imag(csqrt(-Inf + i0)) = 0", __imag__ result, 0);
|
||||
check ("imag(csqrt(+Inf + i0)) = 0", __imag__ result, 0);
|
||||
result = FUNC(csqrt) (BUILD_COMPLEX (plus_infty, 6));
|
||||
check_isinfp ("real(csqrt(+Inf + i6)) = +Inf", __real__ result);
|
||||
check ("imag(csqrt(-Inf + i6)) = 0", __imag__ result, 0);
|
||||
check ("imag(csqrt(+Inf + i6)) = 0", __imag__ result, 0);
|
||||
result = FUNC(csqrt) (BUILD_COMPLEX (plus_infty, minus_zero));
|
||||
check_isinfp ("real(csqrt(+Inf - i0)) = +Inf", __real__ result);
|
||||
check ("imag(csqrt(-Inf - i0)) = -0", __imag__ result, minus_zero);
|
||||
check ("imag(csqrt(+Inf - i0)) = -0", __imag__ result, minus_zero);
|
||||
result = FUNC(csqrt) (BUILD_COMPLEX (plus_infty, -6));
|
||||
check_isinfp ("real(csqrt(+Inf - i6)) = +Inf", __real__ result);
|
||||
check ("imag(csqrt(-Inf - i6)) = -0", __imag__ result, minus_zero);
|
||||
check ("imag(csqrt(+Inf - i6)) = -0", __imag__ result, minus_zero);
|
||||
|
||||
result = FUNC(csqrt) (BUILD_COMPLEX (0, plus_infty));
|
||||
check_isinfp ("real(csqrt(0 + i Inf)) = +Inf", __real__ result);
|
||||
@ -2796,7 +3191,23 @@ csqrt_test (void)
|
||||
check_isnan ("real(csqrt(NaN + i NaN)) = NaN", __real__ result);
|
||||
check_isnan ("imag(csqrt(NaN + i NaN)) = NaN", __imag__ result);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
static void
|
||||
cpow_test (void)
|
||||
{
|
||||
__complex__ MATHTYPE result;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
rint_test (void)
|
||||
{
|
||||
check ("rint(0) = 0", FUNC(rint) (0.0), 0.0);
|
||||
check ("rint(-0) = -0", FUNC(rint) (minus_zero), minus_zero);
|
||||
check_isinfp ("rint(+Inf) = +Inf", FUNC(rint) (plus_infty));
|
||||
check_isinfn ("rint(-Inf) = -Inf", FUNC(rint) (minus_infty));
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
@ -2806,16 +3217,17 @@ rinttol_test (void)
|
||||
the rounding method and test the critical cases. So far, only
|
||||
unproblematic numbers are tested. */
|
||||
|
||||
check_long ("rinttol(0) = 0", 0.0, 0);
|
||||
check_long ("rinttol(-0) = 0", minus_zero, 0);
|
||||
check_long ("rinttol(0.2) = 0", 0.2, 0);
|
||||
check_long ("rinttol(-0.2) = 0", -0.2, 0);
|
||||
check_long ("rinttol(0) = 0", rinttol (0.0), 0);
|
||||
check_long ("rinttol(-0) = 0", rinttol (minus_zero), 0);
|
||||
check_long ("rinttol(0.2) = 0", rinttol (0.2), 0);
|
||||
check_long ("rinttol(-0.2) = 0", rinttol (-0.2), 0);
|
||||
|
||||
check_long ("rinttol(1.4) = 1", 1.4, 1);
|
||||
check_long ("rinttol(-1.4) = -1", -1.4, -1);
|
||||
check_long ("rinttol(1.4) = 1", rinttol (1.4), 1);
|
||||
check_long ("rinttol(-1.4) = -1", rinttol (-1.4), -1);
|
||||
|
||||
check_long ("rinttol(8388600.3) = 8388600", 8388600.3, 8388600);
|
||||
check_long ("rinttol(-8388600.3) = -8388600", -8388600.3, -8388600);
|
||||
check_long ("rinttol(8388600.3) = 8388600", rinttol (8388600.3), 8388600);
|
||||
check_long ("rinttol(-8388600.3) = -8388600", rinttol (-8388600.3),
|
||||
-8388600);
|
||||
}
|
||||
|
||||
|
||||
@ -2826,16 +3238,79 @@ rinttoll_test (void)
|
||||
the rounding method and test the critical cases. So far, only
|
||||
unproblematic numbers are tested. */
|
||||
|
||||
check_longlong ("rinttoll(0) = 0", 0.0, 0);
|
||||
check_longlong ("rinttoll(-0) = 0", minus_zero, 0);
|
||||
check_longlong ("rinttoll(0.2) = 0", 0.2, 0);
|
||||
check_longlong ("rinttoll(-0.2) = 0", -0.2, 0);
|
||||
check_longlong ("rinttoll(0) = 0", rinttoll (0.0), 0);
|
||||
check_longlong ("rinttoll(-0) = 0", rinttoll (minus_zero), 0);
|
||||
check_longlong ("rinttoll(0.2) = 0", rinttoll (0.2), 0);
|
||||
check_longlong ("rinttoll(-0.2) = 0", rinttoll (-0.2), 0);
|
||||
|
||||
check_longlong ("rinttoll(1.4) = 1", 1.4, 1);
|
||||
check_longlong ("rinttoll(-1.4) = -1", -1.4, -1);
|
||||
check_longlong ("rinttoll(1.4) = 1", rinttoll (1.4), 1);
|
||||
check_longlong ("rinttoll(-1.4) = -1", rinttoll (-1.4), -1);
|
||||
|
||||
check_longlong ("rinttoll(8388600.3) = 8388600", 8388600.3, 8388600);
|
||||
check_longlong ("rinttoll(-8388600.3) = -8388600", -8388600.3, -8388600);
|
||||
check_longlong ("rinttoll(8388600.3) = 8388600", rinttoll (8388600.3),
|
||||
8388600);
|
||||
check_longlong ("rinttoll(-8388600.3) = -8388600", rinttoll (-8388600.3),
|
||||
-8388600);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
round_test (void)
|
||||
{
|
||||
check ("round(0) = 0", FUNC(round) (0), 0);
|
||||
check ("round(-0) = -0", FUNC(round) (minus_zero), minus_zero);
|
||||
check ("round(0.2) = 0", FUNC(round) (0.2), 0.0);
|
||||
check ("round(-0.2) = -0", FUNC(round) (-0.2), minus_zero);
|
||||
check ("round(0.5) = 1", FUNC(round) (0.5), 1.0);
|
||||
check ("round(-0.5) = -1", FUNC(round) (-0.5), -1.0);
|
||||
check ("round(0.8) = 1", FUNC(round) (0.8), 1.0);
|
||||
check ("round(-0.8) = -1", FUNC(round) (-0.8), -1.0);
|
||||
check ("round(1.5) = 2", FUNC(round) (1.5), 2.0);
|
||||
check ("round(-1.5) = -2", FUNC(round) (-1.5), -2.0);
|
||||
check ("round(2097152.5) = 2097153", FUNC(round) (2097152.5), 2097153);
|
||||
check ("round(-2097152.5) = -2097153", FUNC(round) (-2097152.5), -2097153);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
roundtol_test (void)
|
||||
{
|
||||
check_long ("roundtol(0) = 0", roundtol (0), 0);
|
||||
check_long ("roundtol(-0) = 0", roundtol (minus_zero), 0);
|
||||
check_long ("roundtol(0.2) = 0", roundtol (0.2), 0.0);
|
||||
check_long ("roundtol(-0.2) = 0", roundtol (-0.2), 0);
|
||||
check_long ("roundtol(0.5) = 1", roundtol (0.5), 1);
|
||||
check_long ("roundtol(-0.5) = -1", roundtol (-0.5), -1);
|
||||
check_long ("roundtol(0.8) = 1", roundtol (0.8), 1);
|
||||
check_long ("roundtol(-0.8) = -1", roundtol (-0.8), -1);
|
||||
check_long ("roundtol(1.5) = 2", roundtol (1.5), 2);
|
||||
check_long ("roundtol(-1.5) = -2", roundtol (-1.5), -2);
|
||||
check_long ("roundtol(2097152.5) = 2097153", roundtol (2097152.5), 2097153);
|
||||
check_long ("roundtol(-2097152.5) = -2097153", roundtol (-2097152.5),
|
||||
-2097153);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
roundtoll_test (void)
|
||||
{
|
||||
check_longlong ("roundtoll(0) = 0", roundtoll (0), 0);
|
||||
check_longlong ("roundtoll(-0) = 0", roundtoll (minus_zero), 0);
|
||||
check_longlong ("roundtoll(0.2) = 0", roundtoll (0.2), 0.0);
|
||||
check_longlong ("roundtoll(-0.2) = 0", roundtoll (-0.2), 0);
|
||||
check_longlong ("roundtoll(0.5) = 1", roundtoll (0.5), 1);
|
||||
check_longlong ("roundtoll(-0.5) = -1", roundtoll (-0.5), -1);
|
||||
check_longlong ("roundtoll(0.8) = 1", roundtoll (0.8), 1);
|
||||
check_longlong ("roundtoll(-0.8) = -1", roundtoll (-0.8), -1);
|
||||
check_longlong ("roundtoll(1.5) = 2", roundtoll (1.5), 2);
|
||||
check_longlong ("roundtoll(-1.5) = -2", roundtoll (-1.5), -2);
|
||||
check_longlong ("roundtoll(2097152.5) = 2097153",
|
||||
roundtoll (2097152.5), 2097153);
|
||||
check_longlong ("roundtoll(-2097152.5) = -2097153",
|
||||
roundtoll (-2097152.5), -2097153);
|
||||
check_longlong ("roundtoll(34359738368.5) = 34359738369",
|
||||
roundtoll (34359738368.5), 34359738369ll);
|
||||
check_longlong ("roundtoll(-34359738368.5) = -34359738369",
|
||||
roundtoll (-34359738368.5), -34359738369ll);
|
||||
}
|
||||
|
||||
|
||||
@ -3168,11 +3643,25 @@ main (int argc, char *argv[])
|
||||
#endif
|
||||
cexp_test ();
|
||||
csinh_test ();
|
||||
ccos_test ();
|
||||
ccosh_test ();
|
||||
clog_test ();
|
||||
cacos_test ();
|
||||
cacosh_test ();
|
||||
casin_test ();
|
||||
casinh_test ();
|
||||
catan_test ();
|
||||
catanh_test ();
|
||||
ctanh_test ();
|
||||
csqrt_test ();
|
||||
cpow_test ();
|
||||
|
||||
rint_test ();
|
||||
rinttol_test ();
|
||||
rinttoll_test ();
|
||||
round_test ();
|
||||
roundtol_test ();
|
||||
roundtoll_test ();
|
||||
|
||||
identities ();
|
||||
inverse_functions ();
|
||||
|
27
math/math.h
27
math/math.h
@ -115,6 +115,25 @@ extern int signgam;
|
||||
/* ISO C 9X defines some generic macros which work on any data type. */
|
||||
#if __USE_ISOC9X
|
||||
|
||||
/* Get the architecture specific values describing the floating-point
|
||||
evaluation. The following symbols will get defined:
|
||||
|
||||
float_t floating-point type at least as wide as `float' used
|
||||
to evaluate `float' expressions
|
||||
double_t floating-point type at least as wide as `double' used
|
||||
to evaluate `double' expressions
|
||||
|
||||
FLT_EVAL_METHOD
|
||||
Defined to
|
||||
0 if `float_t' is `float' and `double_t' is `double'
|
||||
1 if `float_t' and `double_t' are `double'
|
||||
2 if `float_t' and `double_t' are `long double'
|
||||
else `float_t' and `double_t' are unspecified
|
||||
|
||||
INFINITY representation of the infinity value of type `float_t'
|
||||
*/
|
||||
#include <mathbits.h>
|
||||
|
||||
/* All floating-point numbers can be put in one of these categories. */
|
||||
enum
|
||||
{
|
||||
@ -133,7 +152,7 @@ enum
|
||||
/* Return number of classification appropriate for X. */
|
||||
#define fpclassify(x) \
|
||||
(sizeof (x) == sizeof (float) ? \
|
||||
__fpclassifyf (x) \
|
||||
__fpclassifyf (x) \
|
||||
: sizeof (x) == sizeof (double) ? \
|
||||
__fpclassify (x) : __fpclassifyl (x))
|
||||
|
||||
@ -145,7 +164,11 @@ enum
|
||||
__signbit (x) : __signbitl (x))
|
||||
|
||||
/* Return nonzero value if X is not +-Inf or NaN. */
|
||||
#define isfinite(x) (fpclassify (x) >= FP_ZERO)
|
||||
#define isfinite(x) \
|
||||
(sizeof (x) == sizeof (float) ? \
|
||||
__finitef (x) \
|
||||
: sizeof (x) == sizeof (double) ? \
|
||||
__finite (x) : __finitel (x))
|
||||
|
||||
/* Return nonzero value if X is neither zero, subnormal, Inf, nor NaN. */
|
||||
#define isnormal(x) (fpclassify (x) == FP_NORMAL)
|
||||
|
@ -332,7 +332,7 @@ getpwent_next_nis_netgr (struct passwd *result, ent_t *ent, char *group,
|
||||
|
||||
if (ent->first == TRUE)
|
||||
{
|
||||
bzero (&ent->netgrdata, sizeof (struct __netgrent));
|
||||
memset (&ent->netgrdata, 0, sizeof (struct __netgrent));
|
||||
__internal_setnetgrent (group, &ent->netgrdata);
|
||||
ent->first = FALSE;
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ internal_setent (int stayopen)
|
||||
|
||||
if (db == NULL)
|
||||
{
|
||||
db = dbopen (DBFILE, O_RDONLY, 0, DB_BTREE, NULL);
|
||||
db = __dbopen (DBFILE, O_RDONLY, 0, DB_BTREE, NULL);
|
||||
|
||||
if (db == NULL)
|
||||
status = NSS_STATUS_UNAVAIL;
|
||||
|
@ -47,7 +47,7 @@ internal_setent (int stayopen)
|
||||
|
||||
if (db == NULL)
|
||||
{
|
||||
db = dbopen (_PATH_VARDB "aliases.db", O_RDONLY, 0, DB_BTREE, NULL);
|
||||
db = __dbopen (_PATH_VARDB "aliases.db", O_RDONLY, 0, DB_BTREE, NULL);
|
||||
|
||||
if (db == NULL)
|
||||
status = NSS_STATUS_UNAVAIL;
|
||||
|
@ -49,7 +49,7 @@ _nss_db_setnetgrent (const char *group)
|
||||
/* Make sure the data base file is open. */
|
||||
if (db == NULL)
|
||||
{
|
||||
db = dbopen (DBFILE, O_RDONLY, 0, DB_BTREE, NULL);
|
||||
db = __dbopen (DBFILE, O_RDONLY, 0, DB_BTREE, NULL);
|
||||
|
||||
if (db == NULL)
|
||||
status = errno == EAGAIN ? NSS_STATUS_TRYAGAIN : NSS_STATUS_UNAVAIL;
|
||||
|
27
rellns-sh
27
rellns-sh
@ -22,30 +22,12 @@ if test $# -ne 2; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# A problem with this script is that we must be able to handle symbolic
|
||||
# links somewhere in the paths of either path. To resolve symlinks we use
|
||||
# the `pwd' program. But some `pwd' programs are no real programs but
|
||||
# instead aliases (defined by the user) or builtins (as in bash-2). Both
|
||||
# kinds have in common that they might not give the correct result. E.g.,
|
||||
# the builtin in bash-2 returns the path which was used to change to the
|
||||
# directory and not the real path.
|
||||
#
|
||||
# To prevent this problem we make sure the real `pwd' somewhere in the
|
||||
# path is used. Currently there is only support for bash-2 available.
|
||||
# If other shells also have problems we have to add more code here.
|
||||
|
||||
if test "$BASH_VERSINFO" = "2"; then
|
||||
unalias pwd
|
||||
unset pwd
|
||||
enable -n pwd
|
||||
fi
|
||||
|
||||
# Make both paths absolute.
|
||||
if test -d $1; then
|
||||
to=`cd $1 && pwd`
|
||||
to=`cd $1 && /bin/pwd`
|
||||
else
|
||||
temp=`echo $1 | sed 's%/*[^/]*$%%'`
|
||||
to=`cd $temp && pwd`
|
||||
to=`cd $temp && /bin/pwd`
|
||||
to="$to/`echo $1 | sed 's%.*/\([^/][^/]*\)$%\1%'`"
|
||||
fi
|
||||
to=`echo $to | sed 's%^/%%'`
|
||||
@ -57,9 +39,10 @@ else
|
||||
fi
|
||||
|
||||
if test -z "$from"; then
|
||||
from=`pwd`;
|
||||
from=`/bin/pwd | sed 's%^/%%'`
|
||||
else
|
||||
from=`cd $from && /bin/pwd | sed 's%^/%%'`
|
||||
fi
|
||||
from=`cd $from && pwd | sed 's%^/%%'`
|
||||
|
||||
while test -n "$to" && test -n "$from"; do
|
||||
preto=`echo $to | sed 's%^\([^/]*\)/.*%\1%'`
|
||||
|
@ -64,12 +64,12 @@ map_v4v6_address (const char *src, char *dst)
|
||||
int i;
|
||||
|
||||
/* Stash a temporary copy so our caller can update in place. */
|
||||
bcopy (src, tmp, INADDRSZ);
|
||||
memcpy (tmp, src, INADDRSZ);
|
||||
/* Mark this ipv6 addr as a mapped ipv4. */
|
||||
for (i = 0; i < 10; i++)
|
||||
*p++ = 0x00;
|
||||
*p++ = 0xff;
|
||||
*p++ = 0xff;
|
||||
/* Retrieve the saved copy and we're done. */
|
||||
bcopy (tmp, (void *) p, INADDRSZ);
|
||||
memcpy ((void *) p, tmp, INADDRSZ);
|
||||
}
|
||||
|
@ -197,8 +197,8 @@ _nss_dns_gethostbyaddr_r (const char *addr, int len, int af,
|
||||
int size, n, status;
|
||||
|
||||
if (af == AF_INET6 && len == IN6ADDRSZ &&
|
||||
(bcmp (uaddr, mapped, sizeof mapped) == 0
|
||||
|| bcmp (uaddr, tunnelled, sizeof tunnelled) == 0))
|
||||
(memcmp (uaddr, mapped, sizeof mapped) == 0
|
||||
|| memcmp (uaddr, tunnelled, sizeof tunnelled) == 0))
|
||||
{
|
||||
/* Unmap. */
|
||||
addr += sizeof mapped;
|
||||
@ -260,7 +260,7 @@ _nss_dns_gethostbyaddr_r (const char *addr, int len, int af,
|
||||
|
||||
result->h_addrtype = af;
|
||||
result->h_length = len;
|
||||
bcopy (addr, host_data->host_addr, len);
|
||||
memcpy (host_data->host_addr, addr, len);
|
||||
host_data->h_addr_ptrs[0] = (char *) host_data->host_addr;
|
||||
host_data->h_addr_ptrs[1] = NULL;
|
||||
if (af == AF_INET && (_res.options & RES_USE_INET6))
|
||||
@ -520,7 +520,7 @@ getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype,
|
||||
cp += n;
|
||||
continue;
|
||||
}
|
||||
bcopy (cp, *hap++ = bp, n);
|
||||
memcpy (*hap++ = bp, cp, n);
|
||||
bp += n;
|
||||
cp += n;
|
||||
linebuflen -= n;
|
||||
|
@ -160,6 +160,12 @@ main (int argc, char **argv)
|
||||
|
||||
if (res != 2 || a != 123 || b != 456 || n != 6)
|
||||
return 1;
|
||||
|
||||
res = sscanf ("0", "%lg", &a);
|
||||
printf ("res = %d, a = %g\n", res, a);
|
||||
|
||||
if (res != 1 || a != 0)
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
exit(EXIT_SUCCESS);
|
||||
|
@ -925,24 +925,24 @@ __vfscanf (FILE *s, const char *format, va_list argptr)
|
||||
else
|
||||
negative = 0;
|
||||
|
||||
if (c == '0' && tolower (c == inchar ()) == 'x')
|
||||
is_hexa = 0;
|
||||
exp_char = 'e';
|
||||
if (c == '0')
|
||||
{
|
||||
/* It is a number in hexadecimal format. */
|
||||
ADDW ('0');
|
||||
ADDW ('x');
|
||||
|
||||
is_hexa = 1;
|
||||
exp_char = 'p';
|
||||
|
||||
/* Grouping is not allowed. */
|
||||
flags &= ~GROUP;
|
||||
ADDW (c);
|
||||
c = inchar ();
|
||||
}
|
||||
else
|
||||
{
|
||||
/* It not a hexadecimal prefix. */
|
||||
is_hexa = 0;
|
||||
exp_char = 'e';
|
||||
if (tolower (c) == 'x')
|
||||
{
|
||||
/* It is a number in hexadecimal format. */
|
||||
ADDW (c);
|
||||
|
||||
is_hexa = 1;
|
||||
exp_char = 'p';
|
||||
|
||||
/* Grouping is not allowed. */
|
||||
flags &= ~GROUP;
|
||||
c = inchar ();
|
||||
}
|
||||
}
|
||||
|
||||
got_dot = got_e = 0;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1992, 1996 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1992, 1996, 1997 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
|
||||
@ -21,6 +21,7 @@
|
||||
void
|
||||
swab (const char *from, char *to, ssize_t n)
|
||||
{
|
||||
n &= ~((ssize_t) 1);
|
||||
while (n > 1)
|
||||
{
|
||||
const char b0 = from[--n], b1 = from[--n];
|
||||
|
35
sysdeps/generic/mathbits.h
Normal file
35
sysdeps/generic/mathbits.h
Normal file
@ -0,0 +1,35 @@
|
||||
/* Copyright (C) 1997 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
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifndef _MATHBITS_H
|
||||
#define _MATHBITS_H 1
|
||||
|
||||
/* Normally, there is no long double type and the `float' and `double'
|
||||
expressions are evaluated as `double'. */
|
||||
typedef double float_t; /* `float' expressions are evaluated as
|
||||
`double'. */
|
||||
typedef double double_t; /* `double' expressions are evaluated as
|
||||
`double'. */
|
||||
|
||||
/* Signal that both types are `double'. */
|
||||
#define FLT_EVAL_METHOD 1
|
||||
|
||||
/* Define `INFINITY' as value of type `float_t'. */
|
||||
#define INFINITY HUGE_VAL
|
||||
|
||||
#endif /* mathbits.h */
|
@ -1,48 +1,48 @@
|
||||
/* Copyright (C) 1991, 1992, 1993, 1994, 1996 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
/* Copyright (C) 1991, 92, 93, 94, 96, 97 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
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
||||
Cambridge, MA 02139, USA. */
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <ansidecl.h>
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
|
||||
|
||||
/* Return the first occurrence of NEEDLE in HAYSTACK. */
|
||||
PTR
|
||||
DEFUN(memmem, (haystack, haystack_len,
|
||||
needle, needle_len),
|
||||
CONST PTRCONST haystack AND CONST size_t haystack_len AND
|
||||
CONST PTRCONST needle AND CONST size_t needle_len)
|
||||
void *
|
||||
memmem (haystack, haystack_len, needle, needle_len)
|
||||
const void *haystack;
|
||||
size_t haystack_len;
|
||||
const void *needle;
|
||||
size_t needle_len;
|
||||
{
|
||||
register CONST char *begin;
|
||||
register CONST char *CONST last_possible
|
||||
= (CONST char *) haystack + haystack_len - needle_len;
|
||||
const char *begin;
|
||||
const char *const last_possible
|
||||
= (const char *) haystack + haystack_len - needle_len;
|
||||
|
||||
if (needle_len == 0)
|
||||
/* The first occurrence of the empty string is deemed to occur at
|
||||
the end of the string. */
|
||||
return (PTR) &((CONST char *) haystack)[haystack_len - 1];
|
||||
return (void *) &((const char *) haystack)[haystack_len - 1];
|
||||
|
||||
for (begin = (CONST char *) haystack; begin <= last_possible; ++begin)
|
||||
if (begin[0] == ((CONST char *) needle)[0] &&
|
||||
!memcmp ((CONST PTR) &begin[1],
|
||||
(CONST PTR) ((CONST char *) needle + 1),
|
||||
for (begin = (const char *) haystack; begin <= last_possible; ++begin)
|
||||
if (begin[0] == ((const char *) needle)[0] &&
|
||||
!memcmp ((const void *) &begin[1],
|
||||
(const void *) ((const char *) needle + 1),
|
||||
needle_len - 1))
|
||||
return (PTR) begin;
|
||||
return (void *) begin;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
40
sysdeps/i386/fpu/fclrexcpt.c
Normal file
40
sysdeps/i386/fpu/fclrexcpt.c
Normal file
@ -0,0 +1,40 @@
|
||||
/* Clear given exceptions in current floating-point environment.
|
||||
Copyright (C) 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <fenv.h>
|
||||
|
||||
void
|
||||
feclearexcept (int excepts)
|
||||
{
|
||||
fenv_t temp;
|
||||
|
||||
/* Mask out unsupported bits/exceptions. */
|
||||
excepts &= FE_ALL_EXCEPT;
|
||||
|
||||
/* Bah, we have to clear selected exceptions. Since there is no
|
||||
`fldsw' instruction we have to do it the hard way. */
|
||||
__asm__ ("fnstenv %0" : "=m" (*&temp));
|
||||
|
||||
/* Clear the relevant bits. */
|
||||
temp.status_word &= excepts ^ FE_ALL_EXCEPT;
|
||||
|
||||
/* Put the new data in effect. */
|
||||
__asm__ ("fldenv %0" : : "m" (*&temp));
|
||||
}
|
27
sysdeps/i386/fpu/fegetenv.c
Normal file
27
sysdeps/i386/fpu/fegetenv.c
Normal file
@ -0,0 +1,27 @@
|
||||
/* Store current floating-point environment.
|
||||
Copyright (C) 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <fenv.h>
|
||||
|
||||
void
|
||||
fegetenv (fenv_t *envp)
|
||||
{
|
||||
__asm__ ("fnstenv %0" : "=m" (*envp));
|
||||
}
|
31
sysdeps/i386/fpu/fegetround.c
Normal file
31
sysdeps/i386/fpu/fegetround.c
Normal file
@ -0,0 +1,31 @@
|
||||
/* Return current rounding direction.
|
||||
Copyright (C) 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <fenv.h>
|
||||
|
||||
int
|
||||
fegetround (void)
|
||||
{
|
||||
int cw;
|
||||
|
||||
__asm__ ("fnstcw %0" : "=m" (*&cw));
|
||||
|
||||
return cw & 0xc00;
|
||||
}
|
36
sysdeps/i386/fpu/feholdexcpt.c
Normal file
36
sysdeps/i386/fpu/feholdexcpt.c
Normal file
@ -0,0 +1,36 @@
|
||||
/* Store current floating-point environment and clear exceptions.
|
||||
Copyright (C) 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <fenv.h>
|
||||
|
||||
int
|
||||
feholdexcept (fenv_t *envp)
|
||||
{
|
||||
unsigned short int work;
|
||||
|
||||
/* Store the environment. */
|
||||
__asm__ ("fnstenv %0" : "=m" (*envp));
|
||||
|
||||
/* Now set all exceptions to non-stop. */
|
||||
work = envp->control_word | 0x3f;
|
||||
__asm__ ("fldcw %0" : : "m" (*&work));
|
||||
|
||||
return 1;
|
||||
}
|
91
sysdeps/i386/fpu/fenvbits.h
Normal file
91
sysdeps/i386/fpu/fenvbits.h
Normal file
@ -0,0 +1,91 @@
|
||||
/* Copyright (C) 1997 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
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* This file should never be included directly. */
|
||||
|
||||
#ifndef _FENVBITS_H
|
||||
#define _FENVBITS_H 1
|
||||
|
||||
/* Define bits representing the exception. We use the bit positions
|
||||
of the appropriate bits in the FPU control word. */
|
||||
enum
|
||||
{
|
||||
FE_INVALID = 0x01,
|
||||
#define FE_INVALID FE_INVALID
|
||||
__FE_DENORM = 0x02,
|
||||
FE_DIVBYZERO = 0x04,
|
||||
#define FE_DIVBYZERO FE_DIVBYZERO
|
||||
FE_OVERFLOW = 0x08,
|
||||
#define FE_OVERFLOW FE_OVERFLOW
|
||||
FE_UNDERFLOW = 0x10,
|
||||
#define FE_UNDERFLOW FE_UNDERFLOW
|
||||
FE_INEXACT = 0x20
|
||||
#define FE_INEXACT FE_INEXACT
|
||||
};
|
||||
|
||||
#define FE_ALL_EXCEPT \
|
||||
(FE_INEXACT | FE_DIVBYZERO | FE_UNDERFLOW | FE_OVERFLOW | FE_INVALID)
|
||||
|
||||
/* The ix87 FPU supports all of the four defined rounding modes. We
|
||||
use again the bit positions in the FPU control word as the values
|
||||
for the appropriate macros. */
|
||||
enum
|
||||
{
|
||||
FE_TONEAREST = 0,
|
||||
#define FE_TONEAREST FE_TONEAREST
|
||||
FE_DOWNWARD = 0x400,
|
||||
#define FE_DOWNWARD FE_DOWNWARD
|
||||
FE_UPWARD = 0x800,
|
||||
#define FE_UPWARD FE_UPWARD
|
||||
FE_TOWARDSZERO = 0xc00
|
||||
#define FE_TOWARDSZERO FE_TOWARDSZERO
|
||||
};
|
||||
|
||||
|
||||
/* Type representing exception flags. */
|
||||
typedef unsigned short int fexcept_t;
|
||||
|
||||
|
||||
/* Type representing floating-point environment. This function corresponds to the layout of the block written by the `fstenv'. */
|
||||
typedef struct
|
||||
{
|
||||
unsigned short int control_word;
|
||||
unsigned short int __unused1;
|
||||
unsigned short int status_word;
|
||||
unsigned short int __unused2;
|
||||
unsigned short int tags;
|
||||
unsigned short int __unused3;
|
||||
unsigned int eip;
|
||||
unsigned short int cs_selector;
|
||||
unsigned int opcode:11;
|
||||
unsigned int __unused4:5;
|
||||
unsigned int data_offset;
|
||||
unsigned short int data_selector;
|
||||
unsigned short int __unused5;
|
||||
}
|
||||
fenv_t;
|
||||
|
||||
/* If the default argument is used we use this value. */
|
||||
#define FE_DFL_ENV ((fenv_t *) -1)
|
||||
|
||||
#ifdef __USE_GNU
|
||||
/* Floating-point environment where none of the exception is masked. */
|
||||
# define FE_NOMASK_ENV ((fenv_t *) -2)
|
||||
#endif
|
||||
|
||||
#endif /* fenvbits.h */
|
76
sysdeps/i386/fpu/fesetenv.c
Normal file
76
sysdeps/i386/fpu/fesetenv.c
Normal file
@ -0,0 +1,76 @@
|
||||
/* Install given floating-point environment.
|
||||
Copyright (C) 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <fenv.h>
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
|
||||
void
|
||||
fesetenv (const fenv_t *envp)
|
||||
{
|
||||
fenv_t temp;
|
||||
|
||||
/* The memory block used by fstenv/fldenv has a size of 28 bytes. */
|
||||
assert (sizeof (fenv_t) == 28);
|
||||
|
||||
/* Install the environment specified by ENVP. But there are a few
|
||||
values which we do not want to come from the saved environment.
|
||||
Therefore, we get the current environment and replace the values
|
||||
we want to use from the environment specified by the parameter. */
|
||||
__asm__ ("fnstenv %0" : "=m" (*&temp));
|
||||
|
||||
if (envp == FE_DFL_ENV)
|
||||
{
|
||||
temp.control_word |= FE_ALL_EXCEPT;
|
||||
temp.control_word &= ~FE_TOWARDSZERO;
|
||||
temp.status_word &= ~FE_ALL_EXCEPT;
|
||||
temp.eip = 0;
|
||||
temp.cs_selector = 0;
|
||||
temp.opcode = 0;
|
||||
temp.data_offset = 0;
|
||||
temp.data_selector = 0;
|
||||
}
|
||||
else if (envp == FE_NOMASK_ENV)
|
||||
{
|
||||
temp.control_word &= ~(FE_ALL_EXCEPT | FE_TOWARDSZERO);
|
||||
temp.status_word &= ~FE_ALL_EXCEPT;
|
||||
temp.eip = 0;
|
||||
temp.cs_selector = 0;
|
||||
temp.opcode = 0;
|
||||
temp.data_offset = 0;
|
||||
temp.data_selector = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
temp.control_word &= ~(FE_ALL_EXCEPT | FE_TOWARDSZERO);
|
||||
temp.control_word |= (envp->control_word
|
||||
& (FE_ALL_EXCEPT | FE_TOWARDSZERO));
|
||||
temp.status_word &= ~FE_ALL_EXCEPT;
|
||||
temp.status_word |= envp->status_word & FE_ALL_EXCEPT;
|
||||
temp.eip = envp->eip;
|
||||
temp.cs_selector = envp->cs_selector;
|
||||
temp.opcode = envp->opcode;
|
||||
temp.data_offset = envp->data_offset;
|
||||
temp.data_selector = envp->data_selector;
|
||||
}
|
||||
|
||||
__asm__ ("fldenv %0" : : "m" (temp));
|
||||
}
|
38
sysdeps/i386/fpu/fesetround.c
Normal file
38
sysdeps/i386/fpu/fesetround.c
Normal file
@ -0,0 +1,38 @@
|
||||
/* Set current rounding direction.
|
||||
Copyright (C) 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <fenv.h>
|
||||
|
||||
int
|
||||
fesetround (int round)
|
||||
{
|
||||
unsigned short int cw;
|
||||
|
||||
if ((round & ~0xc00) != 0)
|
||||
/* ROUND is no valid rounding mode. */
|
||||
return 0;
|
||||
|
||||
__asm__ ("fnstcw %0" : "=m" (*&cw));
|
||||
cw &= ~0xc00;
|
||||
cw |= round;
|
||||
__asm__ ("fldcw %0" : : "m" (*&cw));
|
||||
|
||||
return 1;
|
||||
}
|
39
sysdeps/i386/fpu/feupdateenv.c
Normal file
39
sysdeps/i386/fpu/feupdateenv.c
Normal file
@ -0,0 +1,39 @@
|
||||
/* Install given floating-point environment and raise exceptions.
|
||||
Copyright (C) 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <fenv.h>
|
||||
|
||||
void
|
||||
feupdateenv (const fenv_t *envp)
|
||||
{
|
||||
fexcept_t temp;
|
||||
|
||||
/* Save current exceptions. */
|
||||
__asm__ ("fnstsw %0" : "=m" (*&temp));
|
||||
temp &= FE_ALL_EXCEPT;
|
||||
|
||||
/* Install new environment. */
|
||||
fesetenv (envp);
|
||||
|
||||
/* Raise the safed exception. Incidently for us the implementation
|
||||
defined format of the values in objects of type fexcept_t is the
|
||||
same as the ones specified using the FE_* constants. */
|
||||
feraiseexcept ((int) temp);
|
||||
}
|
32
sysdeps/i386/fpu/fgetexcptflg.c
Normal file
32
sysdeps/i386/fpu/fgetexcptflg.c
Normal file
@ -0,0 +1,32 @@
|
||||
/* Store current representation for exceptions.
|
||||
Copyright (C) 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <fenv.h>
|
||||
|
||||
void
|
||||
fegetexceptflag (fexcept_t *flagp, int excepts)
|
||||
{
|
||||
fexcept_t temp;
|
||||
|
||||
/* Get the current exceptions. */
|
||||
__asm__ ("fnstsw %0" : "=m" (*&temp));
|
||||
|
||||
*flagp = temp & excepts & FE_ALL_EXCEPT;
|
||||
}
|
75
sysdeps/i386/fpu/fraiseexcpt.c
Normal file
75
sysdeps/i386/fpu/fraiseexcpt.c
Normal file
@ -0,0 +1,75 @@
|
||||
/* Raise given exceptions.
|
||||
Copyright (C) 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <fenv.h>
|
||||
#include <math.h>
|
||||
|
||||
void
|
||||
feraiseexcept (int excepts)
|
||||
{
|
||||
/* Raise exceptions represented by EXPECTS. But we must raise only
|
||||
one signal at a time. It is important the if the overflow/underflow
|
||||
exception and the inexact exception are given at the same time,
|
||||
the overflow/underflow exception follows the inexact exception. */
|
||||
|
||||
/* First: invalid exception. */
|
||||
if ((FE_INVALID & excepts) != 0)
|
||||
{
|
||||
/* One example of a invalid operation is 0 * Infinity. */
|
||||
double d = 0.0 * HUGE_VAL;
|
||||
(void) &d;
|
||||
/* Now force the exception. */
|
||||
__asm__ ("fwait");
|
||||
}
|
||||
|
||||
/* Next: division by zero. */
|
||||
if ((FE_DIVBYZERO & excepts) != 0)
|
||||
{
|
||||
double d;
|
||||
__asm__ ("fld1; fldz; fdivp %%st, %%st(1); fwait" : "=t" (d));
|
||||
(void) &d;
|
||||
}
|
||||
|
||||
/* Next: overflow. */
|
||||
if ((FE_OVERFLOW & excepts) != 0)
|
||||
{
|
||||
long double d = LDBL_MAX * LDBL_MAX;
|
||||
(void) &d;
|
||||
/* Now force the exception. */
|
||||
__asm__ ("fwait");
|
||||
}
|
||||
|
||||
/* Next: underflow. */
|
||||
if ((FE_UNDERFLOW & excepts) != 0)
|
||||
{
|
||||
long double d = LDBL_MIN / 16.0;
|
||||
(void) &d;
|
||||
/* Now force the exception. */
|
||||
__asm__ ("fwait");
|
||||
}
|
||||
|
||||
/* Last: inexact. */
|
||||
if ((FE_INEXACT & excepts) != 0)
|
||||
{
|
||||
long double d;
|
||||
__asm__ ("fld1; fldpi; fdivp %%st, %%st(1); fwait" : "=t" (d));
|
||||
(void) &d;
|
||||
}
|
||||
}
|
40
sysdeps/i386/fpu/fsetexcptflg.c
Normal file
40
sysdeps/i386/fpu/fsetexcptflg.c
Normal file
@ -0,0 +1,40 @@
|
||||
/* Set floating-point environment exception handling.
|
||||
Copyright (C) 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <fenv.h>
|
||||
#include <math.h>
|
||||
|
||||
void
|
||||
fesetexceptflag (const fexcept_t *flagp, int excepts)
|
||||
{
|
||||
fenv_t temp;
|
||||
|
||||
/* Get the current environment. We have to do this since we cannot
|
||||
separately set the status word. */
|
||||
__asm__ ("fnstenv %0" : "=m" (*&temp));
|
||||
|
||||
temp.status_word &= ~(excepts & FE_ALL_EXCEPT);
|
||||
temp.status_word |= *flagp & excepts & FE_ALL_EXCEPT;
|
||||
|
||||
/* Store the new status word (along with the rest of the environment.
|
||||
Possibly new exceptions are set but they won't get executed unless
|
||||
the next floating-point instruction. */
|
||||
__asm__ ("fldenv %0" : : "m" (*&temp));
|
||||
}
|
32
sysdeps/i386/fpu/ftestexcept.c
Normal file
32
sysdeps/i386/fpu/ftestexcept.c
Normal file
@ -0,0 +1,32 @@
|
||||
/* Test exception in current environment.
|
||||
Copyright (C) 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <fenv.h>
|
||||
|
||||
int
|
||||
fetestexcept (int excepts)
|
||||
{
|
||||
int temp;
|
||||
|
||||
/* Get current exceptions. */
|
||||
__asm__ ("fnstsw %0" : "=a" (temp));
|
||||
|
||||
return temp & excepts & FE_ALL_EXCEPT;
|
||||
}
|
36
sysdeps/i386/fpu/mathbits.h
Normal file
36
sysdeps/i386/fpu/mathbits.h
Normal file
@ -0,0 +1,36 @@
|
||||
/* Copyright (C) 1997 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
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifndef _MATHBITS_H
|
||||
#define _MATHBITS_H 1
|
||||
|
||||
/* The ix87 FPUs evaluate all values in the 80 bit floating-point format
|
||||
which is also available for the user as `long double'. Therefore
|
||||
we define: */
|
||||
typedef long double float_t; /* `float' expressions are evaluated as
|
||||
`long double'. */
|
||||
typedef long double double_t; /* `double' expressions are evaluated as
|
||||
`long double'. */
|
||||
|
||||
/* Signal that both types are `long double'. */
|
||||
#define FLT_EVAL_METHOD 2
|
||||
|
||||
/* Define `INFINITY' as value of type `float_t'. */
|
||||
#define INFINITY HUGE_VALL
|
||||
|
||||
#endif /* mathbits.h */
|
@ -65,12 +65,6 @@ static __huge_vall_t __huge_vall = { __HUGE_VALL_bytes };
|
||||
#define HUGE_VALL (__huge_vall.__ld)
|
||||
#endif /* GCC. */
|
||||
|
||||
|
||||
/* Expression representing positive infinity. Here it is the same as
|
||||
HUGE_VALF. */
|
||||
#define INFINITY HUGE_VALF
|
||||
|
||||
#endif /* __USE_ISOC9X. */
|
||||
|
||||
|
||||
#endif /* huge_val.h */
|
||||
|
@ -69,12 +69,6 @@ static __huge_valf_t __huge_valf = { __HUGE_VALF_bytes };
|
||||
same as `double'. */
|
||||
#define HUGE_VALL HUGE_VAL
|
||||
|
||||
|
||||
/* Expression representing positive infinity. Here it is the same as
|
||||
HUGE_VALF. */
|
||||
#define INFINITY HUGE_VALF
|
||||
|
||||
#endif /* __USE_ISOC9X. */
|
||||
|
||||
|
||||
#endif /* huge_val.h */
|
||||
|
@ -1,18 +1,14 @@
|
||||
/*
|
||||
* Written by J.T. Conklin <jtc@netbsd.org>.
|
||||
* Public domain.
|
||||
* Written by Joe Keane <jgk@jgk.org>.
|
||||
*/
|
||||
|
||||
#include <machine/asm.h>
|
||||
|
||||
RCSID("$NetBSD: s_finite.S,v 1.4 1995/05/08 23:57:41 jtc Exp $")
|
||||
|
||||
ENTRY(__finite)
|
||||
movl 8(%esp),%eax
|
||||
andl $0x7ff00000, %eax
|
||||
cmpl $0x7ff00000, %eax
|
||||
setne %al
|
||||
andl $0x000000ff, %eax
|
||||
orl $0x800fffff, %eax
|
||||
incl %eax
|
||||
shrl $31, %eax
|
||||
ret
|
||||
END (__finite)
|
||||
weak_alias (__finite, finite)
|
||||
|
@ -1,18 +1,14 @@
|
||||
/*
|
||||
* Written by J.T. Conklin <jtc@netbsd.org>.
|
||||
* Public domain.
|
||||
* Written by Joe Keane <jgk@jgk.org>.
|
||||
*/
|
||||
|
||||
#include <machine/asm.h>
|
||||
|
||||
RCSID("$NetBSD: s_finitef.S,v 1.3 1995/05/09 00:00:02 jtc Exp $")
|
||||
|
||||
ENTRY(__finitef)
|
||||
movl 4(%esp),%eax
|
||||
andl $0x7f800000, %eax
|
||||
cmpl $0x7f800000, %eax
|
||||
setne %al
|
||||
andl $0x000000ff, %eax
|
||||
orl $0x807fffff, %eax
|
||||
incl %eax
|
||||
shrl $31, %eax
|
||||
ret
|
||||
END (__finitef)
|
||||
weak_alias (__finitef, finitef)
|
||||
|
@ -1,20 +1,14 @@
|
||||
/*
|
||||
* Written by J.T. Conklin <jtc@netbsd.org>.
|
||||
* Public domain.
|
||||
*
|
||||
* Adapted for `long double' by Ulrich Drepper <drepper@cygnus.com>.
|
||||
* Written by Joe Keane <jgk@jgk.org>.
|
||||
*/
|
||||
|
||||
#include <machine/asm.h>
|
||||
|
||||
RCSID("$NetBSD: $")
|
||||
|
||||
ENTRY(__finitel)
|
||||
movl 12(%esp),%eax
|
||||
andl $0x7fff, %eax
|
||||
cmpl $0x7fff, %eax
|
||||
setne %al
|
||||
andl $0x000000ff, %eax
|
||||
orl $0xffff8000, %eax
|
||||
incl %eax
|
||||
shrl $31, %eax
|
||||
ret
|
||||
END (__finitel)
|
||||
weak_alias (__finitel, finitel)
|
||||
|
23
sysdeps/libm-i387/s_nearbyint.S
Normal file
23
sysdeps/libm-i387/s_nearbyint.S
Normal file
@ -0,0 +1,23 @@
|
||||
/*
|
||||
* Written by J.T. Conklin <jtc@netbsd.org>.
|
||||
* Public domain.
|
||||
*/
|
||||
/* Adapted for use as nearbyint by Ulrich Drepper <drepper@cygnus.com>. */
|
||||
|
||||
#include <machine/asm.h>
|
||||
|
||||
ENTRY(__nearbyint)
|
||||
fldl 4(%esp)
|
||||
pushl %eax
|
||||
pushl %ecx
|
||||
fnstcw (%esp)
|
||||
movl (%esp), %eax
|
||||
andl $~0x20, %eax
|
||||
movl %eax, 4(%esp)
|
||||
fldcw 4(%esp)
|
||||
frndint
|
||||
fclex
|
||||
fldcw (%esp)
|
||||
ret
|
||||
END (__nearbyint)
|
||||
weak_alias (__nearbyint, nearbyint)
|
23
sysdeps/libm-i387/s_nearbyintf.S
Normal file
23
sysdeps/libm-i387/s_nearbyintf.S
Normal file
@ -0,0 +1,23 @@
|
||||
/*
|
||||
* Written by J.T. Conklin <jtc@netbsd.org>.
|
||||
* Public domain.
|
||||
*/
|
||||
/* Adapted for use as nearbyint by Ulrich Drepper <drepper@cygnus.com>. */
|
||||
|
||||
#include <machine/asm.h>
|
||||
|
||||
ENTRY(__nearbyintf)
|
||||
flds 4(%esp)
|
||||
pushl %eax
|
||||
pushl %ecx
|
||||
fnstcw (%esp)
|
||||
movl (%esp), %eax
|
||||
andl $~0x20, %eax
|
||||
movl %eax, 4(%esp)
|
||||
fldcw 4(%esp)
|
||||
frndint
|
||||
fclex
|
||||
fldcw (%esp)
|
||||
ret
|
||||
END (__nearbyintf)
|
||||
weak_alias (__nearbyintf, nearbyintf)
|
23
sysdeps/libm-i387/s_nearbyintl.S
Normal file
23
sysdeps/libm-i387/s_nearbyintl.S
Normal file
@ -0,0 +1,23 @@
|
||||
/*
|
||||
* Written by J.T. Conklin <jtc@netbsd.org>.
|
||||
* Public domain.
|
||||
*/
|
||||
/* Adapted for use as nearbyint by Ulrich Drepper <drepper@cygnus.com>. */
|
||||
|
||||
#include <machine/asm.h>
|
||||
|
||||
ENTRY(__nearbyintl)
|
||||
fldt 4(%esp)
|
||||
pushl %eax
|
||||
pushl %ecx
|
||||
fnstcw (%esp)
|
||||
movl (%esp), %eax
|
||||
andl $~0x20, %eax
|
||||
movl %eax, 4(%esp)
|
||||
fldcw 4(%esp)
|
||||
frndint
|
||||
fclex
|
||||
fldcw (%esp)
|
||||
ret
|
||||
END (__nearbyintl)
|
||||
weak_alias (__nearbyintl, nearbyintl)
|
36
sysdeps/libm-i387/s_trunc.S
Normal file
36
sysdeps/libm-i387/s_trunc.S
Normal file
@ -0,0 +1,36 @@
|
||||
/* Truncate double value.
|
||||
Copyright (C) 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <machine/asm.h>
|
||||
|
||||
ENTRY(__trunc)
|
||||
fldl 4(%esp)
|
||||
subl $8, %esp
|
||||
fstcw 4(%esp)
|
||||
movl $0xc00, %edx
|
||||
orl 4(%esp), %edx
|
||||
movl %edx, (%esp)
|
||||
fldcw (%esp)
|
||||
frndint
|
||||
fldcw 4(%esp)
|
||||
addl $8, %esp
|
||||
ret
|
||||
END(__trunc)
|
||||
weak_alias (__trunc, trunc)
|
36
sysdeps/libm-i387/s_truncf.S
Normal file
36
sysdeps/libm-i387/s_truncf.S
Normal file
@ -0,0 +1,36 @@
|
||||
/* Truncate float value.
|
||||
Copyright (C) 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <machine/asm.h>
|
||||
|
||||
ENTRY(__truncf)
|
||||
flds 4(%esp)
|
||||
subl $8, %esp
|
||||
fstcw 4(%esp)
|
||||
movl $0xc00, %edx
|
||||
orl 4(%esp), %edx
|
||||
movl %edx, (%esp)
|
||||
fldcw (%esp)
|
||||
frndint
|
||||
fldcw 4(%esp)
|
||||
addl $8, %esp
|
||||
ret
|
||||
END(__truncf)
|
||||
weak_alias (__truncf, truncf)
|
36
sysdeps/libm-i387/s_truncl.S
Normal file
36
sysdeps/libm-i387/s_truncl.S
Normal file
@ -0,0 +1,36 @@
|
||||
/* Truncate long double value.
|
||||
Copyright (C) 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <machine/asm.h>
|
||||
|
||||
ENTRY(__truncl)
|
||||
fldt 4(%esp)
|
||||
subl $8, %esp
|
||||
fstcw 4(%esp)
|
||||
movl $0xc00, %edx
|
||||
orl 4(%esp), %edx
|
||||
movl %edx, (%esp)
|
||||
fldcw (%esp)
|
||||
frndint
|
||||
fldcw 4(%esp)
|
||||
addl $8, %esp
|
||||
ret
|
||||
END(__truncl)
|
||||
weak_alias (__truncl, truncl)
|
41
sysdeps/libm-ieee754/s_cacos.c
Normal file
41
sysdeps/libm-ieee754/s_cacos.c
Normal file
@ -0,0 +1,41 @@
|
||||
/* Return cosine of complex double value.
|
||||
Copyright (C) 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <complex.h>
|
||||
#include <math.h>
|
||||
|
||||
__complex__ double
|
||||
__cacos (__complex__ double x)
|
||||
{
|
||||
__complex__ double y;
|
||||
__complex__ double res;
|
||||
|
||||
y = __casin (x);
|
||||
|
||||
__real__ res = (double) M_PI_2 - __real__ y;
|
||||
__imag__ res = -__imag__ y;
|
||||
|
||||
return res;
|
||||
}
|
||||
weak_alias (__cacos, cacos)
|
||||
#ifdef NO_LONG_DOUBLE
|
||||
strong_alias (__cacos, __cacosl)
|
||||
weak_alias (__cacos, cacosl)
|
||||
#endif
|
37
sysdeps/libm-ieee754/s_cacosf.c
Normal file
37
sysdeps/libm-ieee754/s_cacosf.c
Normal file
@ -0,0 +1,37 @@
|
||||
/* Return cosine of complex float value.
|
||||
Copyright (C) 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <complex.h>
|
||||
#include <math.h>
|
||||
|
||||
__complex__ float
|
||||
__cacosf (__complex__ float x)
|
||||
{
|
||||
__complex__ float y;
|
||||
__complex__ float res;
|
||||
|
||||
y = __casinf (x);
|
||||
|
||||
__real__ res = (float) M_PI_2 - __real__ y;
|
||||
__imag__ res = -__imag__ y;
|
||||
|
||||
return res;
|
||||
}
|
||||
weak_alias (__cacosf, cacosf)
|
88
sysdeps/libm-ieee754/s_cacosh.c
Normal file
88
sysdeps/libm-ieee754/s_cacosh.c
Normal file
@ -0,0 +1,88 @@
|
||||
/* Return arc hyperbole cosine for double value.
|
||||
Copyright (C) 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <complex.h>
|
||||
#include <math.h>
|
||||
|
||||
|
||||
__complex__ double
|
||||
__cacosh (__complex__ double x)
|
||||
{
|
||||
__complex__ double res;
|
||||
int rcls = fpclassify (__real__ x);
|
||||
int icls = fpclassify (__imag__ x);
|
||||
|
||||
if (rcls <= FP_INFINITE || icls <= FP_INFINITE)
|
||||
{
|
||||
if (icls == FP_INFINITE)
|
||||
{
|
||||
__real__ res = HUGE_VAL;
|
||||
|
||||
if (rcls == FP_NAN)
|
||||
__imag__ res = __nan ("");
|
||||
else
|
||||
__imag__ res = __copysign ((rcls == FP_INFINITE
|
||||
? (__real__ x < 0.0
|
||||
? M_PI - M_PI_4 : M_PI_4)
|
||||
: M_PI_2), __imag__ x);
|
||||
}
|
||||
else if (rcls == FP_INFINITE)
|
||||
{
|
||||
__real__ res = HUGE_VAL;
|
||||
|
||||
if (icls >= FP_ZERO)
|
||||
__imag__ res = __copysign (signbit (__real__ x) ? M_PI : 0.0,
|
||||
__imag__ x);
|
||||
else
|
||||
__imag__ res = __nan ("");
|
||||
}
|
||||
else
|
||||
{
|
||||
__real__ res = __nan ("");
|
||||
__imag__ res = __nan ("");
|
||||
}
|
||||
}
|
||||
else if (rcls == FP_ZERO && icls == FP_ZERO)
|
||||
{
|
||||
__real__ res = 0.0;
|
||||
__imag__ res = __copysign (M_PI_2, __imag__ x);
|
||||
}
|
||||
else
|
||||
{
|
||||
__complex__ double y;
|
||||
|
||||
__real__ y = (__real__ x - __imag__ x) * (__real__ x + __imag__ x) - 1.0;
|
||||
__imag__ y = 2.0 * __real__ x * __imag__ x;
|
||||
|
||||
y = __csqrt (y);
|
||||
|
||||
__real__ y += __real__ x;
|
||||
__imag__ y += __imag__ x;
|
||||
|
||||
res = __clog (y);
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
weak_alias (__cacosh, cacosh)
|
||||
#ifdef NO_LONG_DOUBLE
|
||||
strong_alias (__cacosh, __cacoshl)
|
||||
weak_alias (__cacosh, cacoshl)
|
||||
#endif
|
84
sysdeps/libm-ieee754/s_cacoshf.c
Normal file
84
sysdeps/libm-ieee754/s_cacoshf.c
Normal file
@ -0,0 +1,84 @@
|
||||
/* Return arc hyperbole cosine for float value.
|
||||
Copyright (C) 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <complex.h>
|
||||
#include <math.h>
|
||||
|
||||
|
||||
__complex__ float
|
||||
__cacoshf (__complex__ float x)
|
||||
{
|
||||
__complex__ float res;
|
||||
int rcls = fpclassify (__real__ x);
|
||||
int icls = fpclassify (__imag__ x);
|
||||
|
||||
if (rcls <= FP_INFINITE || icls <= FP_INFINITE)
|
||||
{
|
||||
if (icls == FP_INFINITE)
|
||||
{
|
||||
__real__ res = HUGE_VALF;
|
||||
|
||||
if (rcls == FP_NAN)
|
||||
__imag__ res = __nanf ("");
|
||||
else
|
||||
__imag__ res = __copysignf ((rcls == FP_INFINITE
|
||||
? (__real__ x < 0.0
|
||||
? M_PI - M_PI_4 : M_PI_4)
|
||||
: M_PI_2), __imag__ x);
|
||||
}
|
||||
else if (rcls == FP_INFINITE)
|
||||
{
|
||||
__real__ res = HUGE_VALF;
|
||||
|
||||
if (icls >= FP_ZERO)
|
||||
__imag__ res = __copysignf (signbit (__real__ x) ? M_PI : 0.0,
|
||||
__imag__ x);
|
||||
else
|
||||
__imag__ res = __nanf ("");
|
||||
}
|
||||
else
|
||||
{
|
||||
__real__ res = __nanf ("");
|
||||
__imag__ res = __nanf ("");
|
||||
}
|
||||
}
|
||||
else if (rcls == FP_ZERO && icls == FP_ZERO)
|
||||
{
|
||||
__real__ res = 0.0;
|
||||
__imag__ res = __copysignf (M_PI_2, __imag__ x);
|
||||
}
|
||||
else
|
||||
{
|
||||
__complex__ float y;
|
||||
|
||||
__real__ y = (__real__ x - __imag__ x) * (__real__ x + __imag__ x) - 1.0;
|
||||
__imag__ y = 2.0 * __real__ x * __imag__ x;
|
||||
|
||||
y = __csqrtf (y);
|
||||
|
||||
__real__ y += __real__ x;
|
||||
__imag__ y += __imag__ x;
|
||||
|
||||
res = __clogf (y);
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
weak_alias (__cacoshf, cacoshf)
|
84
sysdeps/libm-ieee754/s_cacoshl.c
Normal file
84
sysdeps/libm-ieee754/s_cacoshl.c
Normal file
@ -0,0 +1,84 @@
|
||||
/* Return arc hyperbole cosine for long double value.
|
||||
Copyright (C) 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <complex.h>
|
||||
#include <math.h>
|
||||
|
||||
|
||||
__complex__ long double
|
||||
__cacoshl (__complex__ long double x)
|
||||
{
|
||||
__complex__ long double res;
|
||||
int rcls = fpclassify (__real__ x);
|
||||
int icls = fpclassify (__imag__ x);
|
||||
|
||||
if (rcls <= FP_INFINITE || icls <= FP_INFINITE)
|
||||
{
|
||||
if (icls == FP_INFINITE)
|
||||
{
|
||||
__real__ res = HUGE_VALL;
|
||||
|
||||
if (rcls == FP_NAN)
|
||||
__imag__ res = __nanl ("");
|
||||
else
|
||||
__imag__ res = __copysignl ((rcls == FP_INFINITE
|
||||
? (__real__ x < 0.0
|
||||
? M_PI - M_PI_4 : M_PI_4)
|
||||
: M_PI_2), __imag__ x);
|
||||
}
|
||||
else if (rcls == FP_INFINITE)
|
||||
{
|
||||
__real__ res = HUGE_VALL;
|
||||
|
||||
if (icls >= FP_ZERO)
|
||||
__imag__ res = __copysignl (signbit (__real__ x) ? M_PI : 0.0,
|
||||
__imag__ x);
|
||||
else
|
||||
__imag__ res = __nanl ("");
|
||||
}
|
||||
else
|
||||
{
|
||||
__real__ res = __nanl ("");
|
||||
__imag__ res = __nanl ("");
|
||||
}
|
||||
}
|
||||
else if (rcls == FP_ZERO && icls == FP_ZERO)
|
||||
{
|
||||
__real__ res = 0.0;
|
||||
__imag__ res = __copysignl (M_PI_2, __imag__ x);
|
||||
}
|
||||
else
|
||||
{
|
||||
__complex__ long double y;
|
||||
|
||||
__real__ y = (__real__ x - __imag__ x) * (__real__ x + __imag__ x) - 1.0;
|
||||
__imag__ y = 2.0 * __real__ x * __imag__ x;
|
||||
|
||||
y = __csqrtl (y);
|
||||
|
||||
__real__ y += __real__ x;
|
||||
__imag__ y += __imag__ x;
|
||||
|
||||
res = __clogl (y);
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
weak_alias (__cacoshl, cacoshl)
|
37
sysdeps/libm-ieee754/s_cacosl.c
Normal file
37
sysdeps/libm-ieee754/s_cacosl.c
Normal file
@ -0,0 +1,37 @@
|
||||
/* Return cosine of complex long double value.
|
||||
Copyright (C) 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <complex.h>
|
||||
#include <math.h>
|
||||
|
||||
__complex__ long double
|
||||
__cacosl (__complex__ long double x)
|
||||
{
|
||||
__complex__ long double y;
|
||||
__complex__ long double res;
|
||||
|
||||
y = __casinl (x);
|
||||
|
||||
__real__ res = M_PI_2 - __real__ y;
|
||||
__imag__ res = -__imag__ y;
|
||||
|
||||
return res;
|
||||
}
|
||||
weak_alias (__cacosl, cacosl)
|
66
sysdeps/libm-ieee754/s_casin.c
Normal file
66
sysdeps/libm-ieee754/s_casin.c
Normal file
@ -0,0 +1,66 @@
|
||||
/* Return arc sine of complex double value.
|
||||
Copyright (C) 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <complex.h>
|
||||
#include <math.h>
|
||||
|
||||
|
||||
__complex__ double
|
||||
__casin (__complex__ double x)
|
||||
{
|
||||
__complex__ double res;
|
||||
|
||||
if (isnan (__real__ x) || isnan (__imag__ x))
|
||||
{
|
||||
if (__real__ x == 0.0)
|
||||
{
|
||||
res = x;
|
||||
}
|
||||
else if (__isinf (__real__ x) || __isinf (__imag__ x))
|
||||
{
|
||||
__real__ res = __nan ("");
|
||||
__imag__ res = __copysign (HUGE_VAL, __imag__ x);
|
||||
}
|
||||
else
|
||||
{
|
||||
__real__ res = __nan ("");
|
||||
__imag__ res = __nan ("");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
__complex__ double y;
|
||||
|
||||
__real__ y = -__imag__ x;
|
||||
__imag__ y = __real__ x;
|
||||
|
||||
y = __casinh (y);
|
||||
|
||||
__real__ res = __imag__ y;
|
||||
__imag__ res = -__real__ y;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
weak_alias (__casin, casin)
|
||||
#ifdef NO_LONG_DOUBLE
|
||||
strong_alias (__casin, __casinl)
|
||||
weak_alias (__casin, casinl)
|
||||
#endif
|
62
sysdeps/libm-ieee754/s_casinf.c
Normal file
62
sysdeps/libm-ieee754/s_casinf.c
Normal file
@ -0,0 +1,62 @@
|
||||
/* Return arc sine of complex float value.
|
||||
Copyright (C) 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <complex.h>
|
||||
#include <math.h>
|
||||
|
||||
|
||||
__complex__ float
|
||||
__casinf (__complex__ float x)
|
||||
{
|
||||
__complex__ float res;
|
||||
|
||||
if (isnan (__real__ x) || isnan (__imag__ x))
|
||||
{
|
||||
if (__real__ x == 0.0)
|
||||
{
|
||||
res = x;
|
||||
}
|
||||
else if (__isinff (__real__ x) || __isinff (__imag__ x))
|
||||
{
|
||||
__real__ res = __nanf ("");
|
||||
__imag__ res = __copysignf (HUGE_VALF, __imag__ x);
|
||||
}
|
||||
else
|
||||
{
|
||||
__real__ res = __nanf ("");
|
||||
__imag__ res = __nanf ("");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
__complex__ float y;
|
||||
|
||||
__real__ y = -__imag__ x;
|
||||
__imag__ y = __real__ x;
|
||||
|
||||
y = __casinhf (y);
|
||||
|
||||
__real__ res = __imag__ y;
|
||||
__imag__ res = -__real__ y;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
weak_alias (__casinf, casinf)
|
84
sysdeps/libm-ieee754/s_casinh.c
Normal file
84
sysdeps/libm-ieee754/s_casinh.c
Normal file
@ -0,0 +1,84 @@
|
||||
/* Return arc hyperbole sine for double value.
|
||||
Copyright (C) 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <complex.h>
|
||||
#include <math.h>
|
||||
|
||||
|
||||
__complex__ double
|
||||
__casinh (__complex__ double x)
|
||||
{
|
||||
__complex__ double res;
|
||||
int rcls = fpclassify (__real__ x);
|
||||
int icls = fpclassify (__imag__ x);
|
||||
|
||||
if (rcls <= FP_INFINITE || icls <= FP_INFINITE)
|
||||
{
|
||||
if (icls == FP_INFINITE)
|
||||
{
|
||||
__real__ res = __copysign (HUGE_VAL, __real__ x);
|
||||
|
||||
if (rcls == FP_NAN)
|
||||
__imag__ res = __nan ("");
|
||||
else
|
||||
__imag__ res = __copysign (rcls >= FP_ZERO ? M_PI_2 : M_PI_4,
|
||||
__imag__ x);
|
||||
}
|
||||
else if (rcls <= FP_INFINITE)
|
||||
{
|
||||
__real__ res = __real__ x;
|
||||
if ((rcls == FP_INFINITE && icls >= FP_ZERO)
|
||||
|| (rcls == FP_NAN && icls == FP_ZERO))
|
||||
__imag__ res = __copysign (0.0, __imag__ x);
|
||||
else
|
||||
__imag__ res = __nan ("");
|
||||
}
|
||||
else
|
||||
{
|
||||
__real__ res = __nan ("");
|
||||
__imag__ res = __nan ("");
|
||||
}
|
||||
}
|
||||
else if (rcls == FP_ZERO && icls == FP_ZERO)
|
||||
{
|
||||
res = x;
|
||||
}
|
||||
else
|
||||
{
|
||||
__complex__ double y;
|
||||
|
||||
__real__ y = (__real__ x - __imag__ x) * (__real__ x + __imag__ x) + 1.0;
|
||||
__imag__ y = 2.0 * __real__ x * __imag__ x;
|
||||
|
||||
y = __csqrt (y);
|
||||
|
||||
__real__ y += __real__ x;
|
||||
__imag__ y += __imag__ x;
|
||||
|
||||
res = __clog (y);
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
weak_alias (__casinh, casinh)
|
||||
#ifdef NO_LONG_DOUBLE
|
||||
strong_alias (__casinh, __casinhl)
|
||||
weak_alias (__casinh, casinhl)
|
||||
#endif
|
80
sysdeps/libm-ieee754/s_casinhf.c
Normal file
80
sysdeps/libm-ieee754/s_casinhf.c
Normal file
@ -0,0 +1,80 @@
|
||||
/* Return arc hyperbole sine for float value.
|
||||
Copyright (C) 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <complex.h>
|
||||
#include <math.h>
|
||||
|
||||
|
||||
__complex__ float
|
||||
__casinhf (__complex__ float x)
|
||||
{
|
||||
__complex__ float res;
|
||||
int rcls = fpclassify (__real__ x);
|
||||
int icls = fpclassify (__imag__ x);
|
||||
|
||||
if (rcls <= FP_INFINITE || icls <= FP_INFINITE)
|
||||
{
|
||||
if (icls == FP_INFINITE)
|
||||
{
|
||||
__real__ res = __copysignf (HUGE_VALF, __real__ x);
|
||||
|
||||
if (rcls == FP_NAN)
|
||||
__imag__ res = __nanf ("");
|
||||
else
|
||||
__imag__ res = __copysignf (rcls >= FP_ZERO ? M_PI_2 : M_PI_4,
|
||||
__imag__ x);
|
||||
}
|
||||
else if (rcls <= FP_INFINITE)
|
||||
{
|
||||
__real__ res = __real__ x;
|
||||
if ((rcls == FP_INFINITE && icls >= FP_ZERO)
|
||||
|| (rcls == FP_NAN && icls == FP_ZERO))
|
||||
__imag__ res = __copysignf (0.0, __imag__ x);
|
||||
else
|
||||
__imag__ res = __nanf ("");
|
||||
}
|
||||
else
|
||||
{
|
||||
__real__ res = __nanf ("");
|
||||
__imag__ res = __nanf ("");
|
||||
}
|
||||
}
|
||||
else if (rcls == FP_ZERO && icls == FP_ZERO)
|
||||
{
|
||||
res = x;
|
||||
}
|
||||
else
|
||||
{
|
||||
__complex__ float y;
|
||||
|
||||
__real__ y = (__real__ x - __imag__ x) * (__real__ x + __imag__ x) + 1.0;
|
||||
__imag__ y = 2.0 * __real__ x * __imag__ x;
|
||||
|
||||
y = __csqrtf (y);
|
||||
|
||||
__real__ y += __real__ x;
|
||||
__imag__ y += __imag__ x;
|
||||
|
||||
res = __clogf (y);
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
weak_alias (__casinhf, casinhf)
|
80
sysdeps/libm-ieee754/s_casinhl.c
Normal file
80
sysdeps/libm-ieee754/s_casinhl.c
Normal file
@ -0,0 +1,80 @@
|
||||
/* Return arc hyperbole sine for long double value.
|
||||
Copyright (C) 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <complex.h>
|
||||
#include <math.h>
|
||||
|
||||
|
||||
__complex__ long double
|
||||
__casinhl (__complex__ long double x)
|
||||
{
|
||||
__complex__ long double res;
|
||||
int rcls = fpclassify (__real__ x);
|
||||
int icls = fpclassify (__imag__ x);
|
||||
|
||||
if (rcls <= FP_INFINITE || icls <= FP_INFINITE)
|
||||
{
|
||||
if (icls == FP_INFINITE)
|
||||
{
|
||||
__real__ res = __copysignl (HUGE_VALL, __real__ x);
|
||||
|
||||
if (rcls == FP_NAN)
|
||||
__imag__ res = __nanl ("");
|
||||
else
|
||||
__imag__ res = __copysignl (rcls >= FP_ZERO ? M_PI_2 : M_PI_4,
|
||||
__imag__ x);
|
||||
}
|
||||
else if (rcls <= FP_INFINITE)
|
||||
{
|
||||
__real__ res = __real__ x;
|
||||
if ((rcls == FP_INFINITE && icls >= FP_ZERO)
|
||||
|| (rcls == FP_NAN && icls == FP_ZERO))
|
||||
__imag__ res = __copysignl (0.0, __imag__ x);
|
||||
else
|
||||
__imag__ res = __nanl ("");
|
||||
}
|
||||
else
|
||||
{
|
||||
__real__ res = __nanl ("");
|
||||
__imag__ res = __nanl ("");
|
||||
}
|
||||
}
|
||||
else if (rcls == FP_ZERO && icls == FP_ZERO)
|
||||
{
|
||||
res = x;
|
||||
}
|
||||
else
|
||||
{
|
||||
__complex__ long double y;
|
||||
|
||||
__real__ y = (__real__ x - __imag__ x) * (__real__ x + __imag__ x) + 1.0;
|
||||
__imag__ y = 2.0 * __real__ x * __imag__ x;
|
||||
|
||||
y = __csqrtl (y);
|
||||
|
||||
__real__ y += __real__ x;
|
||||
__imag__ y += __imag__ x;
|
||||
|
||||
res = __clogl (y);
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
weak_alias (__casinhl, casinhl)
|
62
sysdeps/libm-ieee754/s_casinl.c
Normal file
62
sysdeps/libm-ieee754/s_casinl.c
Normal file
@ -0,0 +1,62 @@
|
||||
/* Return arc sine of complex long double value.
|
||||
Copyright (C) 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <complex.h>
|
||||
#include <math.h>
|
||||
|
||||
|
||||
__complex__ long double
|
||||
__casinl (__complex__ long double x)
|
||||
{
|
||||
__complex__ long double res;
|
||||
|
||||
if (isnan (__real__ x) || isnan (__imag__ x))
|
||||
{
|
||||
if (__real__ x == 0.0)
|
||||
{
|
||||
res = x;
|
||||
}
|
||||
else if (__isinfl (__real__ x) || __isinfl (__imag__ x))
|
||||
{
|
||||
__real__ res = __nanl ("");
|
||||
__imag__ res = __copysignl (HUGE_VALL, __imag__ x);
|
||||
}
|
||||
else
|
||||
{
|
||||
__real__ res = __nanl ("");
|
||||
__imag__ res = __nanl ("");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
__complex__ long double y;
|
||||
|
||||
__real__ y = -__imag__ x;
|
||||
__imag__ y = __real__ x;
|
||||
|
||||
y = __casinhl (y);
|
||||
|
||||
__real__ res = __imag__ y;
|
||||
__imag__ res = -__real__ y;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
weak_alias (__casinl, casinl)
|
89
sysdeps/libm-ieee754/s_catan.c
Normal file
89
sysdeps/libm-ieee754/s_catan.c
Normal file
@ -0,0 +1,89 @@
|
||||
/* Return arc tangent of complex double value.
|
||||
Copyright (C) 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <complex.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "math_private.h"
|
||||
|
||||
|
||||
__complex__ double
|
||||
__catan (__complex__ double x)
|
||||
{
|
||||
__complex__ double res;
|
||||
int rcls = fpclassify (__real__ x);
|
||||
int icls = fpclassify (__imag__ x);
|
||||
|
||||
if (rcls <= FP_INFINITE || icls <= FP_INFINITE)
|
||||
{
|
||||
if (rcls == FP_INFINITE)
|
||||
{
|
||||
__real__ res = __copysign (M_PI_2, __real__ x);
|
||||
__imag__ res = __copysign (0.0, __imag__ x);
|
||||
}
|
||||
else if (icls == FP_INFINITE)
|
||||
{
|
||||
if (rcls >= FP_ZERO)
|
||||
__real__ res = __copysign (M_PI_2, __real__ x);
|
||||
else
|
||||
__real__ res = __nan ("");
|
||||
__imag__ res = __copysign (0.0, __imag__ x);
|
||||
}
|
||||
else if (icls == FP_ZERO || icls == FP_INFINITE)
|
||||
{
|
||||
__real__ res = __nan ("");
|
||||
__imag__ res = __copysign (0.0, __imag__ x);
|
||||
}
|
||||
else
|
||||
{
|
||||
__real__ res = __nan ("");
|
||||
__imag__ res = __nan ("");
|
||||
}
|
||||
}
|
||||
else if (rcls == FP_ZERO && icls == FP_ZERO)
|
||||
{
|
||||
res = x;
|
||||
}
|
||||
else
|
||||
{
|
||||
double r2, num, den;
|
||||
|
||||
r2 = __real__ x * __real__ x;
|
||||
|
||||
den = 1 - r2 - __imag__ x * __imag__ x;
|
||||
|
||||
__real__ res = 0.5 * __atan ((2.0 * __real__ x) / den);
|
||||
|
||||
num = __imag__ x + 1.0;
|
||||
num = r2 + num * num;
|
||||
|
||||
den = __imag__ x - 1.0;
|
||||
den = r2 + den * den;
|
||||
|
||||
__imag__ res = 0.25 * __ieee754_log (num / den);
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
weak_alias (__catan, catan)
|
||||
#ifdef NO_LONG_DOUBLE
|
||||
strong_alias (__catan, __catanl)
|
||||
weak_alias (__catan, catanl)
|
||||
#endif
|
85
sysdeps/libm-ieee754/s_catanf.c
Normal file
85
sysdeps/libm-ieee754/s_catanf.c
Normal file
@ -0,0 +1,85 @@
|
||||
/* Return arc tangent of complex float value.
|
||||
Copyright (C) 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <complex.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "math_private.h"
|
||||
|
||||
|
||||
__complex__ float
|
||||
__catanf (__complex__ float x)
|
||||
{
|
||||
__complex__ float res;
|
||||
int rcls = fpclassify (__real__ x);
|
||||
int icls = fpclassify (__imag__ x);
|
||||
|
||||
if (rcls <= FP_INFINITE || icls <= FP_INFINITE)
|
||||
{
|
||||
if (rcls == FP_INFINITE)
|
||||
{
|
||||
__real__ res = __copysignf (M_PI_2, __real__ x);
|
||||
__imag__ res = __copysignf (0.0, __imag__ x);
|
||||
}
|
||||
else if (icls == FP_INFINITE)
|
||||
{
|
||||
if (rcls >= FP_ZERO)
|
||||
__real__ res = __copysignf (M_PI_2, __real__ x);
|
||||
else
|
||||
__real__ res = __nanf ("");
|
||||
__imag__ res = __copysignf (0.0, __imag__ x);
|
||||
}
|
||||
else if (icls == FP_ZERO || icls == FP_INFINITE)
|
||||
{
|
||||
__real__ res = __nanf ("");
|
||||
__imag__ res = __copysignf (0.0, __imag__ x);
|
||||
}
|
||||
else
|
||||
{
|
||||
__real__ res = __nanf ("");
|
||||
__imag__ res = __nanf ("");
|
||||
}
|
||||
}
|
||||
else if (rcls == FP_ZERO && icls == FP_ZERO)
|
||||
{
|
||||
res = x;
|
||||
}
|
||||
else
|
||||
{
|
||||
float r2, num, den;
|
||||
|
||||
r2 = __real__ x * __real__ x;
|
||||
|
||||
den = 1 - r2 - __imag__ x * __imag__ x;
|
||||
|
||||
__real__ res = 0.5 * __atanf ((2.0 * __real__ x) / den);
|
||||
|
||||
num = __imag__ x + 1.0;
|
||||
num = r2 + num * num;
|
||||
|
||||
den = __imag__ x - 1.0;
|
||||
den = r2 + den * den;
|
||||
|
||||
__imag__ res = 0.25 * __ieee754_logf (num / den);
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
weak_alias (__catanf, catanf)
|
84
sysdeps/libm-ieee754/s_catanh.c
Normal file
84
sysdeps/libm-ieee754/s_catanh.c
Normal file
@ -0,0 +1,84 @@
|
||||
/* Return arc hyperbole tangent for double value.
|
||||
Copyright (C) 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <complex.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "math_private.h"
|
||||
|
||||
|
||||
__complex__ double
|
||||
__catanh (__complex__ double x)
|
||||
{
|
||||
__complex__ double res;
|
||||
int rcls = fpclassify (__real__ x);
|
||||
int icls = fpclassify (__imag__ x);
|
||||
|
||||
if (rcls <= FP_INFINITE || icls <= FP_INFINITE)
|
||||
{
|
||||
if (icls == FP_INFINITE)
|
||||
{
|
||||
__real__ res = __copysign (0.0, __real__ x);
|
||||
__imag__ res = __copysign (M_PI_2, __imag__ x);
|
||||
}
|
||||
else if (rcls == FP_INFINITE || rcls == FP_ZERO)
|
||||
{
|
||||
__real__ res = __copysign (0.0, __real__ x);
|
||||
if (icls >= FP_ZERO)
|
||||
__imag__ res = __copysign (M_PI_2, __imag__ x);
|
||||
else
|
||||
__imag__ res = __nan ("");
|
||||
}
|
||||
else
|
||||
{
|
||||
__real__ res = __nan ("");
|
||||
__imag__ res = __nan ("");
|
||||
}
|
||||
}
|
||||
else if (rcls == FP_ZERO && icls == FP_ZERO)
|
||||
{
|
||||
res = x;
|
||||
}
|
||||
else
|
||||
{
|
||||
double i2, num, den;
|
||||
|
||||
i2 = __imag__ x * __imag__ x;
|
||||
|
||||
num = 1.0 - __real__ x;
|
||||
num = i2 + num * num;
|
||||
|
||||
den = 1.0 + __real__ x;
|
||||
den = i2 + den * den;
|
||||
|
||||
__real__ res = 0.25 * __ieee754_log (num / den);
|
||||
|
||||
den = 1 - __real__ x * __real__ x - i2;
|
||||
|
||||
__imag__ res = 0.5 * __atan ((2.0 * __imag__ x) / den);
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
weak_alias (__catanh, catanh)
|
||||
#ifdef NO_LONG_DOUBLE
|
||||
strong_alias (__catanh, __catanhl)
|
||||
weak_alias (__catanh, catanhl)
|
||||
#endif
|
80
sysdeps/libm-ieee754/s_catanhf.c
Normal file
80
sysdeps/libm-ieee754/s_catanhf.c
Normal file
@ -0,0 +1,80 @@
|
||||
/* Return arc hyperbole tangent for float value.
|
||||
Copyright (C) 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <complex.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "math_private.h"
|
||||
|
||||
|
||||
__complex__ float
|
||||
__catanhf (__complex__ float x)
|
||||
{
|
||||
__complex__ float res;
|
||||
int rcls = fpclassify (__real__ x);
|
||||
int icls = fpclassify (__imag__ x);
|
||||
|
||||
if (rcls <= FP_INFINITE || icls <= FP_INFINITE)
|
||||
{
|
||||
if (icls == FP_INFINITE)
|
||||
{
|
||||
__real__ res = __copysignf (0.0, __real__ x);
|
||||
__imag__ res = __copysignf (M_PI_2, __imag__ x);
|
||||
}
|
||||
else if (rcls == FP_INFINITE || rcls == FP_ZERO)
|
||||
{
|
||||
__real__ res = __copysignf (0.0, __real__ x);
|
||||
if (icls >= FP_ZERO)
|
||||
__imag__ res = __copysignf (M_PI_2, __imag__ x);
|
||||
else
|
||||
__imag__ res = __nanf ("");
|
||||
}
|
||||
else
|
||||
{
|
||||
__real__ res = __nanf ("");
|
||||
__imag__ res = __nanf ("");
|
||||
}
|
||||
}
|
||||
else if (rcls == FP_ZERO && icls == FP_ZERO)
|
||||
{
|
||||
res = x;
|
||||
}
|
||||
else
|
||||
{
|
||||
float i2, num, den;
|
||||
|
||||
i2 = __imag__ x * __imag__ x;
|
||||
|
||||
num = 1.0 - __real__ x;
|
||||
num = i2 + num * num;
|
||||
|
||||
den = 1.0 + __real__ x;
|
||||
den = i2 + den * den;
|
||||
|
||||
__real__ res = 0.25 * __ieee754_logf (num / den);
|
||||
|
||||
den = 1 - __real__ x * __real__ x - i2;
|
||||
|
||||
__imag__ res = 0.5 * __atanf ((2.0 * __imag__ x) / den);
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
weak_alias (__catanhf, catanhf)
|
80
sysdeps/libm-ieee754/s_catanhl.c
Normal file
80
sysdeps/libm-ieee754/s_catanhl.c
Normal file
@ -0,0 +1,80 @@
|
||||
/* Return arc hyperbole tangent for long double value.
|
||||
Copyright (C) 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <complex.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "math_private.h"
|
||||
|
||||
|
||||
__complex__ long double
|
||||
__catanhl (__complex__ long double x)
|
||||
{
|
||||
__complex__ long double res;
|
||||
int rcls = fpclassify (__real__ x);
|
||||
int icls = fpclassify (__imag__ x);
|
||||
|
||||
if (rcls <= FP_INFINITE || icls <= FP_INFINITE)
|
||||
{
|
||||
if (icls == FP_INFINITE)
|
||||
{
|
||||
__real__ res = __copysignl (0.0, __real__ x);
|
||||
__imag__ res = __copysignl (M_PI_2, __imag__ x);
|
||||
}
|
||||
else if (rcls == FP_INFINITE || rcls == FP_ZERO)
|
||||
{
|
||||
__real__ res = __copysignl (0.0, __real__ x);
|
||||
if (icls >= FP_ZERO)
|
||||
__imag__ res = __copysignl (M_PI_2, __imag__ x);
|
||||
else
|
||||
__imag__ res = __nanl ("");
|
||||
}
|
||||
else
|
||||
{
|
||||
__real__ res = __nanl ("");
|
||||
__imag__ res = __nanl ("");
|
||||
}
|
||||
}
|
||||
else if (rcls == FP_ZERO && icls == FP_ZERO)
|
||||
{
|
||||
res = x;
|
||||
}
|
||||
else
|
||||
{
|
||||
long double i2, num, den;
|
||||
|
||||
i2 = __imag__ x * __imag__ x;
|
||||
|
||||
num = 1.0 - __real__ x;
|
||||
num = i2 + num * num;
|
||||
|
||||
den = 1.0 + __real__ x;
|
||||
den = i2 + den * den;
|
||||
|
||||
__real__ res = 0.25 * __ieee754_logl (num / den);
|
||||
|
||||
den = 1 - __real__ x * __real__ x - i2;
|
||||
|
||||
__imag__ res = 0.5 * __atanl ((2.0 * __imag__ x) / den);
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
weak_alias (__catanhl, catanhl)
|
85
sysdeps/libm-ieee754/s_catanl.c
Normal file
85
sysdeps/libm-ieee754/s_catanl.c
Normal file
@ -0,0 +1,85 @@
|
||||
/* Return arc tangent of complex long double value.
|
||||
Copyright (C) 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <complex.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "math_private.h"
|
||||
|
||||
|
||||
__complex__ long double
|
||||
__catanl (__complex__ long double x)
|
||||
{
|
||||
__complex__ long double res;
|
||||
int rcls = fpclassify (__real__ x);
|
||||
int icls = fpclassify (__imag__ x);
|
||||
|
||||
if (rcls <= FP_INFINITE || icls <= FP_INFINITE)
|
||||
{
|
||||
if (rcls == FP_INFINITE)
|
||||
{
|
||||
__real__ res = __copysignl (M_PI_2, __real__ x);
|
||||
__imag__ res = __copysignl (0.0, __imag__ x);
|
||||
}
|
||||
else if (icls == FP_INFINITE)
|
||||
{
|
||||
if (rcls >= FP_ZERO)
|
||||
__real__ res = __copysignl (M_PI_2, __real__ x);
|
||||
else
|
||||
__real__ res = __nanl ("");
|
||||
__imag__ res = __copysignl (0.0, __imag__ x);
|
||||
}
|
||||
else if (icls == FP_ZERO || icls == FP_INFINITE)
|
||||
{
|
||||
__real__ res = __nanl ("");
|
||||
__imag__ res = __copysignl (0.0, __imag__ x);
|
||||
}
|
||||
else
|
||||
{
|
||||
__real__ res = __nanl ("");
|
||||
__imag__ res = __nanl ("");
|
||||
}
|
||||
}
|
||||
else if (rcls == FP_ZERO && icls == FP_ZERO)
|
||||
{
|
||||
res = x;
|
||||
}
|
||||
else
|
||||
{
|
||||
long double r2, num, den;
|
||||
|
||||
r2 = __real__ x * __real__ x;
|
||||
|
||||
den = 1 - r2 - __imag__ x * __imag__ x;
|
||||
|
||||
__real__ res = 0.5 * __atanl ((2.0 * __real__ x) / den);
|
||||
|
||||
num = __imag__ x + 1.0;
|
||||
num = r2 + num * num;
|
||||
|
||||
den = __imag__ x - 1.0;
|
||||
den = r2 + den * den;
|
||||
|
||||
__imag__ res = 0.25 * __ieee754_logl (num / den);
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
weak_alias (__catanl, catanl)
|
64
sysdeps/libm-ieee754/s_ccos.c
Normal file
64
sysdeps/libm-ieee754/s_ccos.c
Normal file
@ -0,0 +1,64 @@
|
||||
/* Return cosine of complex double value.
|
||||
Copyright (C) 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <complex.h>
|
||||
#include <math.h>
|
||||
|
||||
|
||||
__complex__ double
|
||||
__ccos (__complex__ double x)
|
||||
{
|
||||
__complex__ double res;
|
||||
|
||||
if (!isfinite (__real__ x) || __isnan (__imag__ x))
|
||||
{
|
||||
if (__real__ x == 0.0 || __imag__ x == 0.0)
|
||||
{
|
||||
__real__ res = __nan ("");
|
||||
__imag__ res = 0.0;
|
||||
}
|
||||
else if (__isinf (__imag__ x))
|
||||
{
|
||||
__real__ res = HUGE_VAL;
|
||||
__imag__ res = __nan ("");
|
||||
}
|
||||
else
|
||||
{
|
||||
__real__ res = __nan ("");
|
||||
__imag__ res = __nan ("");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
__complex__ double y;
|
||||
|
||||
__real__ y = -__imag__ x;
|
||||
__imag__ y = __real__ x;
|
||||
|
||||
res = __ccosh (y);
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
weak_alias (__ccos, ccos)
|
||||
#ifdef NO_LONG_DOUBLE
|
||||
strong_alias (__ccos, __ccosl)
|
||||
weak_alias (__ccos, ccosl)
|
||||
#endif
|
60
sysdeps/libm-ieee754/s_ccosf.c
Normal file
60
sysdeps/libm-ieee754/s_ccosf.c
Normal file
@ -0,0 +1,60 @@
|
||||
/* Return cosine of complex float value.
|
||||
Copyright (C) 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <complex.h>
|
||||
#include <math.h>
|
||||
|
||||
|
||||
__complex__ float
|
||||
__ccosf (__complex__ float x)
|
||||
{
|
||||
__complex__ float res;
|
||||
|
||||
if (!isfinite (__real__ x) || __isnanf (__imag__ x))
|
||||
{
|
||||
if (__real__ x == 0.0 || __imag__ x == 0.0)
|
||||
{
|
||||
__real__ res = __nanf ("");
|
||||
__imag__ res = 0.0;
|
||||
}
|
||||
else if (__isinff (__imag__ x))
|
||||
{
|
||||
__real__ res = HUGE_VALF;
|
||||
__imag__ res = __nanf ("");
|
||||
}
|
||||
else
|
||||
{
|
||||
__real__ res = __nanf ("");
|
||||
__imag__ res = __nanf ("");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
__complex__ float y;
|
||||
|
||||
__real__ y = -__imag__ x;
|
||||
__imag__ y = __real__ x;
|
||||
|
||||
res = __ccoshf (y);
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
weak_alias (__ccosf, ccosf)
|
@ -21,47 +21,47 @@
|
||||
#include <complex.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "math_private.h"
|
||||
|
||||
|
||||
__complex__ double
|
||||
__ccosh (__complex__ double x)
|
||||
{
|
||||
__complex__ double retval;
|
||||
int rcls = fpclassify (__real__ x);
|
||||
int icls = fpclassify (__imag__ x);
|
||||
|
||||
__real__ x = fabs (__real__ x);
|
||||
|
||||
if (isfinite (__real__ x))
|
||||
if (rcls >= FP_ZERO)
|
||||
{
|
||||
if (isfinite (__imag__ x))
|
||||
/* Real part is finite. */
|
||||
if (icls >= FP_ZERO)
|
||||
{
|
||||
double exp_val = __exp (__real__ x);
|
||||
double rec_exp_val = 1.0 / exp_val;
|
||||
/* Imaginary part is finite. */
|
||||
double cosh_val = __ieee754_cosh (__real__ x);
|
||||
|
||||
__real__ retval = 0.5 * (exp_val + rec_exp_val) * __cos (__imag__ x);
|
||||
__imag__ retval = 0.5 * (exp_val + rec_exp_val) * __sin (__imag__ x);
|
||||
__real__ retval = cosh_val * __cos (__imag__ x);
|
||||
__imag__ retval = cosh_val * __sin (__imag__ x);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (__real__ x == 0)
|
||||
{
|
||||
__imag__ retval = 0.0;
|
||||
__real__ retval = __nan ("") + __nan ("");
|
||||
}
|
||||
else
|
||||
{
|
||||
__real__ retval = __nan ("");
|
||||
__imag__ retval = __nan ("") + __nan ("");
|
||||
}
|
||||
__imag__ retval = __real__ x == 0.0 ? 0.0 : __nan ("");
|
||||
__real__ retval = __nan ("") + __nan ("");
|
||||
}
|
||||
}
|
||||
else if (__isinf (__real__ x))
|
||||
else if (rcls == FP_INFINITE)
|
||||
{
|
||||
if (__imag__ x == 0.0)
|
||||
/* Real part is infinite. */
|
||||
if (icls == FP_ZERO)
|
||||
{
|
||||
/* Imaginary part is 0.0. */
|
||||
__real__ retval = HUGE_VAL;
|
||||
__imag__ retval = __imag__ x;
|
||||
}
|
||||
else if (isfinite (__imag__ x))
|
||||
else if (icls > FP_ZERO)
|
||||
{
|
||||
/* Imaginary part is finite. */
|
||||
__real__ retval = __copysign (HUGE_VAL, __cos (__imag__ x));
|
||||
__imag__ retval = __copysign (HUGE_VAL, __sin (__imag__ x));
|
||||
}
|
||||
@ -74,16 +74,8 @@ __ccosh (__complex__ double x)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (__imag__ x == 0.0)
|
||||
{
|
||||
__real__ retval = __nan ("");
|
||||
__imag__ retval = __imag__ x;
|
||||
}
|
||||
else
|
||||
{
|
||||
__real__ retval = __nan ("");
|
||||
__imag__ retval = __nan ("");
|
||||
}
|
||||
__real__ retval = __nan ("");
|
||||
__imag__ retval = __imag__ x == 0.0 ? __imag__ x : __nan ("");
|
||||
}
|
||||
|
||||
return retval;
|
||||
|
@ -21,49 +21,47 @@
|
||||
#include <complex.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "math_private.h"
|
||||
|
||||
|
||||
__complex__ float
|
||||
__ccoshf (__complex__ float x)
|
||||
{
|
||||
__complex__ float retval;
|
||||
int rcls = fpclassify (__real__ x);
|
||||
int icls = fpclassify (__imag__ x);
|
||||
|
||||
__real__ x = fabsf (__real__ x);
|
||||
|
||||
if (isfinite (__real__ x))
|
||||
if (rcls >= FP_ZERO)
|
||||
{
|
||||
if (isfinite (__imag__ x))
|
||||
/* Real part is finite. */
|
||||
if (icls >= FP_ZERO)
|
||||
{
|
||||
float exp_val = __expf (__real__ x);
|
||||
float rec_exp_val = 1.0 / exp_val;
|
||||
/* Imaginary part is finite. */
|
||||
float cosh_val = __ieee754_coshf (__real__ x);
|
||||
|
||||
__real__ retval = (0.5 * (exp_val + rec_exp_val)
|
||||
* __cosf (__imag__ x));
|
||||
__imag__ retval = (0.5 * (exp_val + rec_exp_val)
|
||||
* __sinf (__imag__ x));
|
||||
__real__ retval = cosh_val * __cosf (__imag__ x);
|
||||
__imag__ retval = cosh_val * __sinf (__imag__ x);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (__real__ x == 0)
|
||||
{
|
||||
__imag__ retval = 0.0;
|
||||
__real__ retval = __nanf ("") + __nanf ("");
|
||||
}
|
||||
else
|
||||
{
|
||||
__real__ retval = __nanf ("");
|
||||
__imag__ retval = __nanf ("") + __nanf ("");
|
||||
}
|
||||
__imag__ retval = __real__ x == 0.0 ? 0.0 : __nanf ("");
|
||||
__real__ retval = __nanf ("") + __nanf ("");
|
||||
}
|
||||
}
|
||||
else if (__isinff (__real__ x))
|
||||
else if (rcls == FP_INFINITE)
|
||||
{
|
||||
if (__imag__ x == 0.0)
|
||||
/* Real part is infinite. */
|
||||
if (icls == FP_ZERO)
|
||||
{
|
||||
/* Imaginary part is 0.0. */
|
||||
__real__ retval = HUGE_VALF;
|
||||
__imag__ retval = __imag__ x;
|
||||
}
|
||||
else if (isfinite (__imag__ x))
|
||||
else if (icls > FP_ZERO)
|
||||
{
|
||||
/* Imaginary part is finite. */
|
||||
__real__ retval = __copysignf (HUGE_VALF, __cosf (__imag__ x));
|
||||
__imag__ retval = __copysignf (HUGE_VALF, __sinf (__imag__ x));
|
||||
}
|
||||
@ -76,16 +74,8 @@ __ccoshf (__complex__ float x)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (__imag__ x == 0.0)
|
||||
{
|
||||
__real__ retval = __nanf ("");
|
||||
__imag__ retval = __imag__ x;
|
||||
}
|
||||
else
|
||||
{
|
||||
__real__ retval = __nanf ("");
|
||||
__imag__ retval = __nanf ("");
|
||||
}
|
||||
__real__ retval = __nanf ("");
|
||||
__imag__ retval = __imag__ x == 0.0 ? __imag__ x : __nanf ("");
|
||||
}
|
||||
|
||||
return retval;
|
||||
|
@ -21,49 +21,47 @@
|
||||
#include <complex.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "math_private.h"
|
||||
|
||||
|
||||
__complex__ long double
|
||||
__ccoshl (__complex__ long double x)
|
||||
{
|
||||
__complex__ long double retval;
|
||||
int rcls = fpclassify (__real__ x);
|
||||
int icls = fpclassify (__imag__ x);
|
||||
|
||||
__real__ x = fabsl (__real__ x);
|
||||
|
||||
if (isfinite (__real__ x))
|
||||
if (rcls >= FP_ZERO)
|
||||
{
|
||||
if (isfinite (__imag__ x))
|
||||
/* Real part is finite. */
|
||||
if (icls >= FP_ZERO)
|
||||
{
|
||||
long double exp_val = __expl (__real__ x);
|
||||
long double rec_exp_val = 1.0 / exp_val;
|
||||
/* Imaginary part is finite. */
|
||||
long double cosh_val = __ieee754_coshl (__real__ x);
|
||||
|
||||
__real__ retval = (0.5 * (exp_val + rec_exp_val)
|
||||
* __cosl (__imag__ x));
|
||||
__imag__ retval = (0.5 * (exp_val + rec_exp_val)
|
||||
* __sinl (__imag__ x));
|
||||
__real__ retval = cosh_val * __cosl (__imag__ x);
|
||||
__imag__ retval = cosh_val * __sinl (__imag__ x);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (__real__ x == 0)
|
||||
{
|
||||
__imag__ retval = 0.0;
|
||||
__real__ retval = __nanl ("") + __nanl ("");
|
||||
}
|
||||
else
|
||||
{
|
||||
__real__ retval = __nanl ("");
|
||||
__imag__ retval = __nanl ("") + __nanl ("");
|
||||
}
|
||||
__imag__ retval = __real__ x == 0.0 ? 0.0 : __nanl ("");
|
||||
__real__ retval = __nanl ("") + __nanl ("");
|
||||
}
|
||||
}
|
||||
else if (__isinfl (__real__ x))
|
||||
else if (rcls == FP_INFINITE)
|
||||
{
|
||||
if (__imag__ x == 0.0)
|
||||
/* Real part is infinite. */
|
||||
if (icls == FP_ZERO)
|
||||
{
|
||||
/* Imaginary part is 0.0. */
|
||||
__real__ retval = HUGE_VALL;
|
||||
__imag__ retval = __imag__ x;
|
||||
}
|
||||
else if (isfinite (__imag__ x))
|
||||
else if (icls > FP_ZERO)
|
||||
{
|
||||
/* Imaginary part is finite. */
|
||||
__real__ retval = __copysignl (HUGE_VALL, __cosl (__imag__ x));
|
||||
__imag__ retval = __copysignl (HUGE_VALL, __sinl (__imag__ x));
|
||||
}
|
||||
@ -76,16 +74,8 @@ __ccoshl (__complex__ long double x)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (__imag__ x == 0.0)
|
||||
{
|
||||
__real__ retval = __nanl ("");
|
||||
__imag__ retval = __imag__ x;
|
||||
}
|
||||
else
|
||||
{
|
||||
__real__ retval = __nanl ("");
|
||||
__imag__ retval = __nanl ("");
|
||||
}
|
||||
__real__ retval = __nanl ("");
|
||||
__imag__ retval = __imag__ x == 0.0 ? __imag__ x : __nanl ("");
|
||||
}
|
||||
|
||||
return retval;
|
||||
|
60
sysdeps/libm-ieee754/s_ccosl.c
Normal file
60
sysdeps/libm-ieee754/s_ccosl.c
Normal file
@ -0,0 +1,60 @@
|
||||
/* Return cosine of complex long double value.
|
||||
Copyright (C) 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <complex.h>
|
||||
#include <math.h>
|
||||
|
||||
|
||||
__complex__ long double
|
||||
__ccosl (__complex__ long double x)
|
||||
{
|
||||
__complex__ long double res;
|
||||
|
||||
if (!isfinite (__real__ x) || __isnanl (__imag__ x))
|
||||
{
|
||||
if (__real__ x == 0.0 || __imag__ x == 0.0)
|
||||
{
|
||||
__real__ res = __nanl ("");
|
||||
__imag__ res = 0.0;
|
||||
}
|
||||
else if (__isinfl (__imag__ x))
|
||||
{
|
||||
__real__ res = HUGE_VALL;
|
||||
__imag__ res = __nanl ("");
|
||||
}
|
||||
else
|
||||
{
|
||||
__real__ res = __nanl ("");
|
||||
__imag__ res = __nanl ("");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
__complex__ long double y;
|
||||
|
||||
__real__ y = -__imag__ x;
|
||||
__imag__ y = __real__ x;
|
||||
|
||||
res = __ccoshl (y);
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
weak_alias (__ccosl, ccosl)
|
@ -48,34 +48,34 @@ static long double huge = 1.0e4930;
|
||||
GET_LDOUBLE_WORDS(se,i0,i1,x);
|
||||
sx = (se>>15)&1;
|
||||
j0 = (se&0x7fff)-0x3fff;
|
||||
if(j0<32) {
|
||||
if(j0<31) {
|
||||
if(j0<0) { /* raise inexact if x != 0 */
|
||||
if(huge+x>0.0) {/* return 0*sign(x) if |x|<1 */
|
||||
if(sx) {es=0x8000;i0=0;i1=0;}
|
||||
else if((i0|i1)!=0) { es=0x3fff;i0=0;i1=0;}
|
||||
}
|
||||
} else {
|
||||
i = (0xffffffff)>>j0;
|
||||
i = (0x7fffffff)>>j0;
|
||||
if(((i0&i)|i1)==0) return x; /* x is integral */
|
||||
if(huge+x>0.0) { /* raise inexact flag */
|
||||
if(sx==0) {
|
||||
if (j0>0) i0 += (0x80000000)>>(j0-1);
|
||||
if (j0>0) i0 += (0x80000000)>>j0;
|
||||
else ++se;
|
||||
}
|
||||
i0 &= (~i); i1=0;
|
||||
}
|
||||
}
|
||||
} else if (j0>63) {
|
||||
} else if (j0>62) {
|
||||
if(j0==0x4000) return x+x; /* inf or NaN */
|
||||
else return x; /* x is integral */
|
||||
} else {
|
||||
i = ((u_int32_t)(0xffffffff))>>(j0-32);
|
||||
i = ((u_int32_t)(0xffffffff))>>(j0-31);
|
||||
if((i1&i)==0) return x; /* x is integral */
|
||||
if(huge+x>0.0) { /* raise inexact flag */
|
||||
if(sx==0) {
|
||||
if(j0==32) i0+=1;
|
||||
if(j0==31) i0+=1;
|
||||
else {
|
||||
j = i1 + (1<<(64-j0));
|
||||
j = i1 + (1<<(63-j0));
|
||||
if(j<i1) i0+=1; /* got a carry */
|
||||
i1 = j;
|
||||
}
|
||||
|
@ -21,17 +21,23 @@
|
||||
#include <complex.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "math_private.h"
|
||||
|
||||
|
||||
__complex__ float
|
||||
__cexpf (__complex__ float x)
|
||||
{
|
||||
__complex__ float retval;
|
||||
int rcls = fpclassify (__real__ x);
|
||||
int icls = fpclassify (__imag__ x);
|
||||
|
||||
if (isfinite (__real__ x))
|
||||
if (rcls >= FP_ZERO)
|
||||
{
|
||||
if (isfinite (__imag__ x))
|
||||
/* Real part is finite. */
|
||||
if (icls >= FP_ZERO)
|
||||
{
|
||||
float exp_val = __expf (__real__ x);
|
||||
/* Imaginary part is finite. */
|
||||
float exp_val = __ieee754_expf (__real__ x);
|
||||
|
||||
if (isfinite (exp_val))
|
||||
{
|
||||
@ -52,14 +58,17 @@ __cexpf (__complex__ float x)
|
||||
__imag__ retval = __nanf ("");
|
||||
}
|
||||
}
|
||||
else if (__isinff (__real__ x))
|
||||
else if (rcls == FP_INFINITE)
|
||||
{
|
||||
if (isfinite (__imag__ x))
|
||||
/* Real part is infinite. */
|
||||
if (icls >= FP_ZERO)
|
||||
{
|
||||
/* Imaginary part is finite. */
|
||||
float value = signbit (__real__ x) ? 0.0 : HUGE_VALF;
|
||||
|
||||
if (__imag__ x == 0.0)
|
||||
if (icls == FP_ZERO)
|
||||
{
|
||||
/* Imaginary part is 0.0. */
|
||||
__real__ retval = value;
|
||||
__imag__ retval = __imag__ x;
|
||||
}
|
||||
@ -82,7 +91,7 @@ __cexpf (__complex__ float x)
|
||||
}
|
||||
else
|
||||
{
|
||||
/* If the real part is NaN the result is NaN + iNan. */
|
||||
/* If the real part is NaN the result is NaN + iNaN. */
|
||||
__real__ retval = __nanf ("");
|
||||
__imag__ retval = __nanf ("");
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Return value of complex exponential function for float complex value.
|
||||
/* Return value of complex exponential function for long double complex value.
|
||||
Copyright (C) 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
|
||||
@ -21,17 +21,23 @@
|
||||
#include <complex.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "math_private.h"
|
||||
|
||||
|
||||
__complex__ long double
|
||||
__cexpl (__complex__ long double x)
|
||||
{
|
||||
__complex__ long double retval;
|
||||
int rcls = fpclassify (__real__ x);
|
||||
int icls = fpclassify (__imag__ x);
|
||||
|
||||
if (isfinite (__real__ x))
|
||||
if (rcls >= FP_ZERO)
|
||||
{
|
||||
if (isfinite (__imag__ x))
|
||||
/* Real part is finite. */
|
||||
if (icls >= FP_ZERO)
|
||||
{
|
||||
long double exp_val = __expl (__real__ x);
|
||||
/* Imaginary part is finite. */
|
||||
long double exp_val = __ieee754_expl (__real__ x);
|
||||
|
||||
if (isfinite (exp_val))
|
||||
{
|
||||
@ -52,14 +58,17 @@ __cexpl (__complex__ long double x)
|
||||
__imag__ retval = __nanl ("");
|
||||
}
|
||||
}
|
||||
else if (__isinfl (__real__ x))
|
||||
else if (rcls == FP_INFINITE)
|
||||
{
|
||||
if (isfinite (__imag__ x))
|
||||
/* Real part is infinite. */
|
||||
if (icls >= FP_ZERO)
|
||||
{
|
||||
/* Imaginary part is finite. */
|
||||
long double value = signbit (__real__ x) ? 0.0 : HUGE_VALL;
|
||||
|
||||
if (__imag__ x == 0.0)
|
||||
if (icls == FP_ZERO)
|
||||
{
|
||||
/* Imaginary part is 0.0. */
|
||||
__real__ retval = value;
|
||||
__imag__ retval = __imag__ x;
|
||||
}
|
||||
@ -89,4 +98,4 @@ __cexpl (__complex__ long double x)
|
||||
|
||||
return retval;
|
||||
}
|
||||
weak_alias (__cexp, cexp)
|
||||
weak_alias (__cexpl, cexpl)
|
||||
|
@ -28,17 +28,20 @@ __complex__ double
|
||||
__clog (__complex__ double x)
|
||||
{
|
||||
__complex__ double result;
|
||||
int rcls = fpclassify (__real__ x);
|
||||
int icls = fpclassify (__imag__ x);
|
||||
|
||||
if (__real__ x == 0.0 && __imag__ x == 0.0)
|
||||
if (rcls == FP_ZERO && icls == FP_ZERO)
|
||||
{
|
||||
/* Real and imaginary part are 0.0. */
|
||||
__imag__ result = signbit (__real__ x) ? M_PI : 0.0;
|
||||
if (signbit (__imag__ x))
|
||||
__imag__ result = __copysign (__imag__ result, -1.0);
|
||||
__imag__ result = __copysign (__imag__ result, __imag__ x);
|
||||
/* Yes, the following line raises an exception. */
|
||||
__real__ result = -1.0 / fabs (__real__ x);
|
||||
}
|
||||
else if (!__isnan (__real__ x) && !__isnan (__imag__ x))
|
||||
else if (rcls != FP_NAN && icls != FP_NAN)
|
||||
{
|
||||
/* Neither real nor imaginary part is NaN. */
|
||||
__real__ result = __ieee754_log (__ieee754_hypot (__real__ x,
|
||||
__imag__ x));
|
||||
__imag__ result = __ieee754_atan2 (__imag__ x, __real__ x);
|
||||
@ -46,7 +49,8 @@ __clog (__complex__ double x)
|
||||
else
|
||||
{
|
||||
__imag__ result = __nan ("");
|
||||
if (__isinf (__real__ x) || __isinf (__imag__ x))
|
||||
if (rcls == FP_INFINITE || icls == FP_INFINITE)
|
||||
/* Real or imaginary part is infinite. */
|
||||
__real__ result = HUGE_VAL;
|
||||
else
|
||||
__real__ result = __nan ("");
|
||||
|
@ -28,17 +28,20 @@ __complex__ float
|
||||
__clogf (__complex__ float x)
|
||||
{
|
||||
__complex__ float result;
|
||||
int rcls = fpclassify (__real__ x);
|
||||
int icls = fpclassify (__imag__ x);
|
||||
|
||||
if (__real__ x == 0.0 && __imag__ x == 0.0)
|
||||
if (rcls == FP_ZERO && icls == FP_ZERO)
|
||||
{
|
||||
/* Real and imaginary part are 0.0. */
|
||||
__imag__ result = signbit (__real__ x) ? M_PI : 0.0;
|
||||
if (signbit (__imag__ x))
|
||||
__imag__ result = __copysignf (__imag__ result, -1.0);
|
||||
__imag__ result = __copysignf (__imag__ result, __imag__ x);
|
||||
/* Yes, the following line raises an exception. */
|
||||
__real__ result = -1.0 / fabsf (__real__ x);
|
||||
}
|
||||
else if (!__isnanf (__real__ x) && !__isnanf (__imag__ x))
|
||||
else if (rcls != FP_NAN && icls != FP_NAN)
|
||||
{
|
||||
/* Neither real nor imaginary part is NaN. */
|
||||
__real__ result = __ieee754_logf (__ieee754_hypotf (__real__ x,
|
||||
__imag__ x));
|
||||
__imag__ result = __ieee754_atan2f (__imag__ x, __real__ x);
|
||||
@ -46,7 +49,8 @@ __clogf (__complex__ float x)
|
||||
else
|
||||
{
|
||||
__imag__ result = __nanf ("");
|
||||
if (__isinff (__real__ x) || __isinff (__imag__ x))
|
||||
if (rcls == FP_INFINITE || icls == FP_INFINITE)
|
||||
/* Real or imaginary part is infinite. */
|
||||
__real__ result = HUGE_VALF;
|
||||
else
|
||||
__real__ result = __nanf ("");
|
||||
|
@ -28,17 +28,20 @@ __complex__ long double
|
||||
__clogl (__complex__ long double x)
|
||||
{
|
||||
__complex__ long double result;
|
||||
int rcls = fpclassify (__real__ x);
|
||||
int icls = fpclassify (__imag__ x);
|
||||
|
||||
if (__real__ x == 0.0 && __imag__ x == 0.0)
|
||||
if (rcls == FP_ZERO && icls == FP_ZERO)
|
||||
{
|
||||
/* Real and imaginary part are 0.0. */
|
||||
__imag__ result = signbit (__real__ x) ? M_PI : 0.0;
|
||||
if (signbit (__imag__ x))
|
||||
__imag__ result = __copysignl (__imag__ result, -1.0);
|
||||
__imag__ result = __copysignl (__imag__ result, __imag__ x);
|
||||
/* Yes, the following line raises an exception. */
|
||||
__real__ result = -1.0 / fabsl (__real__ x);
|
||||
}
|
||||
else if (!__isnanl (__real__ x) && !__isnanl (__imag__ x))
|
||||
else if (rcls != FP_NAN && icls != FP_NAN)
|
||||
{
|
||||
/* Neither real nor imaginary part is NaN. */
|
||||
__real__ result = __ieee754_logl (__ieee754_hypotl (__real__ x,
|
||||
__imag__ x));
|
||||
__imag__ result = __ieee754_atan2l (__imag__ x, __real__ x);
|
||||
@ -46,7 +49,8 @@ __clogl (__complex__ long double x)
|
||||
else
|
||||
{
|
||||
__imag__ result = __nanl ("");
|
||||
if (__isinfl (__real__ x) || __isinfl (__imag__ x))
|
||||
if (rcls == FP_INFINITE || icls == FP_INFINITE)
|
||||
/* Real or imaginary part is infinite. */
|
||||
__real__ result = HUGE_VALL;
|
||||
else
|
||||
__real__ result = __nanl ("");
|
||||
|
34
sysdeps/libm-ieee754/s_cpow.c
Normal file
34
sysdeps/libm-ieee754/s_cpow.c
Normal file
@ -0,0 +1,34 @@
|
||||
/* Complex power of double values.
|
||||
Copyright (C) 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <complex.h>
|
||||
#include <math.h>
|
||||
|
||||
|
||||
__complex__ double
|
||||
__cpow (__complex__ double x, __complex__ double c)
|
||||
{
|
||||
return __cexp (c * __clog (x));
|
||||
}
|
||||
weak_alias (__cpow, cpow)
|
||||
#ifdef NO_LONG_DOUBLE
|
||||
strong_alias (__cpow, __cpowl)
|
||||
weak_alias (__cpow, cpowl)
|
||||
#endif
|
30
sysdeps/libm-ieee754/s_cpowf.c
Normal file
30
sysdeps/libm-ieee754/s_cpowf.c
Normal file
@ -0,0 +1,30 @@
|
||||
/* Complex power of float values.
|
||||
Copyright (C) 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <complex.h>
|
||||
#include <math.h>
|
||||
|
||||
|
||||
__complex__ float
|
||||
__cpowf (__complex__ float x, __complex__ float c)
|
||||
{
|
||||
return __cexpf (c * __clogf (x));
|
||||
}
|
||||
weak_alias (__cpowf, cpowf)
|
30
sysdeps/libm-ieee754/s_cpowl.c
Normal file
30
sysdeps/libm-ieee754/s_cpowl.c
Normal file
@ -0,0 +1,30 @@
|
||||
/* Complex power of long double values.
|
||||
Copyright (C) 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <complex.h>
|
||||
#include <math.h>
|
||||
|
||||
|
||||
__complex__ long double
|
||||
__cpowl (__complex__ long double x, __complex__ long double c)
|
||||
{
|
||||
return __cexpl (c * __clogl (x));
|
||||
}
|
||||
weak_alias (__cpowl, cpowl)
|
67
sysdeps/libm-ieee754/s_csin.c
Normal file
67
sysdeps/libm-ieee754/s_csin.c
Normal file
@ -0,0 +1,67 @@
|
||||
/* Complex sine function for double.
|
||||
Copyright (C) 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <complex.h>
|
||||
#include <math.h>
|
||||
|
||||
|
||||
__complex__ double
|
||||
__csin (__complex__ double x)
|
||||
{
|
||||
__complex__ double res;
|
||||
|
||||
if (!isfinite (__real__ x) || isnan (__imag__ x))
|
||||
{
|
||||
if (__real__ x == 0.0 || __imag__ x == 0.0)
|
||||
{
|
||||
__real__ res = __nan ("");
|
||||
__imag__ res = 0.0;
|
||||
}
|
||||
else if (__isinf (__imag__ x))
|
||||
{
|
||||
__real__ res = __nan ("");
|
||||
__imag__ res = __imag__ x;
|
||||
}
|
||||
else
|
||||
{
|
||||
__real__ res = __nan ("");
|
||||
__imag__ res = __nan ("");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
__complex__ double y;
|
||||
|
||||
__real__ y = -__imag__ x;
|
||||
__imag__ y = __real__ x;
|
||||
|
||||
y = __csinh (y);
|
||||
|
||||
__real__ res = __imag__ y;
|
||||
__imag__ res = -__real__ y;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
weak_alias (__csin, csin)
|
||||
#ifdef NO_LONG_DOUBLE
|
||||
strong_alias (__csin, __csinl)
|
||||
weak_alias (__csin, csinl)
|
||||
#endif
|
63
sysdeps/libm-ieee754/s_csinf.c
Normal file
63
sysdeps/libm-ieee754/s_csinf.c
Normal file
@ -0,0 +1,63 @@
|
||||
/* Complex sine function for float.
|
||||
Copyright (C) 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <complex.h>
|
||||
#include <math.h>
|
||||
|
||||
|
||||
__complex__ float
|
||||
__csinf (__complex__ float x)
|
||||
{
|
||||
__complex__ float res;
|
||||
|
||||
if (!isfinite (__real__ x) || isnan (__imag__ x))
|
||||
{
|
||||
if (__real__ x == 0.0 || __imag__ x == 0.0)
|
||||
{
|
||||
__real__ res = __nanf ("");
|
||||
__imag__ res = 0.0;
|
||||
}
|
||||
else if (__isinff (__imag__ x))
|
||||
{
|
||||
__real__ res = __nanf ("");
|
||||
__imag__ res = __imag__ x;
|
||||
}
|
||||
else
|
||||
{
|
||||
__real__ res = __nanf ("");
|
||||
__imag__ res = __nanf ("");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
__complex__ float y;
|
||||
|
||||
__real__ y = -__imag__ x;
|
||||
__imag__ y = __real__ x;
|
||||
|
||||
y = __csinhf (y);
|
||||
|
||||
__real__ res = __imag__ y;
|
||||
__imag__ res = -__real__ y;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
weak_alias (__csinf, csinf)
|
@ -21,32 +21,38 @@
|
||||
#include <complex.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "math_private.h"
|
||||
|
||||
|
||||
__complex__ double
|
||||
__csinh (__complex__ double x)
|
||||
{
|
||||
__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))
|
||||
if (rcls >= FP_ZERO)
|
||||
{
|
||||
if (isfinite (__imag__ x))
|
||||
/* Real part is finite. */
|
||||
if (icls >= FP_ZERO)
|
||||
{
|
||||
double exp_val = __exp (__real__ x);
|
||||
double rec_exp_val = 1.0 / exp_val;
|
||||
/* Imaginary part is finite. */
|
||||
double sinh_val = __ieee754_sinh (__real__ x);
|
||||
|
||||
__real__ retval = 0.5 * (exp_val - rec_exp_val) * __cos (__imag__ x);
|
||||
__imag__ retval = 0.5 * (exp_val - rec_exp_val) * __sin (__imag__ x);
|
||||
__real__ retval = sinh_val * __cos (__imag__ x);
|
||||
__imag__ retval = sinh_val * __sin (__imag__ x);
|
||||
|
||||
if (negate)
|
||||
__real__ retval = -__real__ retval;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (__real__ x == 0)
|
||||
if (rcls == FP_ZERO)
|
||||
{
|
||||
/* Real part is 0.0. */
|
||||
__real__ retval = __copysign (0.0, negate ? -1.0 : 1.0);
|
||||
__imag__ retval = __nan ("") + __nan ("");
|
||||
}
|
||||
@ -57,15 +63,18 @@ __csinh (__complex__ double x)
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (__isinf (__real__ x))
|
||||
else if (rcls == FP_INFINITE)
|
||||
{
|
||||
if (__imag__ x == 0.0)
|
||||
/* Real part is infinite. */
|
||||
if (icls == FP_ZERO)
|
||||
{
|
||||
/* Imaginary part is 0.0. */
|
||||
__real__ retval = negate ? -HUGE_VAL : HUGE_VAL;
|
||||
__imag__ retval = __imag__ x;
|
||||
}
|
||||
else if (isfinite (__imag__ x))
|
||||
else if (icls > FP_ZERO)
|
||||
{
|
||||
/* Imaginary part is finite. */
|
||||
__real__ retval = __copysign (HUGE_VAL, __cos (__imag__ x));
|
||||
__imag__ retval = __copysign (HUGE_VAL, __sin (__imag__ x));
|
||||
|
||||
@ -81,16 +90,8 @@ __csinh (__complex__ double x)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (__imag__ x == 0.0)
|
||||
{
|
||||
__real__ retval = __nan ("");
|
||||
__imag__ retval = __imag__ x;
|
||||
}
|
||||
else
|
||||
{
|
||||
__real__ retval = __nan ("");
|
||||
__imag__ retval = __nan ("");
|
||||
}
|
||||
__real__ retval = __nan ("");
|
||||
__imag__ retval = __imag__ x == 0.0 ? __imag__ x : __nan ("");
|
||||
}
|
||||
|
||||
return retval;
|
||||
|
@ -21,34 +21,38 @@
|
||||
#include <complex.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "math_private.h"
|
||||
|
||||
|
||||
__complex__ float
|
||||
__csinhf (__complex__ float x)
|
||||
{
|
||||
__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))
|
||||
if (rcls >= FP_ZERO)
|
||||
{
|
||||
if (isfinite (__imag__ x))
|
||||
/* Real part is finite. */
|
||||
if (icls >= FP_ZERO)
|
||||
{
|
||||
float exp_val = __expf (__real__ x);
|
||||
float rec_exp_val = 1.0 / exp_val;
|
||||
/* Imaginary part is finite. */
|
||||
float sinh_val = __ieee754_sinhf (__real__ x);
|
||||
|
||||
__real__ retval = (0.5 * (exp_val - rec_exp_val)
|
||||
* __cosf (__imag__ x));
|
||||
__imag__ retval = (0.5 * (exp_val - rec_exp_val)
|
||||
* __sinf (__imag__ x));
|
||||
__real__ retval = sinh_val * __cosf (__imag__ x);
|
||||
__imag__ retval = sinh_val * __sinf (__imag__ x);
|
||||
|
||||
if (negate)
|
||||
__real__ retval = -__real__ retval;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (__real__ x == 0)
|
||||
if (rcls == FP_ZERO)
|
||||
{
|
||||
/* Real part is 0.0. */
|
||||
__real__ retval = __copysignf (0.0, negate ? -1.0 : 1.0);
|
||||
__imag__ retval = __nanf ("") + __nanf ("");
|
||||
}
|
||||
@ -59,15 +63,18 @@ __csinhf (__complex__ float x)
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (__isinff (__real__ x))
|
||||
else if (rcls == FP_INFINITE)
|
||||
{
|
||||
if (__imag__ x == 0.0)
|
||||
/* Real part is infinite. */
|
||||
if (icls == FP_ZERO)
|
||||
{
|
||||
/* Imaginary part is 0.0. */
|
||||
__real__ retval = negate ? -HUGE_VALF : HUGE_VALF;
|
||||
__imag__ retval = __imag__ x;
|
||||
}
|
||||
else if (isfinite (__imag__ x))
|
||||
else if (icls > FP_ZERO)
|
||||
{
|
||||
/* Imaginary part is finite. */
|
||||
__real__ retval = __copysignf (HUGE_VALF, __cosf (__imag__ x));
|
||||
__imag__ retval = __copysignf (HUGE_VALF, __sinf (__imag__ x));
|
||||
|
||||
@ -83,16 +90,8 @@ __csinhf (__complex__ float x)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (__imag__ x == 0.0)
|
||||
{
|
||||
__real__ retval = __nanf ("");
|
||||
__imag__ retval = __imag__ x;
|
||||
}
|
||||
else
|
||||
{
|
||||
__real__ retval = __nanf ("");
|
||||
__imag__ retval = __nanf ("");
|
||||
}
|
||||
__real__ retval = __nanf ("");
|
||||
__imag__ retval = __imag__ x == 0.0 ? __imag__ x : __nanf ("");
|
||||
}
|
||||
|
||||
return retval;
|
||||
|
@ -21,34 +21,38 @@
|
||||
#include <complex.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "math_private.h"
|
||||
|
||||
|
||||
__complex__ long double
|
||||
__csinhl (__complex__ long double x)
|
||||
{
|
||||
__complex__ long double retval;
|
||||
int negate = signbit (__real__ x);
|
||||
int rcls = fpclassify (__real__ x);
|
||||
int icls = fpclassify (__imag__ x);
|
||||
|
||||
__real__ x = fabs (__real__ x);
|
||||
__real__ x = fabsl (__real__ x);
|
||||
|
||||
if (isfinite (__real__ x))
|
||||
if (rcls >= FP_ZERO)
|
||||
{
|
||||
if (isfinite (__imag__ x))
|
||||
/* Real part is finite. */
|
||||
if (icls >= FP_ZERO)
|
||||
{
|
||||
long double exp_val = __expl (__real__ x);
|
||||
long double rec_exp_val = 1.0 / exp_val;
|
||||
/* Imaginary part is finite. */
|
||||
long double sinh_val = __ieee754_sinhl (__real__ x);
|
||||
|
||||
__real__ retval = (0.5 * (exp_val - rec_exp_val)
|
||||
* __cosl (__imag__ x));
|
||||
__imag__ retval = (0.5 * (exp_val - rec_exp_val)
|
||||
* __sinl (__imag__ x));
|
||||
__real__ retval = sinh_val * __cosl (__imag__ x);
|
||||
__imag__ retval = sinh_val * __sinl (__imag__ x);
|
||||
|
||||
if (negate)
|
||||
__real__ retval = -__real__ retval;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (__real__ x == 0)
|
||||
if (rcls == FP_ZERO)
|
||||
{
|
||||
/* Real part is 0.0. */
|
||||
__real__ retval = __copysignl (0.0, negate ? -1.0 : 1.0);
|
||||
__imag__ retval = __nanl ("") + __nanl ("");
|
||||
}
|
||||
@ -59,15 +63,18 @@ __csinhl (__complex__ long double x)
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (__isinfl (__real__ x))
|
||||
else if (rcls == FP_INFINITE)
|
||||
{
|
||||
if (__imag__ x == 0.0)
|
||||
/* Real part is infinite. */
|
||||
if (icls == FP_ZERO)
|
||||
{
|
||||
/* Imaginary part is 0.0. */
|
||||
__real__ retval = negate ? -HUGE_VALL : HUGE_VALL;
|
||||
__imag__ retval = __imag__ x;
|
||||
}
|
||||
else if (isfinite (__imag__ x))
|
||||
else if (icls > FP_ZERO)
|
||||
{
|
||||
/* Imaginary part is finite. */
|
||||
__real__ retval = __copysignl (HUGE_VALL, __cosl (__imag__ x));
|
||||
__imag__ retval = __copysignl (HUGE_VALL, __sinl (__imag__ x));
|
||||
|
||||
@ -83,16 +90,8 @@ __csinhl (__complex__ long double x)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (__imag__ x == 0.0)
|
||||
{
|
||||
__real__ retval = __nanl ("");
|
||||
__imag__ retval = __imag__ x;
|
||||
}
|
||||
else
|
||||
{
|
||||
__real__ retval = __nanl ("");
|
||||
__imag__ retval = __nanl ("");
|
||||
}
|
||||
__real__ retval = __nanl ("");
|
||||
__imag__ retval = __imag__ x == 0.0 ? __imag__ x : __nanl ("");
|
||||
}
|
||||
|
||||
return retval;
|
||||
|
63
sysdeps/libm-ieee754/s_csinl.c
Normal file
63
sysdeps/libm-ieee754/s_csinl.c
Normal file
@ -0,0 +1,63 @@
|
||||
/* Complex sine function for long double.
|
||||
Copyright (C) 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <complex.h>
|
||||
#include <math.h>
|
||||
|
||||
|
||||
__complex__ long double
|
||||
__csinl (__complex__ long double x)
|
||||
{
|
||||
__complex__ long double res;
|
||||
|
||||
if (!isfinite (__real__ x) || isnan (__imag__ x))
|
||||
{
|
||||
if (__real__ x == 0.0 || __imag__ x == 0.0)
|
||||
{
|
||||
__real__ res = __nanl ("");
|
||||
__imag__ res = 0.0;
|
||||
}
|
||||
else if (__isinfl (__imag__ x))
|
||||
{
|
||||
__real__ res = __nanl ("");
|
||||
__imag__ res = __imag__ x;
|
||||
}
|
||||
else
|
||||
{
|
||||
__real__ res = __nanl ("");
|
||||
__imag__ res = __nanl ("");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
__complex__ long double y;
|
||||
|
||||
__real__ y = -__imag__ x;
|
||||
__imag__ y = __real__ x;
|
||||
|
||||
y = __csinhl (y);
|
||||
|
||||
__real__ res = __imag__ y;
|
||||
__imag__ res = -__real__ y;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
weak_alias (__csinl, csinl)
|
111
sysdeps/libm-ieee754/s_csqrt.c
Normal file
111
sysdeps/libm-ieee754/s_csqrt.c
Normal file
@ -0,0 +1,111 @@
|
||||
/* Complex square root of double value.
|
||||
Copyright (C) 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Based on an algorithm by Stephen L. Moshier <moshier@world.std.com>.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <complex.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "math_private.h"
|
||||
|
||||
|
||||
__complex__ double
|
||||
__csqrt (__complex__ double x)
|
||||
{
|
||||
__complex__ double res;
|
||||
int rcls = fpclassify (__real__ x);
|
||||
int icls = fpclassify (__imag__ x);
|
||||
|
||||
if (rcls <= FP_INFINITE || icls <= FP_INFINITE)
|
||||
{
|
||||
if (icls == FP_INFINITE)
|
||||
{
|
||||
__real__ res = HUGE_VAL;
|
||||
__imag__ res = __imag__ x;
|
||||
}
|
||||
else if (rcls == FP_INFINITE)
|
||||
{
|
||||
if (__real__ x < 0.0)
|
||||
{
|
||||
__real__ res = icls == FP_NAN ? __nan ("") : 0;
|
||||
__imag__ res = __copysign (HUGE_VAL, __imag__ x);
|
||||
}
|
||||
else
|
||||
{
|
||||
__real__ res = __real__ x;
|
||||
__imag__ res = (icls == FP_NAN
|
||||
? __nan ("") : __copysign (0.0, __imag__ x));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
__real__ res = __nan ("");
|
||||
__imag__ res = __nan ("");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (icls == FP_ZERO)
|
||||
{
|
||||
if (__real__ x < 0.0)
|
||||
{
|
||||
__real__ res = 0.0;
|
||||
__imag__ res = __copysign (__ieee754_sqrt (-__real__ x),
|
||||
__imag__ x);
|
||||
}
|
||||
else
|
||||
{
|
||||
__real__ res = fabs (__ieee754_sqrt (__real__ x));
|
||||
__imag__ res = __copysign (0.0, __imag__ x);
|
||||
}
|
||||
}
|
||||
else if (rcls == FP_ZERO)
|
||||
{
|
||||
double r = __ieee754_sqrt (0.5 * fabs (__imag__ x));
|
||||
|
||||
__real__ res = __copysign (r, __imag__ x);
|
||||
__imag__ res = r;
|
||||
}
|
||||
else
|
||||
{
|
||||
__complex__ double q;
|
||||
double t, r;
|
||||
|
||||
if (fabs (__imag__ x) < 2.0e-4 * fabs (__real__ x))
|
||||
t = 0.25 * __imag__ x * (__imag__ x / __real__ x);
|
||||
else
|
||||
t = 0.5 * (__ieee754_hypot (__real__ x, __imag__ x) - __real__ x);
|
||||
|
||||
r = __ieee754_sqrt (t);
|
||||
|
||||
__real__ q = __imag__ x / (2.0 * r);
|
||||
__imag__ q = r;
|
||||
|
||||
/* Heron iteration in complex arithmetic. */
|
||||
res = 0.5 * (q + q / x);
|
||||
}
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
weak_alias (__csqrt, csqrt)
|
||||
#ifdef NO_LONG_DOUBLE
|
||||
strong_alias (__csqrt, __csqrtl)
|
||||
weak_alias (__csqrt, csqrtl)
|
||||
#endif
|
107
sysdeps/libm-ieee754/s_csqrtf.c
Normal file
107
sysdeps/libm-ieee754/s_csqrtf.c
Normal file
@ -0,0 +1,107 @@
|
||||
/* Complex square root of float value.
|
||||
Copyright (C) 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Based on an algorithm by Stephen L. Moshier <moshier@world.std.com>.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <complex.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "math_private.h"
|
||||
|
||||
|
||||
__complex__ float
|
||||
__csqrtf (__complex__ float x)
|
||||
{
|
||||
__complex__ float res;
|
||||
int rcls = fpclassify (__real__ x);
|
||||
int icls = fpclassify (__imag__ x);
|
||||
|
||||
if (rcls <= FP_INFINITE || icls <= FP_INFINITE)
|
||||
{
|
||||
if (icls == FP_INFINITE)
|
||||
{
|
||||
__real__ res = HUGE_VALF;
|
||||
__imag__ res = __imag__ x;
|
||||
}
|
||||
else if (rcls == FP_INFINITE)
|
||||
{
|
||||
if (__real__ x < 0.0)
|
||||
{
|
||||
__real__ res = icls == FP_NAN ? __nanf ("") : 0;
|
||||
__imag__ res = __copysignf (HUGE_VALF, __imag__ x);
|
||||
}
|
||||
else
|
||||
{
|
||||
__real__ res = __real__ x;
|
||||
__imag__ res = (icls == FP_NAN
|
||||
? __nanf ("") : __copysignf (0.0, __imag__ x));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
__real__ res = __nanf ("");
|
||||
__imag__ res = __nanf ("");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (icls == FP_ZERO)
|
||||
{
|
||||
if (__real__ x < 0.0)
|
||||
{
|
||||
__real__ res = 0.0;
|
||||
__imag__ res = __copysignf (__ieee754_sqrtf (-__real__ x),
|
||||
__imag__ x);
|
||||
}
|
||||
else
|
||||
{
|
||||
__real__ res = fabsf (__ieee754_sqrtf (__real__ x));
|
||||
__imag__ res = __copysignf (0.0, __imag__ x);
|
||||
}
|
||||
}
|
||||
else if (rcls == FP_ZERO)
|
||||
{
|
||||
float r = __ieee754_sqrtf (0.5 * fabsf (__imag__ x));
|
||||
|
||||
__real__ res = __copysignf (r, __imag__ x);
|
||||
__imag__ res = r;
|
||||
}
|
||||
else
|
||||
{
|
||||
__complex__ float q;
|
||||
float t, r;
|
||||
|
||||
if (fabsf (__imag__ x) < 2.0e-4 * fabsf (__real__ x))
|
||||
t = 0.25 * __imag__ x * (__imag__ x / __real__ x);
|
||||
else
|
||||
t = 0.5 * (__ieee754_hypotf (__real__ x, __imag__ x) - __real__ x);
|
||||
|
||||
r = __ieee754_sqrtf (t);
|
||||
|
||||
__real__ q = __imag__ x / (2.0 * r);
|
||||
__imag__ q = r;
|
||||
|
||||
/* Heron iteration in complex arithmetic. */
|
||||
res = 0.5 * (q + q / x);
|
||||
}
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
weak_alias (__csqrtf, csqrtf)
|
107
sysdeps/libm-ieee754/s_csqrtl.c
Normal file
107
sysdeps/libm-ieee754/s_csqrtl.c
Normal file
@ -0,0 +1,107 @@
|
||||
/* Complex square root of long double value.
|
||||
Copyright (C) 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Based on an algorithm by Stephen L. Moshier <moshier@world.std.com>.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <complex.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "math_private.h"
|
||||
|
||||
|
||||
__complex__ long double
|
||||
__csqrtl (__complex__ long double x)
|
||||
{
|
||||
__complex__ long double res;
|
||||
int rcls = fpclassify (__real__ x);
|
||||
int icls = fpclassify (__imag__ x);
|
||||
|
||||
if (rcls <= FP_INFINITE || icls <= FP_INFINITE)
|
||||
{
|
||||
if (icls == FP_INFINITE)
|
||||
{
|
||||
__real__ res = HUGE_VALL;
|
||||
__imag__ res = __imag__ x;
|
||||
}
|
||||
else if (rcls == FP_INFINITE)
|
||||
{
|
||||
if (__real__ x < 0.0)
|
||||
{
|
||||
__real__ res = icls == FP_NAN ? __nanl ("") : 0;
|
||||
__imag__ res = __copysignl (HUGE_VALL, __imag__ x);
|
||||
}
|
||||
else
|
||||
{
|
||||
__real__ res = __real__ x;
|
||||
__imag__ res = (icls == FP_NAN
|
||||
? __nanl ("") : __copysignl (0.0, __imag__ x));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
__real__ res = __nanl ("");
|
||||
__imag__ res = __nanl ("");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (icls == FP_ZERO)
|
||||
{
|
||||
if (__real__ x < 0.0)
|
||||
{
|
||||
__real__ res = 0.0;
|
||||
__imag__ res = __copysignl (__ieee754_sqrtl (-__real__ x),
|
||||
__imag__ x);
|
||||
}
|
||||
else
|
||||
{
|
||||
__real__ res = fabsl (__ieee754_sqrtl (__real__ x));
|
||||
__imag__ res = __copysignl (0.0, __imag__ x);
|
||||
}
|
||||
}
|
||||
else if (rcls == FP_ZERO)
|
||||
{
|
||||
long double r = __ieee754_sqrtl (0.5 * fabsl (__imag__ x));
|
||||
|
||||
__real__ res = __copysignl (r, __imag__ x);
|
||||
__imag__ res = r;
|
||||
}
|
||||
else
|
||||
{
|
||||
__complex__ long double q;
|
||||
long double t, r;
|
||||
|
||||
if (fabsl (__imag__ x) < 2.0e-4 * fabsl (__real__ x))
|
||||
t = 0.25 * __imag__ x * (__imag__ x / __real__ x);
|
||||
else
|
||||
t = 0.5 * (__ieee754_hypotl (__real__ x, __imag__ x) - __real__ x);
|
||||
|
||||
r = __ieee754_sqrtl (t);
|
||||
|
||||
__real__ q = __imag__ x / (2.0 * r);
|
||||
__imag__ q = r;
|
||||
|
||||
/* Heron iteration in complex arithmetic. */
|
||||
res = 0.5 * (q + q / x);
|
||||
}
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
weak_alias (__csqrtl, csqrtl)
|
64
sysdeps/libm-ieee754/s_ctan.c
Normal file
64
sysdeps/libm-ieee754/s_ctan.c
Normal file
@ -0,0 +1,64 @@
|
||||
/* Complex tangent function for double.
|
||||
Copyright (C) 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <complex.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "math_private.h"
|
||||
|
||||
|
||||
__complex__ double
|
||||
__ctan (__complex__ double x)
|
||||
{
|
||||
__complex__ double res;
|
||||
|
||||
if (!finite (__real__ x) || !finite (__imag__ x))
|
||||
{
|
||||
if (__isinf (__imag__ x))
|
||||
{
|
||||
__real__ res = __copysign (0.0, __real__ x);
|
||||
__imag__ res = __copysign (1.0, __imag__ x);
|
||||
}
|
||||
else if (__real__ x == 0.0)
|
||||
{
|
||||
res = x;
|
||||
}
|
||||
else
|
||||
{
|
||||
__real__ res = __nan ("");
|
||||
__imag__ res = __nan ("");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
double den = (__cos (2.0 * __real__ x)
|
||||
+ __ieee754_cosh (2.0 * __imag__ x));
|
||||
|
||||
__real__ res = __sin (2.0 * __real__ x) / den;
|
||||
__imag__ res = __ieee754_sinh (2.0 * __imag__ x) / den;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
weak_alias (__ctan, ctan)
|
||||
#ifdef NO_LONG_DOUBLE
|
||||
strong_alias (__ctan, __ctanl)
|
||||
weak_alias (__ctan, ctanl)
|
||||
#endif
|
60
sysdeps/libm-ieee754/s_ctanf.c
Normal file
60
sysdeps/libm-ieee754/s_ctanf.c
Normal file
@ -0,0 +1,60 @@
|
||||
/* Complex tangent function for float.
|
||||
Copyright (C) 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <complex.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "math_private.h"
|
||||
|
||||
|
||||
__complex__ float
|
||||
__ctanf (__complex__ float x)
|
||||
{
|
||||
__complex__ float res;
|
||||
|
||||
if (!finite (__real__ x) || !finite (__imag__ x))
|
||||
{
|
||||
if (__isinff (__imag__ x))
|
||||
{
|
||||
__real__ res = __copysignf (0.0, __real__ x);
|
||||
__imag__ res = __copysignf (1.0, __imag__ x);
|
||||
}
|
||||
else if (__real__ x == 0.0)
|
||||
{
|
||||
res = x;
|
||||
}
|
||||
else
|
||||
{
|
||||
__real__ res = __nanf ("");
|
||||
__imag__ res = __nanf ("");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
float den = (__cosf (2.0 * __real__ x)
|
||||
+ __ieee754_coshf (2.0 * __imag__ x));
|
||||
|
||||
__real__ res = __sinf (2.0 * __real__ x) / den;
|
||||
__imag__ res = __ieee754_sinhf (2.0 * __imag__ x) / den;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
weak_alias (__ctanf, ctanf)
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user