From 28f540f45bbacd939bfd07f213bcad2bf730b1bf Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Sat, 18 Feb 1995 01:27:10 +0000 Subject: initial import --- sysdeps/generic/Dist | 8 + sysdeps/generic/Makefile | 60 +++++ sysdeps/generic/_strerror.c | 43 ++++ sysdeps/generic/abort.c | 42 ++++ sysdeps/generic/acos.c | 42 ++++ sysdeps/generic/acosh.c | 102 +++++++++ sysdeps/generic/add_1.c | 61 ++++++ sysdeps/generic/add_n.c | 61 ++++++ sysdeps/generic/addmul_1.c | 64 ++++++ sysdeps/generic/asin.c | 44 ++++ sysdeps/generic/asincos.c | 169 ++++++++++++++ sysdeps/generic/asinh.c | 101 +++++++++ sysdeps/generic/atan.c | 27 +++ sysdeps/generic/atan2.c | 281 ++++++++++++++++++++++++ sysdeps/generic/atanh.c | 83 +++++++ sysdeps/generic/bcopy.c | 31 +++ sysdeps/generic/bzero.c | 81 +++++++ sysdeps/generic/cabs.c | 26 +++ sysdeps/generic/ceil.c | 68 ++++++ sysdeps/generic/cmp.c | 55 +++++ sysdeps/generic/configure | 52 +++++ sysdeps/generic/configure.in | 7 + sysdeps/generic/confname.h | 76 +++++++ sysdeps/generic/copysign.c | 30 +++ sysdeps/generic/cosh.c | 133 +++++++++++ sysdeps/generic/det_endian.c | 34 +++ sysdeps/generic/divmod.c | 234 ++++++++++++++++++++ sysdeps/generic/divmod_1.c | 209 ++++++++++++++++++ sysdeps/generic/exp.c | 203 +++++++++++++++++ sysdeps/generic/exp__E.c | 136 ++++++++++++ sysdeps/generic/expm1.c | 169 ++++++++++++++ sysdeps/generic/fabs.c | 27 +++ sysdeps/generic/ffs.c | 47 ++++ sysdeps/generic/floor.c | 74 +++++++ sysdeps/generic/fmod.c | 155 +++++++++++++ sysdeps/generic/frexp.c | 53 +++++ sysdeps/generic/ftime.c | 44 ++++ sysdeps/generic/get_str.c | 213 ++++++++++++++++++ sysdeps/generic/getenv.c | 44 ++++ sysdeps/generic/getpgrp.c | 28 +++ sysdeps/generic/gmp-mparam.h | 26 +++ sysdeps/generic/htonl.c | 32 +++ sysdeps/generic/htons.c | 32 +++ sysdeps/generic/hypot.c | 27 +++ sysdeps/generic/infnan.c | 48 ++++ sysdeps/generic/isnan.c | 29 +++ sysdeps/generic/ldexp.c | 27 +++ sysdeps/generic/log.c | 486 +++++++++++++++++++++++++++++++++++++++++ sysdeps/generic/log10.c | 37 ++++ sysdeps/generic/log1p.c | 170 ++++++++++++++ sysdeps/generic/log__L.c | 110 ++++++++++ sysdeps/generic/lshift.c | 86 ++++++++ sysdeps/generic/lstat.c | 31 +++ sysdeps/generic/make_siglist.c | 51 +++++ sysdeps/generic/mathimpl.h | 127 +++++++++++ sysdeps/generic/memccpy.c | 44 ++++ sysdeps/generic/memchr.c | 168 ++++++++++++++ sysdeps/generic/memcmp.c | 369 +++++++++++++++++++++++++++++++ sysdeps/generic/memcopy.h | 149 +++++++++++++ sysdeps/generic/memcpy.c | 55 +++++ sysdeps/generic/memmem.c | 46 ++++ sysdeps/generic/memmove.c | 99 +++++++++ sysdeps/generic/memset.c | 85 +++++++ sysdeps/generic/mig-reply.c | 53 +++++ sysdeps/generic/mod_1.c | 198 +++++++++++++++++ sysdeps/generic/modf.c | 31 +++ sysdeps/generic/morecore.c | 48 ++++ sysdeps/generic/mul.c | 147 +++++++++++++ sysdeps/generic/mul_1.c | 58 +++++ sysdeps/generic/mul_n.c | 420 +++++++++++++++++++++++++++++++++++ sysdeps/generic/ntohl.c | 32 +++ sysdeps/generic/ntohs.c | 32 +++ sysdeps/generic/pow.c | 215 ++++++++++++++++++ sysdeps/generic/putenv.c | 101 +++++++++ sysdeps/generic/resourcebits.h | 53 +++++ sysdeps/generic/rint.c | 87 ++++++++ sysdeps/generic/rshift.c | 87 ++++++++ sysdeps/generic/sbrk.c | 42 ++++ sysdeps/generic/setenv.c | 86 ++++++++ sysdeps/generic/sigaction.h | 50 +++++ sysdeps/generic/signame.c | 275 +++++++++++++++++++++++ sysdeps/generic/signame.h | 57 +++++ sysdeps/generic/sigset.h | 79 +++++++ sysdeps/generic/sincos.c | 98 +++++++++ sysdeps/generic/sinh.c | 121 ++++++++++ sysdeps/generic/sockaddrcom.h | 34 +++ sysdeps/generic/speed.c | 67 ++++++ sysdeps/generic/stpcpy.c | 35 +++ sysdeps/generic/stpncpy.c | 89 ++++++++ sysdeps/generic/strcasecmp.c | 46 ++++ sysdeps/generic/strcat.c | 48 ++++ sysdeps/generic/strchr.c | 183 ++++++++++++++++ sysdeps/generic/strcmp.c | 43 ++++ sysdeps/generic/strcpy.c | 41 ++++ sysdeps/generic/strcspn.c | 38 ++++ sysdeps/generic/strlen.c | 149 +++++++++++++ sysdeps/generic/strncase.c | 47 ++++ sysdeps/generic/strncat.c | 76 +++++++ sysdeps/generic/strncmp.c | 69 ++++++ sysdeps/generic/strncpy.c | 82 +++++++ sysdeps/generic/strpbrk.c | 38 ++++ sysdeps/generic/strrchr.c | 49 +++++ sysdeps/generic/strsep.c | 39 ++++ sysdeps/generic/strspn.c | 44 ++++ sysdeps/generic/strstr.c | 56 +++++ sysdeps/generic/sub_n.c | 61 ++++++ sysdeps/generic/submul_1.c | 64 ++++++ sysdeps/generic/sys/mman.h | 106 +++++++++ sysdeps/generic/sysd-stdio.c | 189 ++++++++++++++++ sysdeps/generic/tan.c | 74 +++++++ sysdeps/generic/tanh.c | 99 +++++++++ sysdeps/generic/termbits.h | 202 +++++++++++++++++ sysdeps/generic/trig.h | 215 ++++++++++++++++++ sysdeps/generic/uname.c | 63 ++++++ sysdeps/generic/utsnamelen.h | 3 + sysdeps/generic/varargs.h | 61 ++++++ sysdeps/generic/vfork.c | 31 +++ sysdeps/generic/vlimit.c | 51 +++++ sysdeps/generic/vtimes.c | 66 ++++++ sysdeps/generic/waitstatus.h | 103 +++++++++ sysdeps/generic/wordcopy.c | 405 ++++++++++++++++++++++++++++++++++ 121 files changed, 11187 insertions(+) create mode 100644 sysdeps/generic/Dist create mode 100644 sysdeps/generic/Makefile create mode 100644 sysdeps/generic/_strerror.c create mode 100644 sysdeps/generic/abort.c create mode 100644 sysdeps/generic/acos.c create mode 100644 sysdeps/generic/acosh.c create mode 100644 sysdeps/generic/add_1.c create mode 100644 sysdeps/generic/add_n.c create mode 100644 sysdeps/generic/addmul_1.c create mode 100644 sysdeps/generic/asin.c create mode 100644 sysdeps/generic/asincos.c create mode 100644 sysdeps/generic/asinh.c create mode 100644 sysdeps/generic/atan.c create mode 100644 sysdeps/generic/atan2.c create mode 100644 sysdeps/generic/atanh.c create mode 100644 sysdeps/generic/bcopy.c create mode 100644 sysdeps/generic/bzero.c create mode 100644 sysdeps/generic/cabs.c create mode 100644 sysdeps/generic/ceil.c create mode 100644 sysdeps/generic/cmp.c create mode 100755 sysdeps/generic/configure create mode 100644 sysdeps/generic/configure.in create mode 100644 sysdeps/generic/confname.h create mode 100644 sysdeps/generic/copysign.c create mode 100644 sysdeps/generic/cosh.c create mode 100644 sysdeps/generic/det_endian.c create mode 100644 sysdeps/generic/divmod.c create mode 100644 sysdeps/generic/divmod_1.c create mode 100644 sysdeps/generic/exp.c create mode 100644 sysdeps/generic/exp__E.c create mode 100644 sysdeps/generic/expm1.c create mode 100644 sysdeps/generic/fabs.c create mode 100644 sysdeps/generic/ffs.c create mode 100644 sysdeps/generic/floor.c create mode 100644 sysdeps/generic/fmod.c create mode 100644 sysdeps/generic/frexp.c create mode 100644 sysdeps/generic/ftime.c create mode 100644 sysdeps/generic/get_str.c create mode 100644 sysdeps/generic/getenv.c create mode 100644 sysdeps/generic/getpgrp.c create mode 100644 sysdeps/generic/gmp-mparam.h create mode 100644 sysdeps/generic/htonl.c create mode 100644 sysdeps/generic/htons.c create mode 100644 sysdeps/generic/hypot.c create mode 100644 sysdeps/generic/infnan.c create mode 100644 sysdeps/generic/isnan.c create mode 100644 sysdeps/generic/ldexp.c create mode 100644 sysdeps/generic/log.c create mode 100644 sysdeps/generic/log10.c create mode 100644 sysdeps/generic/log1p.c create mode 100644 sysdeps/generic/log__L.c create mode 100644 sysdeps/generic/lshift.c create mode 100644 sysdeps/generic/lstat.c create mode 100644 sysdeps/generic/make_siglist.c create mode 100644 sysdeps/generic/mathimpl.h create mode 100644 sysdeps/generic/memccpy.c create mode 100644 sysdeps/generic/memchr.c create mode 100644 sysdeps/generic/memcmp.c create mode 100644 sysdeps/generic/memcopy.h create mode 100644 sysdeps/generic/memcpy.c create mode 100644 sysdeps/generic/memmem.c create mode 100644 sysdeps/generic/memmove.c create mode 100644 sysdeps/generic/memset.c create mode 100644 sysdeps/generic/mig-reply.c create mode 100644 sysdeps/generic/mod_1.c create mode 100644 sysdeps/generic/modf.c create mode 100644 sysdeps/generic/morecore.c create mode 100644 sysdeps/generic/mul.c create mode 100644 sysdeps/generic/mul_1.c create mode 100644 sysdeps/generic/mul_n.c create mode 100644 sysdeps/generic/ntohl.c create mode 100644 sysdeps/generic/ntohs.c create mode 100644 sysdeps/generic/pow.c create mode 100644 sysdeps/generic/putenv.c create mode 100644 sysdeps/generic/resourcebits.h create mode 100644 sysdeps/generic/rint.c create mode 100644 sysdeps/generic/rshift.c create mode 100644 sysdeps/generic/sbrk.c create mode 100644 sysdeps/generic/setenv.c create mode 100644 sysdeps/generic/sigaction.h create mode 100644 sysdeps/generic/signame.c create mode 100644 sysdeps/generic/signame.h create mode 100644 sysdeps/generic/sigset.h create mode 100644 sysdeps/generic/sincos.c create mode 100644 sysdeps/generic/sinh.c create mode 100644 sysdeps/generic/sockaddrcom.h create mode 100644 sysdeps/generic/speed.c create mode 100644 sysdeps/generic/stpcpy.c create mode 100644 sysdeps/generic/stpncpy.c create mode 100644 sysdeps/generic/strcasecmp.c create mode 100644 sysdeps/generic/strcat.c create mode 100644 sysdeps/generic/strchr.c create mode 100644 sysdeps/generic/strcmp.c create mode 100644 sysdeps/generic/strcpy.c create mode 100644 sysdeps/generic/strcspn.c create mode 100644 sysdeps/generic/strlen.c create mode 100644 sysdeps/generic/strncase.c create mode 100644 sysdeps/generic/strncat.c create mode 100644 sysdeps/generic/strncmp.c create mode 100644 sysdeps/generic/strncpy.c create mode 100644 sysdeps/generic/strpbrk.c create mode 100644 sysdeps/generic/strrchr.c create mode 100644 sysdeps/generic/strsep.c create mode 100644 sysdeps/generic/strspn.c create mode 100644 sysdeps/generic/strstr.c create mode 100644 sysdeps/generic/sub_n.c create mode 100644 sysdeps/generic/submul_1.c create mode 100644 sysdeps/generic/sys/mman.h create mode 100644 sysdeps/generic/sysd-stdio.c create mode 100644 sysdeps/generic/tan.c create mode 100644 sysdeps/generic/tanh.c create mode 100644 sysdeps/generic/termbits.h create mode 100644 sysdeps/generic/trig.h create mode 100644 sysdeps/generic/uname.c create mode 100644 sysdeps/generic/utsnamelen.h create mode 100644 sysdeps/generic/varargs.h create mode 100644 sysdeps/generic/vfork.c create mode 100644 sysdeps/generic/vlimit.c create mode 100644 sysdeps/generic/vtimes.c create mode 100644 sysdeps/generic/waitstatus.h create mode 100644 sysdeps/generic/wordcopy.c (limited to 'sysdeps/generic') diff --git a/sysdeps/generic/Dist b/sysdeps/generic/Dist new file mode 100644 index 0000000000..2431f7b272 --- /dev/null +++ b/sysdeps/generic/Dist @@ -0,0 +1,8 @@ +make_siglist.c signame.c signame.h +det_endian.c +mathimpl.h +trig.h +sincos.c +asincos.c +exp__E.c +log__L.c diff --git a/sysdeps/generic/Makefile b/sysdeps/generic/Makefile new file mode 100644 index 0000000000..b80b073d0c --- /dev/null +++ b/sysdeps/generic/Makefile @@ -0,0 +1,60 @@ +# Copyright (C) 1992, 1993, 1994 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., 675 Mass Ave, +# Cambridge, MA 02139, USA. + +ifeq ($(subdir),math) +ifndef math-twiddled + +elided-routines := $(elided-routines) acos asin cos sin hypot +sysdep_routines := $(sysdep_routines) sincos asincos exp__E log__L + +math-twiddled := t +endif + +endif + +ifeq (,$(filter-out $(sysdep_dir)/stub/ $(common-objpfx),\ + $(dir $(firstword $(wildcard $(+sysdep_dirs:%=%/bytesex.h)))))) + +$(common-objpfx)bytesex.h: $(common-objpfx)det_endian + $(dir $<)$(notdir $<) > $@-tmp + mv $@-tmp $@ + +$(common-objpfx)det_endian: $(sysdep_dir)/generic/det_endian.c + $(native-compile) + +before-compile := $(before-compile) $(common-objpfx)bytesex.h +common-generated := $(common-generated) bytesex.h det_endian + +endif + +ifeq ($(subdir),stdio) + +ifeq "$(filter $(objpfx)siglist.c,$(before-compile))" "" +before-compile := $(before-compile) $(objpfx)siglist.c +$(objpfx)siglist.c: $(objpfx)make_siglist + @rm -f $@ + $(dir $<)$(notdir $<) > $@-tmp + mv $@-tmp $@ + +$(objpfx)make_siglist: $(sysdep_dir)/generic/make_siglist.c + $(native-compile) + +generated := $(generated) make_siglist siglist.c +endif + +endif diff --git a/sysdeps/generic/_strerror.c b/sysdeps/generic/_strerror.c new file mode 100644 index 0000000000..455c8ff0a7 --- /dev/null +++ b/sysdeps/generic/_strerror.c @@ -0,0 +1,43 @@ +/* Copyright (C) 19911993 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., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#include +#include +#include + +#ifndef HAVE_GNU_LD +#define _sys_errlist sys_errlist +#define _sys_nerr sys_nerr +#endif + +/* Return a string describing the errno code in ERRNUM. */ +char * +DEFUN(_strerror_internal, (errnum, buf), int errnum AND char buf[1024]) +{ + if (errnum < 0 || errnum > _sys_nerr) + { + static char fmt[] = "Unknown error %d"; + size_t len = sprintf (buf, fmt, errnum); + if (len < sizeof(fmt) - 2) + return NULL; + buf[len - 1] = '\0'; + return buf; + } + + return (char *) _sys_errlist[errnum]; +} diff --git a/sysdeps/generic/abort.c b/sysdeps/generic/abort.c new file mode 100644 index 0000000000..1a27c4946b --- /dev/null +++ b/sysdeps/generic/abort.c @@ -0,0 +1,42 @@ +/* Copyright (C) 1991, 1993, 1995 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., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#include +#include +#include +#include +#include +#include + +/* Cause an abnormal program termination with core-dump. */ +void +DEFUN_VOID(abort) +{ + sigset_t sigs; + + if (__sigemptyset(&sigs) == 0 && + __sigaddset(&sigs, SIGABRT) == 0) + (void) __sigprocmask(SIG_UNBLOCK, &sigs, (sigset_t *) NULL); + + while (1) + if (raise (SIGABRT)) + /* If we can't signal ourselves, exit. */ + _exit (127); + /* If we signal ourselves and are still alive, + or can't exit, loop forever. */ +} diff --git a/sysdeps/generic/acos.c b/sysdeps/generic/acos.c new file mode 100644 index 0000000000..c77c9faf1f --- /dev/null +++ b/sysdeps/generic/acos.c @@ -0,0 +1,42 @@ +/* Copyright (C) 1991 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., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#include +#include +#include + +/* Return the inverse cosine of X. */ +double +DEFUN(acos, (x), double x) +{ + double t; + + if (__isnan(x)) + { + errno = EDOM; + return x; + } + + if (x == -1.0) + /* If X is -1, the general formula blows up (zero divided by zero loses), + but we know that acos(-1) = pi. */ + t = atan2(1.0, 0.0); + else + t = atan2(sqrt((1.0 - x) / (1.0 + x)), 1.0); + return t + t; +} diff --git a/sysdeps/generic/acosh.c b/sysdeps/generic/acosh.c new file mode 100644 index 0000000000..bc16cc7b46 --- /dev/null +++ b/sysdeps/generic/acosh.c @@ -0,0 +1,102 @@ +/* + * Copyright (c) 1985, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef lint +static char sccsid[] = "@(#)acosh.c 8.1 (Berkeley) 6/4/93"; +#endif /* not lint */ + +/* ACOSH(X) + * RETURN THE INVERSE HYPERBOLIC COSINE OF X + * DOUBLE PRECISION (VAX D FORMAT 56 BITS, IEEE DOUBLE 53 BITS) + * CODED IN C BY K.C. NG, 2/16/85; + * REVISED BY K.C. NG on 3/6/85, 3/24/85, 4/16/85, 8/17/85. + * + * Required system supported functions : + * sqrt(x) + * + * Required kernel function: + * log1p(x) ...return log(1+x) + * + * Method : + * Based on + * acosh(x) = log [ x + sqrt(x*x-1) ] + * we have + * acosh(x) := log1p(x)+ln2, if (x > 1.0E20); else + * acosh(x) := log1p( sqrt(x-1) * (sqrt(x-1) + sqrt(x+1)) ) . + * These formulae avoid the over/underflow complication. + * + * Special cases: + * acosh(x) is NaN with signal if x<1. + * acosh(NaN) is NaN without signal. + * + * Accuracy: + * acosh(x) returns the exact inverse hyperbolic cosine of x nearly + * rounded. In a test run with 512,000 random arguments on a VAX, the + * maximum observed error was 3.30 ulps (units of the last place) at + * x=1.0070493753568216 . + * + * Constants: + * The hexadecimal values are the intended ones for the following constants. + * The decimal values may be used, provided that the compiler will convert + * from decimal to binary accurately enough to produce the hexadecimal values + * shown. + */ + +#include "mathimpl.h" + +vc(ln2hi, 6.9314718055829871446E-1 ,7217,4031,0000,f7d0, 0, .B17217F7D00000) +vc(ln2lo, 1.6465949582897081279E-12 ,bcd5,2ce7,d9cc,e4f1, -39, .E7BCD5E4F1D9CC) + +ic(ln2hi, 6.9314718036912381649E-1, -1, 1.62E42FEE00000) +ic(ln2lo, 1.9082149292705877000E-10,-33, 1.A39EF35793C76) + +#ifdef vccast +#define ln2hi vccast(ln2hi) +#define ln2lo vccast(ln2lo) +#endif + +double acosh(x) +double x; +{ + double t,big=1.E20; /* big+1==big */ + +#if !defined(vax)&&!defined(tahoe) + if(x!=x) return(x); /* x is NaN */ +#endif /* !defined(vax)&&!defined(tahoe) */ + + /* return log1p(x) + log(2) if x is large */ + if(x>big) {t=log1p(x)+ln2lo; return(t+ln2hi);} + + t=sqrt(x-1.0); + return(log1p(t*(t+sqrt(x+1.0)))); +} diff --git a/sysdeps/generic/add_1.c b/sysdeps/generic/add_1.c new file mode 100644 index 0000000000..7b1c697a67 --- /dev/null +++ b/sysdeps/generic/add_1.c @@ -0,0 +1,61 @@ +/* mpn_add_1 -- + +Copyright (C) 1993, 1994 Free Software Foundation, Inc. + +This file is part of the GNU MP Library. + +The GNU MP 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 MP 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 MP Library; see the file COPYING.LIB. If not, write to +the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ + +#define __mpn_add_1 __noname +#include "gmp.h" +#undef __mpn_add_1 + +#include "gmp-impl.h" + +mp_limb +__mpn_add_1 (res_ptr, s1_ptr, s1_size, s2_limb) + register mp_ptr res_ptr; + register mp_srcptr s1_ptr; + register mp_size_t s1_size; + register mp_limb s2_limb; +{ + register mp_limb x; + + x = *s1_ptr++; + s2_limb = x + s2_limb; + *res_ptr++ = s2_limb; + if (s2_limb < x) + { + while (--s1_size != 0) + { + x = *s1_ptr++ + 1; + *res_ptr++ = x; + if (x != 0) + goto fin; + } + + return 1; + } + + fin: + if (res_ptr != s1_ptr) + { + mp_size_t i; + for (i = 0; i < s1_size - 1; i++) + res_ptr[i] = s1_ptr[i]; + } + + return 0; +} diff --git a/sysdeps/generic/add_n.c b/sysdeps/generic/add_n.c new file mode 100644 index 0000000000..6989ab0628 --- /dev/null +++ b/sysdeps/generic/add_n.c @@ -0,0 +1,61 @@ +/* __mpn_add_n -- Add two limb vectors of equal, non-zero length. + +Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc. + +This file is part of the GNU MP Library. + +The GNU MP 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 MP 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 MP Library; see the file COPYING.LIB. If not, write to +the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ + +#include "gmp.h" +#include "gmp-impl.h" + +mp_limb +#if __STDC__ +__mpn_add_n (mp_ptr res_ptr, mp_srcptr s1_ptr, mp_srcptr s2_ptr, mp_size_t size) +#else +__mpn_add_n (res_ptr, s1_ptr, s2_ptr, size) + register mp_ptr res_ptr; + register mp_srcptr s1_ptr; + register mp_srcptr s2_ptr; + mp_size_t size; +#endif +{ + register mp_limb x, y, cy; + register mp_size_t j; + + /* The loop counter and index J goes from -SIZE to -1. This way + the loop becomes faster. */ + j = -size; + + /* Offset the base pointers to compensate for the negative indices. */ + s1_ptr -= j; + s2_ptr -= j; + res_ptr -= j; + + cy = 0; + do + { + y = s2_ptr[j]; + x = s1_ptr[j]; + y += cy; /* add previous carry to one addend */ + cy = (y < cy); /* get out carry from that addition */ + y = x + y; /* add other addend */ + cy = (y < x) + cy; /* get out carry from that add, combine */ + res_ptr[j] = y; + } + while (++j != 0); + + return cy; +} diff --git a/sysdeps/generic/addmul_1.c b/sysdeps/generic/addmul_1.c new file mode 100644 index 0000000000..fdf3541561 --- /dev/null +++ b/sysdeps/generic/addmul_1.c @@ -0,0 +1,64 @@ +/* __mpn_addmul_1 -- multiply the S1_SIZE long limb vector pointed to by S1_PTR + by S2_LIMB, add the S1_SIZE least significant limbs of the product to the + limb vector pointed to by RES_PTR. Return the most significant limb of + the product, adjusted for carry-out from the addition. + +Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc. + +This file is part of the GNU MP Library. + +The GNU MP 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 MP 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 MP Library; see the file COPYING.LIB. If not, write to +the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ + +#include "gmp.h" +#include "gmp-impl.h" +#include "longlong.h" + +mp_limb +__mpn_addmul_1 (res_ptr, s1_ptr, s1_size, s2_limb) + register mp_ptr res_ptr; + register mp_srcptr s1_ptr; + mp_size_t s1_size; + register mp_limb s2_limb; +{ + register mp_limb cy_limb; + register mp_size_t j; + register mp_limb prod_high, prod_low; + register mp_limb x; + + /* The loop counter and index J goes from -SIZE to -1. This way + the loop becomes faster. */ + j = -s1_size; + + /* Offset the base pointers to compensate for the negative indices. */ + res_ptr -= j; + s1_ptr -= j; + + cy_limb = 0; + do + { + umul_ppmm (prod_high, prod_low, s1_ptr[j], s2_limb); + + prod_low += cy_limb; + cy_limb = (prod_low < cy_limb) + prod_high; + + x = res_ptr[j]; + prod_low = x + prod_low; + cy_limb += (prod_low < x); + res_ptr[j] = prod_low; + } + while (++j != 0); + + return cy_limb; +} diff --git a/sysdeps/generic/asin.c b/sysdeps/generic/asin.c new file mode 100644 index 0000000000..e75ee3d87e --- /dev/null +++ b/sysdeps/generic/asin.c @@ -0,0 +1,44 @@ +/* Copyright (C) 1991 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., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#include +#include +#include + +/* Return the inverse sine of X. */ +double +DEFUN(asin, (x), double x) +{ + double abs_x; + + if (__isnan(x)) + { + errno = EDOM; + return x; + } + + abs_x = fabs(x); + + if (abs_x <= 0.5) + return atan2(x, sqrt(1.0 - (x * x))); + else + { + double t = 1.0 - abs_x; + return atan2(x, sqrt((t + t) - (t * t))); + } +} diff --git a/sysdeps/generic/asincos.c b/sysdeps/generic/asincos.c new file mode 100644 index 0000000000..c746b1652a --- /dev/null +++ b/sysdeps/generic/asincos.c @@ -0,0 +1,169 @@ +/* + * Copyright (c) 1985, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef lint +static char sccsid[] = "@(#)asincos.c 8.1 (Berkeley) 6/4/93"; +#endif /* not lint */ + +/* ASIN(X) + * RETURNS ARC SINE OF X + * DOUBLE PRECISION (IEEE DOUBLE 53 bits, VAX D FORMAT 56 bits) + * CODED IN C BY K.C. NG, 4/16/85, REVISED ON 6/10/85. + * + * Required system supported functions: + * copysign(x,y) + * sqrt(x) + * + * Required kernel function: + * atan2(y,x) + * + * Method : + * asin(x) = atan2(x,sqrt(1-x*x)); for better accuracy, 1-x*x is + * computed as follows + * 1-x*x if x < 0.5, + * 2*(1-|x|)-(1-|x|)*(1-|x|) if x >= 0.5. + * + * Special cases: + * if x is NaN, return x itself; + * if |x|>1, return NaN. + * + * Accuracy: + * 1) If atan2() uses machine PI, then + * + * asin(x) returns (PI/pi) * (the exact arc sine of x) nearly rounded; + * and PI is the exact pi rounded to machine precision (see atan2 for + * details): + * + * in decimal: + * pi = 3.141592653589793 23846264338327 ..... + * 53 bits PI = 3.141592653589793 115997963 ..... , + * 56 bits PI = 3.141592653589793 227020265 ..... , + * + * in hexadecimal: + * pi = 3.243F6A8885A308D313198A2E.... + * 53 bits PI = 3.243F6A8885A30 = 2 * 1.921FB54442D18 error=.276ulps + * 56 bits PI = 3.243F6A8885A308 = 4 * .C90FDAA22168C2 error=.206ulps + * + * In a test run with more than 200,000 random arguments on a VAX, the + * maximum observed error in ulps (units in the last place) was + * 2.06 ulps. (comparing against (PI/pi)*(exact asin(x))); + * + * 2) If atan2() uses true pi, then + * + * asin(x) returns the exact asin(x) with error below about 2 ulps. + * + * In a test run with more than 1,024,000 random arguments on a VAX, the + * maximum observed error in ulps (units in the last place) was + * 1.99 ulps. + */ + +double asin(x) +double x; +{ + double s,t,copysign(),atan2(),sqrt(),one=1.0; +#if !defined(vax)&&!defined(tahoe) + if(x!=x) return(x); /* x is NaN */ +#endif /* !defined(vax)&&!defined(tahoe) */ + s=copysign(x,one); + if(s <= 0.5) + return(atan2(x,sqrt(one-x*x))); + else + { t=one-s; s=t+t; return(atan2(x,sqrt(s-t*t))); } + +} + +/* ACOS(X) + * RETURNS ARC COS OF X + * DOUBLE PRECISION (IEEE DOUBLE 53 bits, VAX D FORMAT 56 bits) + * CODED IN C BY K.C. NG, 4/16/85, REVISED ON 6/10/85. + * + * Required system supported functions: + * copysign(x,y) + * sqrt(x) + * + * Required kernel function: + * atan2(y,x) + * + * Method : + * ________ + * / 1 - x + * acos(x) = 2*atan2( / -------- , 1 ) . + * \/ 1 + x + * + * Special cases: + * if x is NaN, return x itself; + * if |x|>1, return NaN. + * + * Accuracy: + * 1) If atan2() uses machine PI, then + * + * acos(x) returns (PI/pi) * (the exact arc cosine of x) nearly rounded; + * and PI is the exact pi rounded to machine precision (see atan2 for + * details): + * + * in decimal: + * pi = 3.141592653589793 23846264338327 ..... + * 53 bits PI = 3.141592653589793 115997963 ..... , + * 56 bits PI = 3.141592653589793 227020265 ..... , + * + * in hexadecimal: + * pi = 3.243F6A8885A308D313198A2E.... + * 53 bits PI = 3.243F6A8885A30 = 2 * 1.921FB54442D18 error=.276ulps + * 56 bits PI = 3.243F6A8885A308 = 4 * .C90FDAA22168C2 error=.206ulps + * + * In a test run with more than 200,000 random arguments on a VAX, the + * maximum observed error in ulps (units in the last place) was + * 2.07 ulps. (comparing against (PI/pi)*(exact acos(x))); + * + * 2) If atan2() uses true pi, then + * + * acos(x) returns the exact acos(x) with error below about 2 ulps. + * + * In a test run with more than 1,024,000 random arguments on a VAX, the + * maximum observed error in ulps (units in the last place) was + * 2.15 ulps. + */ + +double acos(x) +double x; +{ + double t,copysign(),atan2(),sqrt(),one=1.0; +#if !defined(vax)&&!defined(tahoe) + if(x!=x) return(x); +#endif /* !defined(vax)&&!defined(tahoe) */ + if( x != -1.0) + t=atan2(sqrt((one-x)/(one+x)),one); + else + t=atan2(one,0.0); /* t = PI/2 */ + return(t+t); +} diff --git a/sysdeps/generic/asinh.c b/sysdeps/generic/asinh.c new file mode 100644 index 0000000000..5db8d2ddf7 --- /dev/null +++ b/sysdeps/generic/asinh.c @@ -0,0 +1,101 @@ +/* + * Copyright (c) 1985, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef lint +static char sccsid[] = "@(#)asinh.c 8.1 (Berkeley) 6/4/93"; +#endif /* not lint */ + +/* ASINH(X) + * RETURN THE INVERSE HYPERBOLIC SINE OF X + * DOUBLE PRECISION (VAX D format 56 bits, IEEE DOUBLE 53 BITS) + * CODED IN C BY K.C. NG, 2/16/85; + * REVISED BY K.C. NG on 3/7/85, 3/24/85, 4/16/85. + * + * Required system supported functions : + * copysign(x,y) + * sqrt(x) + * + * Required kernel function: + * log1p(x) ...return log(1+x) + * + * Method : + * Based on + * asinh(x) = sign(x) * log [ |x| + sqrt(x*x+1) ] + * we have + * asinh(x) := x if 1+x*x=1, + * := sign(x)*(log1p(x)+ln2)) if sqrt(1+x*x)=x, else + * := sign(x)*log1p(|x| + |x|/(1/|x| + sqrt(1+(1/|x|)^2)) ) + * + * Accuracy: + * asinh(x) returns the exact inverse hyperbolic sine of x nearly rounded. + * In a test run with 52,000 random arguments on a VAX, the maximum + * observed error was 1.58 ulps (units in the last place). + * + * Constants: + * The hexadecimal values are the intended ones for the following constants. + * The decimal values may be used, provided that the compiler will convert + * from decimal to binary accurately enough to produce the hexadecimal values + * shown. + */ +#include "mathimpl.h" + +vc(ln2hi, 6.9314718055829871446E-1 ,7217,4031,0000,f7d0, 0, .B17217F7D00000) +vc(ln2lo, 1.6465949582897081279E-12 ,bcd5,2ce7,d9cc,e4f1, -39, .E7BCD5E4F1D9CC) + +ic(ln2hi, 6.9314718036912381649E-1, -1, 1.62E42FEE00000) +ic(ln2lo, 1.9082149292705877000E-10, -33, 1.A39EF35793C76) + +#ifdef vccast +#define ln2hi vccast(ln2hi) +#define ln2lo vccast(ln2lo) +#endif + +double asinh(x) +double x; +{ + double t,s; + const static double small=1.0E-10, /* fl(1+small*small) == 1 */ + big =1.0E20, /* fl(1+big) == big */ + one =1.0 ; + +#if !defined(vax)&&!defined(tahoe) + if(x!=x) return(x); /* x is NaN */ +#endif /* !defined(vax)&&!defined(tahoe) */ + if((t=copysign(x,one))>small) + if(t big */ + {s=log1p(t)+ln2lo; return(copysign(s+ln2hi,x));} + else /* if |x| < small */ + return(x); +} diff --git a/sysdeps/generic/atan.c b/sysdeps/generic/atan.c new file mode 100644 index 0000000000..f2cc693924 --- /dev/null +++ b/sysdeps/generic/atan.c @@ -0,0 +1,27 @@ +/* Copyright (C) 1991, 1995 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., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#include +#include + +/* Return the inverse tangent of X. */ +double +DEFUN(atan, (x), register double x) +{ + return atan2(x, 1.0); +} diff --git a/sysdeps/generic/atan2.c b/sysdeps/generic/atan2.c new file mode 100644 index 0000000000..958a154726 --- /dev/null +++ b/sysdeps/generic/atan2.c @@ -0,0 +1,281 @@ +/* + * Copyright (c) 1985, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef lint +static char sccsid[] = "@(#)atan2.c 8.1 (Berkeley) 6/4/93"; +#endif /* not lint */ + +/* ATAN2(Y,X) + * RETURN ARG (X+iY) + * DOUBLE PRECISION (VAX D format 56 bits, IEEE DOUBLE 53 BITS) + * CODED IN C BY K.C. NG, 1/8/85; + * REVISED BY K.C. NG on 2/7/85, 2/13/85, 3/7/85, 3/30/85, 6/29/85. + * + * Required system supported functions : + * copysign(x,y) + * scalb(x,y) + * logb(x) + * + * Method : + * 1. Reduce y to positive by atan2(y,x)=-atan2(-y,x). + * 2. Reduce x to positive by (if x and y are unexceptional): + * ARG (x+iy) = arctan(y/x) ... if x > 0, + * ARG (x+iy) = pi - arctan[y/(-x)] ... if x < 0, + * 3. According to the integer k=4t+0.25 truncated , t=y/x, the argument + * is further reduced to one of the following intervals and the + * arctangent of y/x is evaluated by the corresponding formula: + * + * [0,7/16] atan(y/x) = t - t^3*(a1+t^2*(a2+...(a10+t^2*a11)...) + * [7/16,11/16] atan(y/x) = atan(1/2) + atan( (y-x/2)/(x+y/2) ) + * [11/16.19/16] atan(y/x) = atan( 1 ) + atan( (y-x)/(x+y) ) + * [19/16,39/16] atan(y/x) = atan(3/2) + atan( (y-1.5x)/(x+1.5y) ) + * [39/16,INF] atan(y/x) = atan(INF) + atan( -x/y ) + * + * Special cases: + * Notations: atan2(y,x) == ARG (x+iy) == ARG(x,y). + * + * ARG( NAN , (anything) ) is NaN; + * ARG( (anything), NaN ) is NaN; + * ARG(+(anything but NaN), +-0) is +-0 ; + * ARG(-(anything but NaN), +-0) is +-PI ; + * ARG( 0, +-(anything but 0 and NaN) ) is +-PI/2; + * ARG( +INF,+-(anything but INF and NaN) ) is +-0 ; + * ARG( -INF,+-(anything but INF and NaN) ) is +-PI; + * ARG( +INF,+-INF ) is +-PI/4 ; + * ARG( -INF,+-INF ) is +-3PI/4; + * ARG( (anything but,0,NaN, and INF),+-INF ) is +-PI/2; + * + * Accuracy: + * atan2(y,x) returns (PI/pi) * the exact ARG (x+iy) nearly rounded, + * where + * + * in decimal: + * pi = 3.141592653589793 23846264338327 ..... + * 53 bits PI = 3.141592653589793 115997963 ..... , + * 56 bits PI = 3.141592653589793 227020265 ..... , + * + * in hexadecimal: + * pi = 3.243F6A8885A308D313198A2E.... + * 53 bits PI = 3.243F6A8885A30 = 2 * 1.921FB54442D18 error=.276ulps + * 56 bits PI = 3.243F6A8885A308 = 4 * .C90FDAA22168C2 error=.206ulps + * + * In a test run with 356,000 random argument on [-1,1] * [-1,1] on a + * VAX, the maximum observed error was 1.41 ulps (units of the last place) + * compared with (PI/pi)*(the exact ARG(x+iy)). + * + * Note: + * We use machine PI (the true pi rounded) in place of the actual + * value of pi for all the trig and inverse trig functions. In general, + * if trig is one of sin, cos, tan, then computed trig(y) returns the + * exact trig(y*pi/PI) nearly rounded; correspondingly, computed arctrig + * returns the exact arctrig(y)*PI/pi nearly rounded. These guarantee the + * trig functions have period PI, and trig(arctrig(x)) returns x for + * all critical values x. + * + * Constants: + * The hexadecimal values are the intended ones for the following constants. + * The decimal values may be used, provided that the compiler will convert + * from decimal to binary accurately enough to produce the hexadecimal values + * shown. + */ + +#include "mathimpl.h" + +vc(athfhi, 4.6364760900080611433E-1 ,6338,3fed,da7b,2b0d, -1, .ED63382B0DDA7B) +vc(athflo, 1.9338828231967579916E-19 ,5005,2164,92c0,9cfe, -62, .E450059CFE92C0) +vc(PIo4, 7.8539816339744830676E-1 ,0fda,4049,68c2,a221, 0, .C90FDAA22168C2) +vc(at1fhi, 9.8279372324732906796E-1 ,985e,407b,b4d9,940f, 0, .FB985E940FB4D9) +vc(at1flo,-3.5540295636764633916E-18 ,1edc,a383,eaea,34d6, -57,-.831EDC34D6EAEA) +vc(PIo2, 1.5707963267948966135E0 ,0fda,40c9,68c2,a221, 1, .C90FDAA22168C2) +vc(PI, 3.1415926535897932270E0 ,0fda,4149,68c2,a221, 2, .C90FDAA22168C2) +vc(a1, 3.3333333333333473730E-1 ,aaaa,3faa,ab75,aaaa, -1, .AAAAAAAAAAAB75) +vc(a2, -2.0000000000017730678E-1 ,cccc,bf4c,946e,cccd, -2,-.CCCCCCCCCD946E) +vc(a3, 1.4285714286694640301E-1 ,4924,3f12,4262,9274, -2, .92492492744262) +vc(a4, -1.1111111135032672795E-1 ,8e38,bee3,6292,ebc6, -3,-.E38E38EBC66292) +vc(a5, 9.0909091380563043783E-2 ,2e8b,3eba,d70c,b31b, -3, .BA2E8BB31BD70C) +vc(a6, -7.6922954286089459397E-2 ,89c8,be9d,7f18,27c3, -3,-.9D89C827C37F18) +vc(a7, 6.6663180891693915586E-2 ,86b4,3e88,9e58,ae37, -3, .8886B4AE379E58) +vc(a8, -5.8772703698290408927E-2 ,bba5,be70,a942,8481, -4,-.F0BBA58481A942) +vc(a9, 5.2170707402812969804E-2 ,b0f3,3e55,13ab,a1ab, -4, .D5B0F3A1AB13AB) +vc(a10, -4.4895863157820361210E-2 ,e4b9,be37,048f,7fd1, -4,-.B7E4B97FD1048F) +vc(a11, 3.3006147437343875094E-2 ,3174,3e07,2d87,3cf7, -4, .8731743CF72D87) +vc(a12, -1.4614844866464185439E-2 ,731a,bd6f,76d9,2f34, -6,-.EF731A2F3476D9) + +ic(athfhi, 4.6364760900080609352E-1 , -2, 1.DAC670561BB4F) +ic(athflo, 4.6249969567426939759E-18 , -58, 1.5543B8F253271) +ic(PIo4, 7.8539816339744827900E-1 , -1, 1.921FB54442D18) +ic(at1fhi, 9.8279372324732905408E-1 , -1, 1.F730BD281F69B) +ic(at1flo,-2.4407677060164810007E-17 , -56, -1.C23DFEFEAE6B5) +ic(PIo2, 1.5707963267948965580E0 , 0, 1.921FB54442D18) +ic(PI, 3.1415926535897931160E0 , 1, 1.921FB54442D18) +ic(a1, 3.3333333333333942106E-1 , -2, 1.55555555555C3) +ic(a2, -1.9999999999979536924E-1 , -3, -1.9999999997CCD) +ic(a3, 1.4285714278004377209E-1 , -3, 1.24924921EC1D7) +ic(a4, -1.1111110579344973814E-1 , -4, -1.C71C7059AF280) +ic(a5, 9.0908906105474668324E-2 , -4, 1.745CE5AA35DB2) +ic(a6, -7.6919217767468239799E-2 , -4, -1.3B0FA54BEC400) +ic(a7, 6.6614695906082474486E-2 , -4, 1.10DA924597FFF) +ic(a8, -5.8358371008508623523E-2 , -5, -1.DE125FDDBD793) +ic(a9, 4.9850617156082015213E-2 , -5, 1.9860524BDD807) +ic(a10, -3.6700606902093604877E-2 , -5, -1.2CA6C04C6937A) +ic(a11, 1.6438029044759730479E-2 , -6, 1.0D52174A1BB54) + +#ifdef vccast +#define athfhi vccast(athfhi) +#define athflo vccast(athflo) +#define PIo4 vccast(PIo4) +#define at1fhi vccast(at1fhi) +#define at1flo vccast(at1flo) +#define PIo2 vccast(PIo2) +#define PI vccast(PI) +#define a1 vccast(a1) +#define a2 vccast(a2) +#define a3 vccast(a3) +#define a4 vccast(a4) +#define a5 vccast(a5) +#define a6 vccast(a6) +#define a7 vccast(a7) +#define a8 vccast(a8) +#define a9 vccast(a9) +#define a10 vccast(a10) +#define a11 vccast(a11) +#define a12 vccast(a12) +#endif + +double atan2(y,x) +double y,x; +{ + static const double zero=0, one=1, small=1.0E-9, big=1.0E18; + double t,z,signy,signx,hi,lo; + int k,m; + +#if !defined(vax)&&!defined(tahoe) + /* if x or y is NAN */ + if(x!=x) return(x); if(y!=y) return(y); +#endif /* !defined(vax)&&!defined(tahoe) */ + + /* copy down the sign of y and x */ + signy = copysign(one,y) ; + signx = copysign(one,x) ; + + /* if x is 1.0, goto begin */ + if(x==1) { y=copysign(y,one); t=y; if(finite(t)) goto begin;} + + /* when y = 0 */ + if(y==zero) return((signx==one)?y:copysign(PI,signy)); + + /* when x = 0 */ + if(x==zero) return(copysign(PIo2,signy)); + + /* when x is INF */ + if(!finite(x)) + if(!finite(y)) + return(copysign((signx==one)?PIo4:3*PIo4,signy)); + else + return(copysign((signx==one)?zero:PI,signy)); + + /* when y is INF */ + if(!finite(y)) return(copysign(PIo2,signy)); + + /* compute y/x */ + x=copysign(x,one); + y=copysign(y,one); + if((m=(k=logb(y))-logb(x)) > 60) t=big+big; + else if(m < -80 ) t=y/x; + else { t = y/x ; y = scalb(y,-k); x=scalb(x,-k); } + + /* begin argument reduction */ +begin: + if (t < 2.4375) { + + /* truncate 4(t+1/16) to integer for branching */ + k = 4 * (t+0.0625); + switch (k) { + + /* t is in [0,7/16] */ + case 0: + case 1: + if (t < small) + { big + small ; /* raise inexact flag */ + return (copysign((signx>zero)?t:PI-t,signy)); } + + hi = zero; lo = zero; break; + + /* t is in [7/16,11/16] */ + case 2: + hi = athfhi; lo = athflo; + z = x+x; + t = ( (y+y) - x ) / ( z + y ); break; + + /* t is in [11/16,19/16] */ + case 3: + case 4: + hi = PIo4; lo = zero; + t = ( y - x ) / ( x + y ); break; + + /* t is in [19/16,39/16] */ + default: + hi = at1fhi; lo = at1flo; + z = y-x; y=y+y+y; t = x+x; + t = ( (z+z)-x ) / ( t + y ); break; + } + } + /* end of if (t < 2.4375) */ + + else + { + hi = PIo2; lo = zero; + + /* t is in [2.4375, big] */ + if (t <= big) t = - x / y; + + /* t is in [big, INF] */ + else + { big+small; /* raise inexact flag */ + t = zero; } + } + /* end of argument reduction */ + + /* compute atan(t) for t in [-.4375, .4375] */ + z = t*t; +#if defined(vax)||defined(tahoe) + z = t*(z*(a1+z*(a2+z*(a3+z*(a4+z*(a5+z*(a6+z*(a7+z*(a8+ + z*(a9+z*(a10+z*(a11+z*a12)))))))))))); +#else /* defined(vax)||defined(tahoe) */ + z = t*(z*(a1+z*(a2+z*(a3+z*(a4+z*(a5+z*(a6+z*(a7+z*(a8+ + z*(a9+z*(a10+z*a11))))))))))); +#endif /* defined(vax)||defined(tahoe) */ + z = lo - z; z += t; z += hi; + + return(copysign((signx>zero)?z:PI-z,signy)); +} diff --git a/sysdeps/generic/atanh.c b/sysdeps/generic/atanh.c new file mode 100644 index 0000000000..89cb61cca2 --- /dev/null +++ b/sysdeps/generic/atanh.c @@ -0,0 +1,83 @@ +/* + * Copyright (c) 1985, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef lint +static char sccsid[] = "@(#)atanh.c 8.1 (Berkeley) 6/4/93"; +#endif /* not lint */ + +/* ATANH(X) + * RETURN THE HYPERBOLIC ARC TANGENT OF X + * DOUBLE PRECISION (VAX D format 56 bits, IEEE DOUBLE 53 BITS) + * CODED IN C BY K.C. NG, 1/8/85; + * REVISED BY K.C. NG on 2/7/85, 3/7/85, 8/18/85. + * + * Required kernel function: + * log1p(x) ...return log(1+x) + * + * Method : + * Return + * 1 2x x + * atanh(x) = --- * log(1 + -------) = 0.5 * log1p(2 * --------) + * 2 1 - x 1 - x + * + * Special cases: + * atanh(x) is NaN if |x| > 1 with signal; + * atanh(NaN) is that NaN with no signal; + * atanh(+-1) is +-INF with signal. + * + * Accuracy: + * atanh(x) returns the exact hyperbolic arc tangent of x nearly rounded. + * In a test run with 512,000 random arguments on a VAX, the maximum + * observed error was 1.87 ulps (units in the last place) at + * x= -3.8962076028810414000e-03. + */ +#include "mathimpl.h" + +#if defined(vax)||defined(tahoe) +#include +#endif /* defined(vax)||defined(tahoe) */ + +double atanh(x) +double x; +{ + double z; + z = copysign(0.5,x); + x = copysign(x,1.0); +#if defined(vax)||defined(tahoe) + if (x == 1.0) { + return(copysign(1.0,z)*infnan(ERANGE)); /* sign(x)*INF */ + } +#endif /* defined(vax)||defined(tahoe) */ + x = x/(1.0-x); + return( z*log1p(x+x) ); +} diff --git a/sysdeps/generic/bcopy.c b/sysdeps/generic/bcopy.c new file mode 100644 index 0000000000..51de492877 --- /dev/null +++ b/sysdeps/generic/bcopy.c @@ -0,0 +1,31 @@ +/* Copyright (C) 1991, 1992 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., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#include +#include + + +#define memmove bcopy +#define rettype void +#define RETURN(s) return +#define a1 src +#define a1const CONST +#define a2 dest +#define a2const + +#include diff --git a/sysdeps/generic/bzero.c b/sysdeps/generic/bzero.c new file mode 100644 index 0000000000..7ebdcfe7e3 --- /dev/null +++ b/sysdeps/generic/bzero.c @@ -0,0 +1,81 @@ +/* Copyright (C) 1991 Free Software Foundation, Inc. + Contributed by Torbjorn Granlund (tege@sics.se). + +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., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#include +#include +#include + +/* Set N bytes of S to 0. */ +void +DEFUN(bzero, (s, n), PTR s AND size_t len) +{ + long int dstp = (long int) s; + CONST op_t zero = 0; + + if (len >= 8) + { + size_t xlen; + + /* There are at least some bytes to zero. No need to test + for LEN == 0 in this alignment loop. */ + while (dstp % OPSIZ != 0) + { + ((byte *) dstp)[0] = 0; + dstp += 1; + len -= 1; + } + + /* Write 8 op_t per iteration until less than 8 op_t remain. */ + xlen = len / (OPSIZ * 8); + while (xlen != 0) + { + ((op_t *) dstp)[0] = zero; + ((op_t *) dstp)[1] = zero; + ((op_t *) dstp)[2] = zero; + ((op_t *) dstp)[3] = zero; + ((op_t *) dstp)[4] = zero; + ((op_t *) dstp)[5] = zero; + ((op_t *) dstp)[6] = zero; + ((op_t *) dstp)[7] = zero; + dstp += 8 * OPSIZ; + xlen -= 1; + } + len %= OPSIZ * 8; + + /* Write 1 op_t per iteration until less than op_t remain. */ + xlen = len / OPSIZ; + while (xlen != 0) + { + ((op_t *) dstp)[0] = zero; + dstp += OPSIZ; + xlen -= 1; + } + len %= OPSIZ; + } + + /* Write the last few bytes. */ + while (len != 0) + { + ((byte *) dstp)[0] = 0; + dstp += 1; + len -= 1; + } +} + diff --git a/sysdeps/generic/cabs.c b/sysdeps/generic/cabs.c new file mode 100644 index 0000000000..6f4e1cd211 --- /dev/null +++ b/sysdeps/generic/cabs.c @@ -0,0 +1,26 @@ +/* Copyright (C) 1992, 1993 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., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#include +#include + +double +DEFUN(cabs, (z), struct __cabs_complex z) +{ + return hypot (z.__x, z.__y); +} diff --git a/sysdeps/generic/ceil.c b/sysdeps/generic/ceil.c new file mode 100644 index 0000000000..6b7fad3ca8 --- /dev/null +++ b/sysdeps/generic/ceil.c @@ -0,0 +1,68 @@ +/* snarfed from BSD common_source/floor.c: + * Copyright (c) 1985 Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef lint +static char sccsid[] = "@(#)floor.c 5.7 (Berkeley) 10/9/90"; +#endif /* not lint */ + +#include "mathimpl.h" + +vc(L, 4503599627370496.0E0 ,0000,5c00,0000,0000, 55, 1.0) /* 2**55 */ + +ic(L, 4503599627370496.0E0, 52, 1.0) /* 2**52 */ + +#ifdef vccast +#define L vccast(L) +#endif + +double +ceil(x) +double x; +{ + double y; + + if ( +#if !defined(vax)&&!defined(tahoe) + x != x || /* NaN */ +#endif /* !defined(vax)&&!defined(tahoe) */ + x >= L) /* already an even integer */ + return x; + else if (x < (double)0) + return -floor(-x); + else { /* now 0 <= x < L */ + y = L+x; /* destructive store must be forced */ + y -= L; /* an integer, and |x-y| < 1 */ + return x > y ? y+(double)1 : y; + } +} + diff --git a/sysdeps/generic/cmp.c b/sysdeps/generic/cmp.c new file mode 100644 index 0000000000..144c88588f --- /dev/null +++ b/sysdeps/generic/cmp.c @@ -0,0 +1,55 @@ +/* __mpn_cmp -- Compare two low-level natural-number integers. + +Copyright (C) 1991, 1993, 1994 Free Software Foundation, Inc. + +This file is part of the GNU MP Library. + +The GNU MP 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 MP 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 MP Library; see the file COPYING.LIB. If not, write to +the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ + +#include "gmp.h" +#include "gmp-impl.h" + +/* Compare OP1_PTR/OP1_SIZE with OP2_PTR/OP2_SIZE. + T