From mboxrd@z Thu Jan 1 00:00:00 1970 From: Segin Subject: math library now available! Date: Mon, 10 Apr 2006 00:09:16 -0400 Message-ID: <4439DA6C.2030303@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------000408050706010400070100" Return-path: Sender: linux-8086-owner@vger.kernel.org List-Id: To: Linux-8086@Vger.Kernel.Org This is a multi-part message in MIME format. --------------000408050706010400070100 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Hi! I have come to present to you all a math library for use with ELKS. It is for the most part a port of the Minix 2 libm. All code is under the BSD license except frexp.c and modf.c, hich are under the CDDL (cause they come from opensolaris -- hell, they built without modification straight from CVS!) You'll need to rewrite or leave out modf.c and frexp.c if you want to use this library with GPL'd programs, because you cannot legally link together GPL and CDDL code. A third option is to just contact Sun and ask them to allow us to use these source files under the GPL -- due to the actual size of the code (less than 50 lines), the request is reasonable, and Sun might just grant it. Of course you can still link it, and just not tell anyone of your unholy creation :) Attached is a shar archive of the source code, uncleaned (there's a libm.a file there that's ready for use for i86, you'll need to edit the Makefile for a native 386 version for bcc -3) -- Segin --------------000408050706010400070100 Content-Type: application/x-shar; name="elkslibm.shar" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="elkslibm.shar" #!/bin/sh # This is a shell archive (produced by GNU sharutils 4.2.1). # To extract the files from this archive, save it to some FILE, remove # everything before the `!/bin/sh' line above, then type `sh FILE'. # # Made on 2006-04-10 00:06 EDT by . # Source directory was `/home/segin'. # # Existing files will *not* be overwritten unless `-c' is specified. # # This shar contains: # length mode name # ------ ---------- ------------------------------------------ # 1572 -rw-r--r-- elkslibm/Makefile # 1374 -rw-r--r-- elkslibm/exp.c # 1342 -rw-r--r-- elkslibm/log.c # 1088 -rw-r--r-- elkslibm/pow.c # 1794 -rw-r--r-- elkslibm/sin.c # 1609 -rw-r--r-- elkslibm/tan.c # 1016 -rw-r--r-- elkslibm/ldexp.c # 536 -rw-r--r-- elkslibm/log10.c # 1999 -rw-r--r-- elkslibm/ansi.h # 1423 -rw-r--r-- elkslibm/asin.c # 1474 -rw-r--r-- elkslibm/atan.c # 1168 -rw-r--r-- elkslibm/float.h # 437 -rw-r--r-- elkslibm/floor.c # 435 -rw-r--r-- elkslibm/ceil.c # 305 -rw-r--r-- elkslibm/fabs.c # 548 -rw-r--r-- elkslibm/fmod.c # 1376 -rw-r--r-- elkslibm/frexp.c # 1999 -rw-r--r-- elkslibm/localmath.h # 14368 -rw-r--r-- elkslibm/libm.a # 1392 -rw-r--r-- elkslibm/math.h # 1775 -rw-r--r-- elkslibm/modf.c # 1562 -rw-r--r-- elkslibm/sinh.c # 1142 -rw-r--r-- elkslibm/tanh.c # 830 -rw-r--r-- elkslibm/sqrt.c # 351 -rw-r--r-- elkslibm/hugeval.c # 848 -rw-r--r-- elkslibm/atan2.c # 201 -rw-r--r-- elkslibm/isnan.c # save_IFS="${IFS}" IFS="${IFS}:" gettext_dir=FAILED locale_dir=FAILED first_param="$1" for dir in $PATH do if test "$gettext_dir" = FAILED && test -f $dir/gettext \ && ($dir/gettext --version >/dev/null 2>&1) then set `$dir/gettext --version 2>&1` if test "$3" = GNU then gettext_dir=$dir fi fi if test "$locale_dir" = FAILED && test -f $dir/shar \ && ($dir/shar --print-text-domain-dir >/dev/null 2>&1) then locale_dir=`$dir/shar --print-text-domain-dir` fi done IFS="$save_IFS" if test "$locale_dir" = FAILED || test "$gettext_dir" = FAILED then echo=echo else TEXTDOMAINDIR=$locale_dir export TEXTDOMAINDIR TEXTDOMAIN=sharutils export TEXTDOMAIN echo="$gettext_dir/gettext -s" fi if touch -am -t 200112312359.59 $$.touch >/dev/null 2>&1 && test ! -f 200112312359.59 -a -f $$.touch; then shar_touch='touch -am -t $1$2$3$4$5$6.$7 "$8"' elif touch -am 123123592001.59 $$.touch >/dev/null 2>&1 && test ! -f 123123592001.59 -a ! -f 123123592001.5 -a -f $$.touch; then shar_touch='touch -am $3$4$5$6$1$2.$7 "$8"' elif touch -am 1231235901 $$.touch >/dev/null 2>&1 && test ! -f 1231235901 -a -f $$.touch; then shar_touch='touch -am $3$4$5$6$2 "$8"' else shar_touch=: echo $echo 'WARNING: not restoring timestamps. Consider getting and' $echo "installing GNU \`touch', distributed in GNU File Utilities..." echo fi rm -f 200112312359.59 123123592001.59 123123592001.5 1231235901 $$.touch # if mkdir _sh16061; then $echo 'x -' 'creating lock directory' else $echo 'failed to create lock directory' exit 1 fi # ============= elkslibm/Makefile ============== if test ! -d 'elkslibm'; then $echo 'x -' 'creating directory' 'elkslibm' mkdir 'elkslibm' fi if test -f 'elkslibm/Makefile' && test "$first_param" != -c; then $echo 'x -' SKIPPING 'elkslibm/Makefile' '(file already exists)' else $echo 'x -' extracting 'elkslibm/Makefile' '(text)' sed 's/^X//' << 'SHAR_EOF' > 'elkslibm/Makefile' && # Makefile for lib/math. X CC = bcc -ansi CFLAGS = -O -D_POSIX_SOURCE -I. CC1 = $(CC) $(CFLAGS) -c X LIBRARY = libm.a all: $(LIBRARY) X OBJECTS = \ X $(LIBRARY)(asin.o) \ X $(LIBRARY)(atan.o) \ X $(LIBRARY)(atan2.o) \ X $(LIBRARY)(ceil.o) \ X $(LIBRARY)(exp.o) \ X $(LIBRARY)(fabs.o) \ X $(LIBRARY)(floor.o) \ X $(LIBRARY)(fmod.o) \ X $(LIBRARY)(frexp.o) \ X $(LIBRARY)(hugeval.o) \ X $(LIBRARY)(isnan.o) \ X $(LIBRARY)(ldexp.o) \ X $(LIBRARY)(log.o) \ X $(LIBRARY)(log10.o) \ X $(LIBRARY)(modf.o) \ X $(LIBRARY)(pow.o) \ X $(LIBRARY)(sin.o) \ X $(LIBRARY)(sinh.o) \ X $(LIBRARY)(sqrt.o) \ X $(LIBRARY)(tan.o) \ X $(LIBRARY)(tanh.o) \ X $(LIBRARY): $(OBJECTS) X ar cr $@ *.o X rm *.o X $(LIBRARY)(asin.o): asin.c X $(CC1) asin.c X $(LIBRARY)(atan.o): atan.c X $(CC1) atan.c X $(LIBRARY)(atan2.o): atan2.c X $(CC1) atan2.c X $(LIBRARY)(ceil.o): ceil.c X $(CC1) ceil.c X $(LIBRARY)(exp.o): exp.c X $(CC1) exp.c X $(LIBRARY)(fabs.o): fabs.c X $(CC1) fabs.c X $(LIBRARY)(floor.o): floor.c X $(CC1) floor.c X $(LIBRARY)(fmod.o): fmod.c X $(CC1) fmod.c X $(LIBRARY)(frexp.o): frexp.c X $(CC1) frexp.c X $(LIBRARY)(hugeval.o): hugeval.c X $(CC1) hugeval.c X $(LIBRARY)(isnan.o): isnan.c X $(CC1) isnan.c X $(LIBRARY)(ldexp.o): ldexp.c X $(CC1) ldexp.c X $(LIBRARY)(log.o): log.c X $(CC1) log.c X $(LIBRARY)(log10.o): log10.c X $(CC1) log10.c X $(LIBRARY)(modf.o): modf.c X $(CC1) modf.c X $(LIBRARY)(pow.o): pow.c X $(CC1) pow.c X $(LIBRARY)(sin.o): sin.c X $(CC1) sin.c X $(LIBRARY)(sinh.o): sinh.c X $(CC1) sinh.c X $(LIBRARY)(sqrt.o): sqrt.c X $(CC1) sqrt.c X $(LIBRARY)(tan.o): tan.c X $(CC1) tan.c X $(LIBRARY)(tanh.o): tanh.c X $(CC1) tanh.c SHAR_EOF (set 20 06 04 09 23 53 37 'elkslibm/Makefile'; eval "$shar_touch") && chmod 0644 'elkslibm/Makefile' || $echo 'restore of' 'elkslibm/Makefile' 'failed' if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \ && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then md5sum -c << SHAR_EOF >/dev/null 2>&1 \ || $echo 'elkslibm/Makefile:' 'MD5 check failed' a9dfff31e4320ec54da9ce73d474e8f3 elkslibm/Makefile SHAR_EOF else shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'elkslibm/Makefile'`" test 1572 -eq "$shar_count" || $echo 'elkslibm/Makefile:' 'original size' '1572,' 'current size' "$shar_count!" fi fi # ============= elkslibm/exp.c ============== if test -f 'elkslibm/exp.c' && test "$first_param" != -c; then $echo 'x -' SKIPPING 'elkslibm/exp.c' '(file already exists)' else $echo 'x -' extracting 'elkslibm/exp.c' '(text)' sed 's/^X//' << 'SHAR_EOF' > 'elkslibm/exp.c' && /* X * (c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands. X * See the copyright notice in the ACK home directory, in the file "Copyright". X * X * Author: Ceriel J.H. Jacobs X */ /* $Header: exp.c,v 1.5 91/03/19 16:38:29 ceriel Exp $ */ X #include #include #include #include "localmath.h" X X double exp(double x) { X /* Algorithm and coefficients from: X "Software manual for the elementary functions" X by W.J. Cody and W. Waite, Prentice-Hall, 1980 X */ X X static double p[] = { X 0.25000000000000000000e+0, X 0.75753180159422776666e-2, X 0.31555192765684646356e-4 X }; X X static double q[] = { X 0.50000000000000000000e+0, X 0.56817302698551221787e-1, X 0.63121894374398503557e-3, X 0.75104028399870046114e-6 X }; X double xn, g; X int n; X int negative = x < 0; X X if (__IsNan(x)) { X errno = EDOM; X return x; X } X if (x < M_LN_MIN_D) { X errno = ERANGE; X return 0.0; X } X if (x > M_LN_MAX_D) { X errno = ERANGE; X return HUGE_VAL; X } X X if (negative) x = -x; X X /* ??? avoid underflow ??? */ X X n = x * M_LOG2E + 0.5; /* 1/ln(2) = log2(e), 0.5 added for rounding */ X xn = n; X { X double x1 = (long) x; X double x2 = x - x1; X X g = ((x1-xn*0.693359375)+x2) - xn*(-2.1219444005469058277e-4); X } X if (negative) { X g = -g; X n = -n; X } X xn = g * g; X x = g * POLYNOM2(xn, p); X n += 1; X return (ldexp(0.5 + x/(POLYNOM3(xn, q) - x), n)); } SHAR_EOF (set 20 06 04 09 23 44 14 'elkslibm/exp.c'; eval "$shar_touch") && chmod 0644 'elkslibm/exp.c' || $echo 'restore of' 'elkslibm/exp.c' 'failed' if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \ && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then md5sum -c << SHAR_EOF >/dev/null 2>&1 \ || $echo 'elkslibm/exp.c:' 'MD5 check failed' ff40a660f9e2ee77f8d52317ac2044e3 elkslibm/exp.c SHAR_EOF else shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'elkslibm/exp.c'`" test 1374 -eq "$shar_count" || $echo 'elkslibm/exp.c:' 'original size' '1374,' 'current size' "$shar_count!" fi fi # ============= elkslibm/log.c ============== if test -f 'elkslibm/log.c' && test "$first_param" != -c; then $echo 'x -' SKIPPING 'elkslibm/log.c' '(file already exists)' else $echo 'x -' extracting 'elkslibm/log.c' '(text)' sed 's/^X//' << 'SHAR_EOF' > 'elkslibm/log.c' && /* X * (c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands. X * See the copyright notice in the ACK home directory, in the file "Copyright". X * X * Author: Ceriel J.H. Jacobs X */ /* $Header: log.c,v 1.3 91/03/19 16:38:45 ceriel Exp $ */ X #include #include #include #include "localmath.h" X double log(double x) { X /* Algorithm and coefficients from: X "Software manual for the elementary functions" X by W.J. Cody and W. Waite, Prentice-Hall, 1980 X */ X static double a[] = { X -0.64124943423745581147e2, X 0.16383943563021534222e2, X -0.78956112887491257267e0 X }; X static double b[] = { X -0.76949932108494879777e3, X 0.31203222091924532844e3, X -0.35667977739034646171e2, X 1.0 X }; X X double znum, zden, z, w; X int exponent; X X if (__IsNan(x)) { X errno = EDOM; X return x; X } X if (x < 0) { X errno = EDOM; X return -HUGE_VAL; X } X else if (x == 0) { X errno = ERANGE; X return -HUGE_VAL; X } X X if (x <= DBL_MAX) { X } X else return x; /* for infinity and Nan */ X x = frexp(x, &exponent); X if (x > M_1_SQRT2) { X znum = (x - 0.5) - 0.5; X zden = x * 0.5 + 0.5; X } X else { X znum = x - 0.5; X zden = znum * 0.5 + 0.5; X exponent--; X } X z = znum/zden; w = z * z; X x = z + z * w * (POLYNOM2(w,a)/POLYNOM3(w,b)); X z = exponent; X x += z * (-2.121944400546905827679e-4); X return x + z * 0.693359375; } SHAR_EOF (set 20 06 04 09 23 44 14 'elkslibm/log.c'; eval "$shar_touch") && chmod 0644 'elkslibm/log.c' || $echo 'restore of' 'elkslibm/log.c' 'failed' if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \ && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then md5sum -c << SHAR_EOF >/dev/null 2>&1 \ || $echo 'elkslibm/log.c:' 'MD5 check failed' 7d3ad6094822df1a9b95c695e65fc7f4 elkslibm/log.c SHAR_EOF else shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'elkslibm/log.c'`" test 1342 -eq "$shar_count" || $echo 'elkslibm/log.c:' 'original size' '1342,' 'current size' "$shar_count!" fi fi # ============= elkslibm/pow.c ============== if test -f 'elkslibm/pow.c' && test "$first_param" != -c; then $echo 'x -' SKIPPING 'elkslibm/pow.c' '(file already exists)' else $echo 'x -' extracting 'elkslibm/pow.c' '(text)' sed 's/^X//' << 'SHAR_EOF' > 'elkslibm/pow.c' && /* X * (c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands. X * See the copyright notice in the ACK home directory, in the file "Copyright". X * X * Author: Ceriel J.H. Jacobs X */ /* $Header: pow.c,v 1.3 90/08/28 13:59:36 eck Exp $ */ X #include #include #include #include "localmath.h" X double pow(double x, double y) { X /* Simple version for now. The Cody and Waite book has X a very complicated, much more precise version, but X this version has machine-dependent arrays A1 and A2, X and I don't know yet how to solve this ??? X */ X double dummy; X int result_neg = 0; X X if ((x == 0 && y == 0) || X (x < 0 && modf(y, &dummy) != 0)) { X errno = EDOM; X return 0; X } X X if (x == 0) return x; X X if (x < 0) { X if (modf(y/2.0, &dummy) != 0) { X /* y was odd */ X result_neg = 1; X } X x = -x; X } X x = log(x); X X if (x < 0) { X x = -x; X y = -y; X } X /* Beware of overflow in the multiplication */ X if (x > 1.0 && y > DBL_MAX/x) { X errno = ERANGE; X return result_neg ? -HUGE_VAL : HUGE_VAL; X } X X x = exp(x * y); X return result_neg ? -x : x; } SHAR_EOF (set 20 06 04 09 23 44 14 'elkslibm/pow.c'; eval "$shar_touch") && chmod 0644 'elkslibm/pow.c' || $echo 'restore of' 'elkslibm/pow.c' 'failed' if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \ && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then md5sum -c << SHAR_EOF >/dev/null 2>&1 \ || $echo 'elkslibm/pow.c:' 'MD5 check failed' 0bff858b689ace98c1f68f9b4cab6b18 elkslibm/pow.c SHAR_EOF else shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'elkslibm/pow.c'`" test 1088 -eq "$shar_count" || $echo 'elkslibm/pow.c:' 'original size' '1088,' 'current size' "$shar_count!" fi fi # ============= elkslibm/sin.c ============== if test -f 'elkslibm/sin.c' && test "$first_param" != -c; then $echo 'x -' SKIPPING 'elkslibm/sin.c' '(file already exists)' else $echo 'x -' extracting 'elkslibm/sin.c' '(text)' sed 's/^X//' << 'SHAR_EOF' > 'elkslibm/sin.c' && /* X * (c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands. X * See the copyright notice in the ACK home directory, in the file "Copyright". X * X * Author: Ceriel J.H. Jacobs X */ /* $Header: sin.c,v 1.3 91/03/19 16:39:04 ceriel Exp $ */ X #include #include #include #include "localmath.h" X static double sinus(double x, int cos_flag) { X /* Algorithm and coefficients from: X "Software manual for the elementary functions" X by W.J. Cody and W. Waite, Prentice-Hall, 1980 X */ X X static double r[] = { X -0.16666666666666665052e+0, X 0.83333333333331650314e-2, X -0.19841269841201840457e-3, X 0.27557319210152756119e-5, X -0.25052106798274584544e-7, X 0.16058936490371589114e-9, X -0.76429178068910467734e-12, X 0.27204790957888846175e-14 X }; X X double y; X int neg = 1; X X if (__IsNan(x)) { X errno = EDOM; X return x; X } X if (x < 0) { X x = -x; X neg = -1; X } X if (cos_flag) { X neg = 1; X y = M_PI_2 + x; X } X else y = x; X X /* ??? avoid loss of significance, if y is too large, error ??? */ X X y = y * M_1_PI + 0.5; X X if (y >= DBL_MAX/M_PI) return 0.0; X X /* Use extended precision to calculate reduced argument. X Here we used 12 bits of the mantissa for a1. X Also split x in integer part x1 and fraction part x2. X */ #define A1 3.1416015625 #define A2 -8.908910206761537356617e-6 X { X double x1, x2; X X modf(y, &y); X if (modf(0.5*y, &x1)) neg = -neg; X if (cos_flag) y -= 0.5; X x2 = modf(x, &x1); X x = x1 - y * A1; X x += x2; X x -= y * A2; #undef A1 #undef A2 X } X X if (x < 0) { X neg = -neg; X x = -x; X } X X /* ??? avoid underflow ??? */ X X y = x * x; X x += x * y * POLYNOM7(y, r); X return neg==-1 ? -x : x; } X double sin(double x) { X return sinus(x, 0); } X double cos(double x) { X if (x < 0) x = -x; X return sinus(x, 1); } SHAR_EOF (set 20 06 04 09 23 44 14 'elkslibm/sin.c'; eval "$shar_touch") && chmod 0644 'elkslibm/sin.c' || $echo 'restore of' 'elkslibm/sin.c' 'failed' if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \ && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then md5sum -c << SHAR_EOF >/dev/null 2>&1 \ || $echo 'elkslibm/sin.c:' 'MD5 check failed' 1c9e76d1944136ff60fad540bdba7cc5 elkslibm/sin.c SHAR_EOF else shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'elkslibm/sin.c'`" test 1794 -eq "$shar_count" || $echo 'elkslibm/sin.c:' 'original size' '1794,' 'current size' "$shar_count!" fi fi # ============= elkslibm/tan.c ============== if test -f 'elkslibm/tan.c' && test "$first_param" != -c; then $echo 'x -' SKIPPING 'elkslibm/tan.c' '(file already exists)' else $echo 'x -' extracting 'elkslibm/tan.c' '(text)' sed 's/^X//' << 'SHAR_EOF' > 'elkslibm/tan.c' && /* X * (c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands. X * See the copyright notice in the ACK home directory, in the file "Copyright". X * X * Author: Ceriel J.H. Jacobs X */ /* $Header: tan.c,v 1.3 91/03/19 16:39:30 ceriel Exp $ */ X #include #include #include #include "localmath.h" X double tan(double x) { X /* Algorithm and coefficients from: X "Software manual for the elementary functions" X by W.J. Cody and W. Waite, Prentice-Hall, 1980 X */ X X int negative = x < 0; X int invert = 0; X double y; X static double p[] = { X 1.0, X -0.13338350006421960681e+0, X 0.34248878235890589960e-2, X -0.17861707342254426711e-4 X }; X static double q[] = { X 1.0, X -0.46671683339755294240e+0, X 0.25663832289440112864e-1, X -0.31181531907010027307e-3, X 0.49819433993786512270e-6 X }; X X if (__IsNan(x)) { X errno = EDOM; X return x; X } X if (negative) x = -x; X X /* ??? avoid loss of significance, error if x is too large ??? */ X X y = x * M_2_PI + 0.5; X X if (y >= DBL_MAX/M_PI_2) return 0.0; X X /* Use extended precision to calculate reduced argument. X Here we used 12 bits of the mantissa for a1. X Also split x in integer part x1 and fraction part x2. X */ X #define A1 1.57080078125 X #define A2 -4.454455103380768678308e-6 X { X double x1, x2; X X modf(y, &y); X if (modf(0.5*y, &x1)) invert = 1; X x2 = modf(x, &x1); X x = x1 - y * A1; X x += x2; X x -= y * A2; X #undef A1 X #undef A2 X } X X /* ??? avoid underflow ??? */ X y = x * x; X x += x * y * POLYNOM2(y, p+1); X y = POLYNOM4(y, q); X if (negative) x = -x; X return invert ? -y/x : x/y; } SHAR_EOF (set 20 06 04 09 23 44 14 'elkslibm/tan.c'; eval "$shar_touch") && chmod 0644 'elkslibm/tan.c' || $echo 'restore of' 'elkslibm/tan.c' 'failed' if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \ && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then md5sum -c << SHAR_EOF >/dev/null 2>&1 \ || $echo 'elkslibm/tan.c:' 'MD5 check failed' f19bf93ff65ca4f5ef34dda69f292bf2 elkslibm/tan.c SHAR_EOF else shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'elkslibm/tan.c'`" test 1609 -eq "$shar_count" || $echo 'elkslibm/tan.c:' 'original size' '1609,' 'current size' "$shar_count!" fi fi # ============= elkslibm/ldexp.c ============== if test -f 'elkslibm/ldexp.c' && test "$first_param" != -c; then $echo 'x -' SKIPPING 'elkslibm/ldexp.c' '(file already exists)' else $echo 'x -' extracting 'elkslibm/ldexp.c' '(text)' sed 's/^X//' << 'SHAR_EOF' > 'elkslibm/ldexp.c' && /* X * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands. X * See the copyright notice in the ACK home directory, in the file "Copyright". X */ /* $Header: ldexp.c,v 1.5 91/03/19 16:38:37 ceriel Exp $ */ X #include #include #include X double ldexp(double fl, int exp) { X int sign = 1; X int currexp; X X if (__IsNan(fl)) { X errno = EDOM; X return fl; X } X if (fl == 0.0) return 0.0; X if (fl<0) { X fl = -fl; X sign = -1; X } X if (fl > DBL_MAX) { /* for infinity */ X errno = ERANGE; X return sign * fl; X } X fl = frexp(fl,&currexp); X exp += currexp; X if (exp > 0) { X if (exp > DBL_MAX_EXP) { X errno = ERANGE; X return sign * HUGE_VAL; X } X while (exp>30) { X fl *= (double) (1L << 30); X exp -= 30; X } X fl *= (double) (1L << exp); X } X else { X /* number need not be normalized */ X if (exp < DBL_MIN_EXP - DBL_MANT_DIG) { X return 0.0; X } X while (exp<-30) { X fl /= (double) (1L << 30); X exp += 30; X } X fl /= (double) (1L << -exp); X } X return sign * fl; } SHAR_EOF (set 20 06 04 09 23 44 14 'elkslibm/ldexp.c'; eval "$shar_touch") && chmod 0644 'elkslibm/ldexp.c' || $echo 'restore of' 'elkslibm/ldexp.c' 'failed' if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \ && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then md5sum -c << SHAR_EOF >/dev/null 2>&1 \ || $echo 'elkslibm/ldexp.c:' 'MD5 check failed' c2ade50424c4e426511d2b305d634054 elkslibm/ldexp.c SHAR_EOF else shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'elkslibm/ldexp.c'`" test 1016 -eq "$shar_count" || $echo 'elkslibm/ldexp.c:' 'original size' '1016,' 'current size' "$shar_count!" fi fi # ============= elkslibm/log10.c ============== if test -f 'elkslibm/log10.c' && test "$first_param" != -c; then $echo 'x -' SKIPPING 'elkslibm/log10.c' '(file already exists)' else $echo 'x -' extracting 'elkslibm/log10.c' '(text)' sed 's/^X//' << 'SHAR_EOF' > 'elkslibm/log10.c' && /* X * (c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands. X * See the copyright notice in the ACK home directory, in the file "Copyright". X * X * Author: Ceriel J.H. Jacobs X */ /* $Header: log10.c,v 1.3 91/03/19 16:38:55 ceriel Exp $ */ X #include #include #include "localmath.h" X double log10(double x) { X if (__IsNan(x)) { X errno = EDOM; X return x; X } X if (x < 0) { X errno = EDOM; X return -HUGE_VAL; X } X else if (x == 0) { X errno = ERANGE; X return -HUGE_VAL; X } X X return log(x) / M_LN10; } SHAR_EOF (set 20 06 04 09 23 44 14 'elkslibm/log10.c'; eval "$shar_touch") && chmod 0644 'elkslibm/log10.c' || $echo 'restore of' 'elkslibm/log10.c' 'failed' if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \ && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then md5sum -c << SHAR_EOF >/dev/null 2>&1 \ || $echo 'elkslibm/log10.c:' 'MD5 check failed' 7dc6c11c12cda91d87353cafa037a8e9 elkslibm/log10.c SHAR_EOF else shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'elkslibm/log10.c'`" test 536 -eq "$shar_count" || $echo 'elkslibm/log10.c:' 'original size' '536,' 'current size' "$shar_count!" fi fi # ============= elkslibm/ansi.h ============== if test -f 'elkslibm/ansi.h' && test "$first_param" != -c; then $echo 'x -' SKIPPING 'elkslibm/ansi.h' '(file already exists)' else $echo 'x -' extracting 'elkslibm/ansi.h' '(text)' sed 's/^X//' << 'SHAR_EOF' > 'elkslibm/ansi.h' && /* The header attempts to decide whether the compiler has enough X * conformance to Standard C for Minix to take advantage of. If so, the X * symbol _ANSI is defined (as 31415). Otherwise _ANSI is not defined X * here, but it may be defined by applications that want to bend the rules. X * The magic number in the definition is to inhibit unnecessary bending X * of the rules. (For consistency with the new '#ifdef _ANSI" tests in X * the headers, _ANSI should really be defined as nothing, but that would X * break many library routines that use "#if _ANSI".) X X * If _ANSI ends up being defined, a macro X * X * _PROTOTYPE(function, params) X * X * is defined. This macro expands in different ways, generating either X * ANSI Standard C prototypes or old-style K&R (Kernighan & Ritchie) X * prototypes, as needed. Finally, some programs use _CONST, _VOIDSTAR etc X * in such a way that they are portable over both ANSI and K&R compilers. X * The appropriate macros are defined here. X */ X #ifndef _ANSI_H #define _ANSI_H X #if __STDC__ == 1 #define _ANSI 31459 /* compiler claims full ANSI conformance */ #endif X #ifdef __GNUC__ #define _ANSI 31459 /* gcc conforms enough even in non-ANSI mode */ #endif X #ifdef _ANSI X /* Keep everything for ANSI prototypes. */ #define _PROTOTYPE(function, params) function params #define _ARGS(params) params X #define _VOIDSTAR void * #define _VOID void #define _CONST const #define _VOLATILE volatile #define _SIZET size_t X #else X /* Throw away the parameters for K&R prototypes. */ #define _PROTOTYPE(function, params) function() #define _ARGS(params) () X #define _VOIDSTAR void * #define _VOID void #define _CONST #define _VOLATILE #define _SIZET int X #endif /* _ANSI */ X /* Setting any of _MINIX, _POSIX_C_SOURCE or _POSIX2_SOURCE implies X * _POSIX_SOURCE. (Seems wrong to put this here in ANSI space.) X */ #if defined(_MINIX) || _POSIX_C_SOURCE > 0 || defined(_POSIX2_SOURCE) #undef _POSIX_SOURCE #define _POSIX_SOURCE 1 #endif X #endif /* ANSI_H */ SHAR_EOF (set 20 06 04 09 23 53 54 'elkslibm/ansi.h'; eval "$shar_touch") && chmod 0644 'elkslibm/ansi.h' || $echo 'restore of' 'elkslibm/ansi.h' 'failed' if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \ && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then md5sum -c << SHAR_EOF >/dev/null 2>&1 \ || $echo 'elkslibm/ansi.h:' 'MD5 check failed' 248e5cbf8e919e0e337deb9074f5e2e6 elkslibm/ansi.h SHAR_EOF else shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'elkslibm/ansi.h'`" test 1999 -eq "$shar_count" || $echo 'elkslibm/ansi.h:' 'original size' '1999,' 'current size' "$shar_count!" fi fi # ============= elkslibm/asin.c ============== if test -f 'elkslibm/asin.c' && test "$first_param" != -c; then $echo 'x -' SKIPPING 'elkslibm/asin.c' '(file already exists)' else $echo 'x -' extracting 'elkslibm/asin.c' '(text)' sed 's/^X//' << 'SHAR_EOF' > 'elkslibm/asin.c' && /* X * (c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands. X * See the copyright notice in the ACK home directory, in the file "Copyright". X * X * Author: Ceriel J.H. Jacobs X */ /* $Header: asin.c,v 1.3 91/03/19 16:38:12 ceriel Exp $ */ X #include #include #include "localmath.h" X static double asin_acos(double x, int cosfl) { X int negative = x < 0; X int i; X double g; X static double p[] = { X -0.27368494524164255994e+2, X 0.57208227877891731407e+2, X -0.39688862997540877339e+2, X 0.10152522233806463645e+2, X -0.69674573447350646411e+0 X }; X static double q[] = { X -0.16421096714498560795e+3, X 0.41714430248260412556e+3, X -0.38186303361750149284e+3, X 0.15095270841030604719e+3, X -0.23823859153670238830e+2, X 1.0 X }; X X if (__IsNan(x)) { X errno = EDOM; X return x; X } X X if (negative) { X x = -x; X } X if (x > 0.5) { X i = 1; X if (x > 1) { X errno = EDOM; X return 0; X } X g = 0.5 - 0.5 * x; X x = - sqrt(g); X x += x; X } X else { X /* ??? avoid underflow ??? */ X i = 0; X g = x * x; X } X x += x * g * POLYNOM4(g, p) / POLYNOM5(g, q); X if (cosfl) { X if (! negative) x = -x; X } X if ((cosfl == 0) == (i == 1)) { X x = (x + M_PI_4) + M_PI_4; X } X else if (cosfl && negative && i == 1) { X x = (x + M_PI_2) + M_PI_2; X } X if (! cosfl && negative) x = -x; X return x; } X double asin(double x) { X return asin_acos(x, 0); } X double acos(double x) { X return asin_acos(x, 1); } SHAR_EOF (set 20 06 04 09 23 44 14 'elkslibm/asin.c'; eval "$shar_touch") && chmod 0644 'elkslibm/asin.c' || $echo 'restore of' 'elkslibm/asin.c' 'failed' if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \ && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then md5sum -c << SHAR_EOF >/dev/null 2>&1 \ || $echo 'elkslibm/asin.c:' 'MD5 check failed' 680f475aac35eea8124b64f3de4c36f9 elkslibm/asin.c SHAR_EOF else shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'elkslibm/asin.c'`" test 1423 -eq "$shar_count" || $echo 'elkslibm/asin.c:' 'original size' '1423,' 'current size' "$shar_count!" fi fi # ============= elkslibm/atan.c ============== if test -f 'elkslibm/atan.c' && test "$first_param" != -c; then $echo 'x -' SKIPPING 'elkslibm/atan.c' '(file already exists)' else $echo 'x -' extracting 'elkslibm/atan.c' '(text)' sed 's/^X//' << 'SHAR_EOF' > 'elkslibm/atan.c' && /* X * (c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands. X * See the copyright notice in the ACK home directory, in the file "Copyright". X * X * Author: Ceriel J.H. Jacobs X */ /* $Header: atan.c,v 1.3 91/03/19 16:38:21 ceriel Exp $ */ X #include #include /* #include */ #include "localmath.h" X int errno; #define EDOM 153 X double atan(double x) { X /* Algorithm and coefficients from: X "Software manual for the elementary functions" X by W.J. Cody and W. Waite, Prentice-Hall, 1980 X */ X X static double p[] = { X -0.13688768894191926929e+2, X -0.20505855195861651981e+2, X -0.84946240351320683534e+1, X -0.83758299368150059274e+0 X }; X static double q[] = { X 0.41066306682575781263e+2, X 0.86157349597130242515e+2, X 0.59578436142597344465e+2, X 0.15024001160028576121e+2, X 1.0 X }; X static double a[] = { X 0.0, X 0.52359877559829887307710723554658381, /* pi/6 */ X M_PI_2, X 1.04719755119659774615421446109316763 /* pi/3 */ X }; X X int neg = x < 0; X int n; X double g; X X if (__IsNan(x)) { X errno = EDOM; X return x; X } X if (neg) { X x = -x; X } X if (x > 1.0) { X x = 1.0/x; X n = 2; X } X else n = 0; X X if (x > 0.26794919243112270647) { /* 2-sqtr(3) */ X n = n + 1; X x = (((0.73205080756887729353*x-0.5)-0.5)+x)/ X (1.73205080756887729353+x); X } X X /* ??? avoid underflow ??? */ X X g = x * x; X x += x * g * POLYNOM3(g, p) / POLYNOM4(g, q); X if (n > 1) x = -x; X x += a[n]; X return neg ? -x : x; } SHAR_EOF (set 20 06 04 09 23 55 58 'elkslibm/atan.c'; eval "$shar_touch") && chmod 0644 'elkslibm/atan.c' || $echo 'restore of' 'elkslibm/atan.c' 'failed' if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \ && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then md5sum -c << SHAR_EOF >/dev/null 2>&1 \ || $echo 'elkslibm/atan.c:' 'MD5 check failed' 19d3dbff4937355025495b89db8d598a elkslibm/atan.c SHAR_EOF else shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'elkslibm/atan.c'`" test 1474 -eq "$shar_count" || $echo 'elkslibm/atan.c:' 'original size' '1474,' 'current size' "$shar_count!" fi fi # ============= elkslibm/float.h ============== if test -f 'elkslibm/float.h' && test "$first_param" != -c; then $echo 'x -' SKIPPING 'elkslibm/float.h' '(file already exists)' else $echo 'x -' extracting 'elkslibm/float.h' '(text)' sed 's/^X//' << 'SHAR_EOF' > 'elkslibm/float.h' && /* The header defines some implementation limits for (IEEE) floating X * point. Application programs can use it to find out how big and small X * floating-point numbers can be, what epsilon to use for iteration, etc. X */ X #ifndef _FLOAT_H #define _FLOAT_H X #define FLT_DIG 6 #define FLT_EPSILON 1.19209290e-07F #define FLT_MANT_DIG 24 #define FLT_MAX 3.40282347e+38F #define FLT_MAX_10_EXP 38 #define FLT_MAX_EXP 128 #define FLT_MIN 1.17549435e-38F #define FLT_MIN_10_EXP -37 #define FLT_MIN_EXP -125 X #define DBL_DIG 15 #define DBL_EPSILON 2.2204460492503131e-16 #define DBL_MANT_DIG 53 #define DBL_MAX 1.7976931348623157e+308 #define DBL_MAX_10_EXP 308 #define DBL_MAX_EXP 1024 #define DBL_MIN 2.2250738585072014e-308 #define DBL_MIN_10_EXP -307 #define DBL_MIN_EXP -1021 X #define LDBL_DIG 15 #define LDBL_EPSILON 2.2204460492503131e-16L #define LDBL_MANT_DIG 53 #define LDBL_MAX 1.7976931348623157e+308L #define LDBL_MAX_10_EXP 308 #define LDBL_MAX_EXP 1024 #define LDBL_MIN 2.2250738585072014e-308L #define LDBL_MIN_10_EXP -307 #define LDBL_MIN_EXP -1021 X #define FLT_ROUNDS 1 #define FLT_RADIX 2 X #endif /* _FLOAT_H */ SHAR_EOF (set 20 06 04 09 23 54 56 'elkslibm/float.h'; eval "$shar_touch") && chmod 0644 'elkslibm/float.h' || $echo 'restore of' 'elkslibm/float.h' 'failed' if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \ && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then md5sum -c << SHAR_EOF >/dev/null 2>&1 \ || $echo 'elkslibm/float.h:' 'MD5 check failed' 25cb44858d3f2624052f468a532d2d69 elkslibm/float.h SHAR_EOF else shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'elkslibm/float.h'`" test 1168 -eq "$shar_count" || $echo 'elkslibm/float.h:' 'original size' '1168,' 'current size' "$shar_count!" fi fi # ============= elkslibm/floor.c ============== if test -f 'elkslibm/floor.c' && test "$first_param" != -c; then $echo 'x -' SKIPPING 'elkslibm/floor.c' '(file already exists)' else $echo 'x -' extracting 'elkslibm/floor.c' '(text)' sed 's/^X//' << 'SHAR_EOF' > 'elkslibm/floor.c' && /* X * (c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands. X * See the copyright notice in the ACK home directory, in the file "Copyright". X * X * Author: Ceriel J.H. Jacobs X */ /* $Header: floor.c,v 1.1 89/05/10 16:01:29 eck Exp $ */ X #include X double floor(double x) { X double val; X X return modf(x, &val) < 0 ? val - 1.0 : val ; X /* this also works if modf always returns a positive X fractional part X */ } SHAR_EOF (set 20 06 04 09 23 44 14 'elkslibm/floor.c'; eval "$shar_touch") && chmod 0644 'elkslibm/floor.c' || $echo 'restore of' 'elkslibm/floor.c' 'failed' if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \ && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then md5sum -c << SHAR_EOF >/dev/null 2>&1 \ || $echo 'elkslibm/floor.c:' 'MD5 check failed' 79c57c336f2290285225913f64d28baa elkslibm/floor.c SHAR_EOF else shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'elkslibm/floor.c'`" test 437 -eq "$shar_count" || $echo 'elkslibm/floor.c:' 'original size' '437,' 'current size' "$shar_count!" fi fi # ============= elkslibm/ceil.c ============== if test -f 'elkslibm/ceil.c' && test "$first_param" != -c; then $echo 'x -' SKIPPING 'elkslibm/ceil.c' '(file already exists)' else $echo 'x -' extracting 'elkslibm/ceil.c' '(text)' sed 's/^X//' << 'SHAR_EOF' > 'elkslibm/ceil.c' && /* X * (c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands. X * See the copyright notice in the ACK home directory, in the file "Copyright". X * X * Author: Ceriel J.H. Jacobs X */ /* $Header: ceil.c,v 1.1 89/05/10 16:00:46 eck Exp $ */ X #include X double ceil(double x) { X double val; X X return modf(x, &val) > 0 ? val + 1.0 : val ; X /* this also works if modf always returns a positive X fractional part X */ } SHAR_EOF (set 20 06 04 09 23 44 14 'elkslibm/ceil.c'; eval "$shar_touch") && chmod 0644 'elkslibm/ceil.c' || $echo 'restore of' 'elkslibm/ceil.c' 'failed' if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \ && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then md5sum -c << SHAR_EOF >/dev/null 2>&1 \ || $echo 'elkslibm/ceil.c:' 'MD5 check failed' 764f4f6fbb6e18f58af4c0b186fb4304 elkslibm/ceil.c SHAR_EOF else shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'elkslibm/ceil.c'`" test 435 -eq "$shar_count" || $echo 'elkslibm/ceil.c:' 'original size' '435,' 'current size' "$shar_count!" fi fi # ============= elkslibm/fabs.c ============== if test -f 'elkslibm/fabs.c' && test "$first_param" != -c; then $echo 'x -' SKIPPING 'elkslibm/fabs.c' '(file already exists)' else $echo 'x -' extracting 'elkslibm/fabs.c' '(text)' sed 's/^X//' << 'SHAR_EOF' > 'elkslibm/fabs.c' && /* X * (c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands. X * See the copyright notice in the ACK home directory, in the file "Copyright". X * X * Author: Ceriel J.H. Jacobs X */ /* $Header: fabs.c,v 1.1 89/05/10 16:01:17 eck Exp $ */ X double fabs(double x) { X return x < 0 ? -x : x; } SHAR_EOF (set 20 06 04 09 23 44 14 'elkslibm/fabs.c'; eval "$shar_touch") && chmod 0644 'elkslibm/fabs.c' || $echo 'restore of' 'elkslibm/fabs.c' 'failed' if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \ && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then md5sum -c << SHAR_EOF >/dev/null 2>&1 \ || $echo 'elkslibm/fabs.c:' 'MD5 check failed' 0d412fcebd6f795859f7943d4ab7cd54 elkslibm/fabs.c SHAR_EOF else shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'elkslibm/fabs.c'`" test 305 -eq "$shar_count" || $echo 'elkslibm/fabs.c:' 'original size' '305,' 'current size' "$shar_count!" fi fi # ============= elkslibm/fmod.c ============== if test -f 'elkslibm/fmod.c' && test "$first_param" != -c; then $echo 'x -' SKIPPING 'elkslibm/fmod.c' '(file already exists)' else $echo 'x -' extracting 'elkslibm/fmod.c' '(text)' sed 's/^X//' << 'SHAR_EOF' > 'elkslibm/fmod.c' && /* X * (c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands. X * See the copyright notice in the ACK home directory, in the file "Copyright". X * X * Author: Hans van Eck X */ /* $Header: fmod.c,v 1.1 89/12/18 15:41:53 eck Exp $ */ X #include #include X double fmod(double x, double y) { X long i; X double val; X double frac; X X if (y == 0) { X errno = EDOM; X return 0; X } X frac = modf( x / y, &val); X X return frac * y; X /* X val = x / y; X if (val > LONG_MIN && val < LONG_MAX) { X i = val; X return x - i * y; X } */ } SHAR_EOF (set 20 06 04 09 23 44 14 'elkslibm/fmod.c'; eval "$shar_touch") && chmod 0644 'elkslibm/fmod.c' || $echo 'restore of' 'elkslibm/fmod.c' 'failed' if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \ && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then md5sum -c << SHAR_EOF >/dev/null 2>&1 \ || $echo 'elkslibm/fmod.c:' 'MD5 check failed' 0147ae91c28449bcaf4709a59db4d64c elkslibm/fmod.c SHAR_EOF else shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'elkslibm/fmod.c'`" test 548 -eq "$shar_count" || $echo 'elkslibm/fmod.c:' 'original size' '548,' 'current size' "$shar_count!" fi fi # ============= elkslibm/frexp.c ============== if test -f 'elkslibm/frexp.c' && test "$first_param" != -c; then $echo 'x -' SKIPPING 'elkslibm/frexp.c' '(file already exists)' else $echo 'x -' extracting 'elkslibm/frexp.c' '(text)' sed 's/^X//' << 'SHAR_EOF' > 'elkslibm/frexp.c' && /* X * CDDL HEADER START X * X * The contents of this file are subject to the terms of the X * Common Development and Distribution License, Version 1.0 only X * (the "License"). You may not use this file except in compliance X * with the License. X * X * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE X * or http://www.opensolaris.org/os/licensing. X * See the License for the specific language governing permissions X * and limitations under the License. X * X * When distributing Covered Code, include this CDDL HEADER in each X * file and include the License file at usr/src/OPENSOLARIS.LICENSE. X * If applicable, add the following below this CDDL HEADER, with the X * fields enclosed by brackets "[]" replaced with your own identifying X * information: Portions Copyright [yyyy] [name of copyright owner] X * X * CDDL HEADER END X */ #pragma ident "@(#)frexp.c 1.3 05/06/08 SMI" /* from UCB 5.2 3/9/86 */ X /* X * the call X * x = frexp(arg,&exp); X * must return a double fp quantity x which is <1.0 X * and the corresponding binary exponent "exp". X * such that X * arg = x*2^exp X */ double frexp(x, i) X double x; X int *i; { X int neg, j; X X j = 0; X neg = 0; X if (x<0) { X x = -x; X neg = 1; X } X if (x>=1.0) X while (x>=1.0) { X j = j+1; X x = x/2; X } X else if (x < 0.5 && x != 0.0) X while(x<0.5) { X j = j-1; X x = 2*x; X } X *i = j; X if(neg) X x = -x; X return (x); } SHAR_EOF (set 20 06 04 09 23 49 21 'elkslibm/frexp.c'; eval "$shar_touch") && chmod 0644 'elkslibm/frexp.c' || $echo 'restore of' 'elkslibm/frexp.c' 'failed' if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \ && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then md5sum -c << SHAR_EOF >/dev/null 2>&1 \ || $echo 'elkslibm/frexp.c:' 'MD5 check failed' 24b07eb798fda9a530b36c0025257a3e elkslibm/frexp.c SHAR_EOF else shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'elkslibm/frexp.c'`" test 1376 -eq "$shar_count" || $echo 'elkslibm/frexp.c:' 'original size' '1376,' 'current size' "$shar_count!" fi fi # ============= elkslibm/localmath.h ============== if test -f 'elkslibm/localmath.h' && test "$first_param" != -c; then $echo 'x -' SKIPPING 'elkslibm/localmath.h' '(file already exists)' else $echo 'x -' extracting 'elkslibm/localmath.h' '(text)' sed 's/^X//' << 'SHAR_EOF' > 'elkslibm/localmath.h' && /* X * localmath.h - This header is used by the mathematical library. X */ /* $Header: localmath.h,v 1.2 89/12/18 15:43:05 eck Exp $ */ X /* some constants (Hart & Cheney) */ #define M_PI 3.14159265358979323846264338327950288 #define M_2PI 6.28318530717958647692528676655900576 #define M_3PI_4 2.35619449019234492884698253745962716 #define M_PI_2 1.57079632679489661923132169163975144 #define M_3PI_8 1.17809724509617246442349126872981358 #define M_PI_4 0.78539816339744830961566084581987572 #define M_PI_8 0.39269908169872415480783042290993786 #define M_1_PI 0.31830988618379067153776752674502872 #define M_2_PI 0.63661977236758134307553505349005744 #define M_4_PI 1.27323954473516268615107010698011488 #define M_E 2.71828182845904523536028747135266250 #define M_LOG2E 1.44269504088896340735992468100189213 #define M_LOG10E 0.43429448190325182765112891891660508 #define M_LN2 0.69314718055994530941723212145817657 #define M_LN10 2.30258509299404568401799145468436421 #define M_SQRT2 1.41421356237309504880168872420969808 #define M_1_SQRT2 0.70710678118654752440084436210484904 #define M_EULER 0.57721566490153286060651209008240243 X /* macros for constructing polynomials */ #define POLYNOM1(x, a) ((a)[1]*(x)+(a)[0]) #define POLYNOM2(x, a) (POLYNOM1((x),(a)+1)*(x)+(a)[0]) #define POLYNOM3(x, a) (POLYNOM2((x),(a)+1)*(x)+(a)[0]) #define POLYNOM4(x, a) (POLYNOM3((x),(a)+1)*(x)+(a)[0]) #define POLYNOM5(x, a) (POLYNOM4((x),(a)+1)*(x)+(a)[0]) #define POLYNOM6(x, a) (POLYNOM5((x),(a)+1)*(x)+(a)[0]) #define POLYNOM7(x, a) (POLYNOM6((x),(a)+1)*(x)+(a)[0]) #define POLYNOM8(x, a) (POLYNOM7((x),(a)+1)*(x)+(a)[0]) #define POLYNOM9(x, a) (POLYNOM8((x),(a)+1)*(x)+(a)[0]) #define POLYNOM10(x, a) (POLYNOM9((x),(a)+1)*(x)+(a)[0]) #define POLYNOM11(x, a) (POLYNOM10((x),(a)+1)*(x)+(a)[0]) #define POLYNOM12(x, a) (POLYNOM11((x),(a)+1)*(x)+(a)[0]) #define POLYNOM13(x, a) (POLYNOM12((x),(a)+1)*(x)+(a)[0]) X #define M_LN_MAX_D (M_LN2 * DBL_MAX_EXP) #define M_LN_MIN_D (M_LN2 * (DBL_MIN_EXP - 1)) SHAR_EOF (set 20 06 04 09 23 44 14 'elkslibm/localmath.h'; eval "$shar_touch") && chmod 0644 'elkslibm/localmath.h' || $echo 'restore of' 'elkslibm/localmath.h' 'failed' if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \ && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then md5sum -c << SHAR_EOF >/dev/null 2>&1 \ || $echo 'elkslibm/localmath.h:' 'MD5 check failed' 7b7500fc97ebb0df6b001259e72236d0 elkslibm/localmath.h SHAR_EOF else shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'elkslibm/localmath.h'`" test 1999 -eq "$shar_count" || $echo 'elkslibm/localmath.h:' 'original size' '1999,' 'current size' "$shar_count!" fi fi # ============= elkslibm/libm.a ============== if test -f 'elkslibm/libm.a' && test "$first_param" != -c; then $echo 'x -' SKIPPING 'elkslibm/libm.a' '(file already exists)' else $echo 'x -' extracting 'elkslibm/libm.a' '(binary)' sed 's/^X//' << 'SHAR_EOF' | uudecode && begin 600 elkslibm/libm.a M(3QA`$\`(P`0`"P`$``U`("`F@([`$\`0@!/`$@` M3P!.`("`L@)4`$\`6@!/`%\`3P!E`$\`;`!/`'4`3P!Z`$\`@0!/`(8`3P!A M!.@"X`U!Z.`(37T$L`'K`C#` M,.2)1OHC:&(*.JA57CO`BM0*-J>:3$!J[J:I+-A#P"!.C@#4'HX`Y)@\0(A!.C@!E&XX#]0,C@"%M_`^F.`,=&^`$`N/`_4#'`4#'`4#'`4(U>!.C@#4'HX`A$ M?A7'!L`08B$`,<`QVS'),=*#Q`Q>7UW#N.`_4#'`4#'`4#'`4(U>!.C@!TZX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*-SNOR`C8).63E<\Z+)`\_`!38MSH4#Z]^OAJ2]<0``` M`````/`_(%=5B>575DQ,,L" M,,`PY(E&^HU>!.C@"4'HX`I)@\0(A!.C@`E?I_0"XX3]0N.J34+BM>E"X M"P-0C5X$Z.`)0>C@!$9^88U>!.C@"42-7@3HX`9!Z.`.58/$"+CP/U`QP%`Q MP%`QP%!245-0Z.`'3KCP/U`QP%`QP%`QP%#HX`%.N.`_4#'`4#'`4#'`4.C@ M#42-7@3HX`)$C5X$Z.`)1(U>!.C@!D2-7@3HX`)*Z8$`@\3XC5X$Z.`)1(U> M!.C@`T2-7O+HX`)!NX,P`$'HX`E$C5[RZ.`#0;N#*`!!Z.`&1(U>\NC@`T&[ M@R``0>C@!D2-7O+HX`-!NX,8`$'HX`9!NX,0`$'HX`E$C5[RZ.`#0;N#"`!! MZ.`&1(U>\NC@`T&[@P``0>C@!D2-7@3HX`E$C5[RZ.`#0>C@"T'HX`%$C5X$ MZ.`)0>C@!T2-7@3HX`).@\0(BT;ZA!.C@"$I86UE:ZPJ-7@3HX`E* -6%M96D1$7E]=PR,`"@). ` end SHAR_EOF (set 20 06 04 09 23 56 04 'elkslibm/libm.a'; eval "$shar_touch") && chmod 0644 'elkslibm/libm.a' || $echo 'restore of' 'elkslibm/libm.a' 'failed' if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \ && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then md5sum -c << SHAR_EOF >/dev/null 2>&1 \ || $echo 'elkslibm/libm.a:' 'MD5 check failed' f2a96ec2ac02aee65d24bd5f18d02638 elkslibm/libm.a SHAR_EOF else shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'elkslibm/libm.a'`" test 14368 -eq "$shar_count" || $echo 'elkslibm/libm.a:' 'original size' '14368,' 'current size' "$shar_count!" fi fi # ============= elkslibm/math.h ============== if test -f 'elkslibm/math.h' && test "$first_param" != -c; then $echo 'x -' SKIPPING 'elkslibm/math.h' '(file already exists)' else $echo 'x -' extracting 'elkslibm/math.h' '(text)' sed 's/^X//' << 'SHAR_EOF' > 'elkslibm/math.h' && /* The header contains prototypes for mathematical functions. */ X #ifndef _MATH_H #define _MATH_H X #ifndef _ANSI_H #include #endif X #define HUGE_VAL (__huge_val()) /* may be infinity */ X /* Function Prototypes. */ _PROTOTYPE( double __huge_val, (void) ); _PROTOTYPE( int __IsNan, (double _x) ); X _PROTOTYPE( double acos, (double _x) ); _PROTOTYPE( double asin, (double _x) ); _PROTOTYPE( double atan, (double _x) ); _PROTOTYPE( double atan2, (double _y, double _x) ); _PROTOTYPE( double ceil, (double _x) ); _PROTOTYPE( double cos, (double _x) ); _PROTOTYPE( double cosh, (double _x) ); _PROTOTYPE( double exp, (double _x) ); _PROTOTYPE( double fabs, (double _x) ); _PROTOTYPE( double floor, (double _x) ); _PROTOTYPE( double fmod, (double _x, double _y) ); _PROTOTYPE( double frexp, (double _x, int *_exp) ); _PROTOTYPE( double ldexp, (double _x, int _exp) ); _PROTOTYPE( double log, (double _x) ); _PROTOTYPE( double log10, (double _x) ); _PROTOTYPE( double modf, (double _x, double *_iptr) ); _PROTOTYPE( double pow, (double _x, double _y) ); _PROTOTYPE( double sin, (double _x) ); _PROTOTYPE( double sinh, (double _x) ); _PROTOTYPE( double sqrt, (double _x) ); _PROTOTYPE( double tan, (double _x) ); _PROTOTYPE( double tanh, (double _x) ); X #endif /* _MATH_H */ SHAR_EOF (set 20 06 04 09 23 53 15 'elkslibm/math.h'; eval "$shar_touch") && chmod 0644 'elkslibm/math.h' || $echo 'restore of' 'elkslibm/math.h' 'failed' if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \ && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then md5sum -c << SHAR_EOF >/dev/null 2>&1 \ || $echo 'elkslibm/math.h:' 'MD5 check failed' b19a329949ff3af63c7c1bd9202f56e7 elkslibm/math.h SHAR_EOF else shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'elkslibm/math.h'`" test 1392 -eq "$shar_count" || $echo 'elkslibm/math.h:' 'original size' '1392,' 'current size' "$shar_count!" fi fi # ============= elkslibm/modf.c ============== if test -f 'elkslibm/modf.c' && test "$first_param" != -c; then $echo 'x -' SKIPPING 'elkslibm/modf.c' '(file already exists)' else $echo 'x -' extracting 'elkslibm/modf.c' '(text)' sed 's/^X//' << 'SHAR_EOF' > 'elkslibm/modf.c' && /* X * CDDL HEADER START X * X * The contents of this file are subject to the terms of the X * Common Development and Distribution License, Version 1.0 only X * (the "License"). You may not use this file except in compliance X * with the License. X * X * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE X * or http://www.opensolaris.org/os/licensing. X * See the License for the specific language governing permissions X * and limitations under the License. X * X * When distributing Covered Code, include this CDDL HEADER in each X * file and include the License file at usr/src/OPENSOLARIS.LICENSE. X * If applicable, add the following below this CDDL HEADER, with the X * fields enclosed by brackets "[]" replaced with your own identifying X * information: Portions Copyright [yyyy] [name of copyright owner] X * X * CDDL HEADER END X */ #pragma ident "@(#)modf.c 1.4 05/06/08 SMI" /* from ATT S5R3 */ X /* The following is extracted from... */ X /* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ X X /* X * modf(value, iptr) returns the signed fractional part of value X * and stores the integer part indirectly through iptr. X * X */ X #define MAXPOWTWO 4.503599627370496000E+15 X /* doubles >= MAXPOWTWO are already integers */ double modf(value, iptr) double value; register double *iptr; { X register double absvalue; X X if ((absvalue = (value >= 0.0) ? value : -value) >= MAXPOWTWO) X *iptr = value; /* it must be an integer */ X else { X *iptr = absvalue + MAXPOWTWO; /* shift fraction off right */ X *iptr -= MAXPOWTWO; /* shift back without fraction */ X while (*iptr > absvalue) /* above arithmetic might round */ X *iptr -= 1.0; /* test again just to be sure */ X if (value < 0.0) X *iptr = -*iptr; X } X return (value - *iptr); /* signed fractional part */ } SHAR_EOF (set 20 06 04 09 23 43 57 'elkslibm/modf.c'; eval "$shar_touch") && chmod 0644 'elkslibm/modf.c' || $echo 'restore of' 'elkslibm/modf.c' 'failed' if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \ && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then md5sum -c << SHAR_EOF >/dev/null 2>&1 \ || $echo 'elkslibm/modf.c:' 'MD5 check failed' c4b40aa2c9e4dfcf04d6267920ce8630 elkslibm/modf.c SHAR_EOF else shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'elkslibm/modf.c'`" test 1775 -eq "$shar_count" || $echo 'elkslibm/modf.c:' 'original size' '1775,' 'current size' "$shar_count!" fi fi # ============= elkslibm/sinh.c ============== if test -f 'elkslibm/sinh.c' && test "$first_param" != -c; then $echo 'x -' SKIPPING 'elkslibm/sinh.c' '(file already exists)' else $echo 'x -' extracting 'elkslibm/sinh.c' '(text)' sed 's/^X//' << 'SHAR_EOF' > 'elkslibm/sinh.c' && /* X * (c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands. X * See the copyright notice in the ACK home directory, in the file "Copyright". X * X * Author: Ceriel J.H. Jacobs X */ /* $Header: sinh.c,v 1.3 91/03/19 16:39:12 ceriel Exp $ */ X #include #include #include #include "localmath.h" X static double sinh_cosh(double x, int cosh_flag) { X /* Algorithm and coefficients from: X "Software manual for the elementary functions" X by W.J. Cody and W. Waite, Prentice-Hall, 1980 X */ X X static double p[] = { X -0.35181283430177117881e+6, X -0.11563521196851768270e+5, X -0.16375798202630751372e+3, X -0.78966127417357099479e+0 X }; X static double q[] = { X -0.21108770058106271242e+7, X 0.36162723109421836460e+5, X -0.27773523119650701167e+3, X 1.0 X }; X int negative = x < 0; X double y = negative ? -x : x; X X if (__IsNan(x)) { X errno = EDOM; X return x; X } X if (! cosh_flag && y <= 1.0) { X /* ??? check for underflow ??? */ X y = y * y; X return x + x * y * POLYNOM3(y, p)/POLYNOM3(y,q); X } X X if (y >= M_LN_MAX_D) { X /* exp(y) would cause overflow */ #define LNV 0.69316101074218750000e+0 #define VD2M1 0.52820835025874852469e-4 X double w = y - LNV; X X if (w < M_LN_MAX_D+M_LN2-LNV) { X x = exp(w); X x += VD2M1 * x; X } X else { X errno = ERANGE; X x = HUGE_VAL; X } X } X else { X double z = exp(y); X X x = 0.5 * (z + (cosh_flag ? 1.0 : -1.0)/z); X } X return negative ? -x : x; } X double sinh(double x) { X return sinh_cosh(x, 0); } X double cosh(double x) { X if (x < 0) x = -x; X return sinh_cosh(x, 1); } SHAR_EOF (set 20 06 04 09 23 44 14 'elkslibm/sinh.c'; eval "$shar_touch") && chmod 0644 'elkslibm/sinh.c' || $echo 'restore of' 'elkslibm/sinh.c' 'failed' if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \ && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then md5sum -c << SHAR_EOF >/dev/null 2>&1 \ || $echo 'elkslibm/sinh.c:' 'MD5 check failed' 48f20a89235c6e7b2a89ab0dbbb0abe3 elkslibm/sinh.c SHAR_EOF else shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'elkslibm/sinh.c'`" test 1562 -eq "$shar_count" || $echo 'elkslibm/sinh.c:' 'original size' '1562,' 'current size' "$shar_count!" fi fi # ============= elkslibm/tanh.c ============== if test -f 'elkslibm/tanh.c' && test "$first_param" != -c; then $echo 'x -' SKIPPING 'elkslibm/tanh.c' '(file already exists)' else $echo 'x -' extracting 'elkslibm/tanh.c' '(text)' sed 's/^X//' << 'SHAR_EOF' > 'elkslibm/tanh.c' && /* X * (c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands. X * See the copyright notice in the ACK home directory, in the file "Copyright". X * X * Author: Ceriel J.H. Jacobs X */ /* $Header: tanh.c,v 1.3 91/03/19 16:39:40 ceriel Exp $ */ X #include #include #include #include "localmath.h" X double tanh(double x) { X /* Algorithm and coefficients from: X "Software manual for the elementary functions" X by W.J. Cody and W. Waite, Prentice-Hall, 1980 X */ X X static double p[] = { X -0.16134119023996228053e+4, X -0.99225929672236083313e+2, X -0.96437492777225469787e+0 X }; X static double q[] = { X 0.48402357071988688686e+4, X 0.22337720718962312926e+4, X 0.11274474380534949335e+3, X 1.0 X }; X int negative = x < 0; X X if (__IsNan(x)) { X errno = EDOM; X return x; X } X if (negative) x = -x; X X if (x >= 0.5*M_LN_MAX_D) { X x = 1.0; X } #define LN3D2 0.54930614433405484570e+0 /* ln(3)/2 */ X else if (x > LN3D2) { X x = 0.5 - 1.0/(exp(x+x)+1.0); X x += x; X } X else { X /* ??? avoid underflow ??? */ X double g = x*x; X x += x * g * POLYNOM2(g, p)/POLYNOM3(g, q); X } X return negative ? -x : x; } SHAR_EOF (set 20 06 04 09 23 44 14 'elkslibm/tanh.c'; eval "$shar_touch") && chmod 0644 'elkslibm/tanh.c' || $echo 'restore of' 'elkslibm/tanh.c' 'failed' if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \ && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then md5sum -c << SHAR_EOF >/dev/null 2>&1 \ || $echo 'elkslibm/tanh.c:' 'MD5 check failed' 3a46bbed8a7e6f0ca82d5b1a8ae8e1d3 elkslibm/tanh.c SHAR_EOF else shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'elkslibm/tanh.c'`" test 1142 -eq "$shar_count" || $echo 'elkslibm/tanh.c:' 'original size' '1142,' 'current size' "$shar_count!" fi fi # ============= elkslibm/sqrt.c ============== if test -f 'elkslibm/sqrt.c' && test "$first_param" != -c; then $echo 'x -' SKIPPING 'elkslibm/sqrt.c' '(file already exists)' else $echo 'x -' extracting 'elkslibm/sqrt.c' '(text)' sed 's/^X//' << 'SHAR_EOF' > 'elkslibm/sqrt.c' && /* X * (c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands. X * See the copyright notice in the ACK home directory, in the file "Copyright". X * X * Author: Ceriel J.H. Jacobs X */ /* $Header: sqrt.c,v 1.3 91/03/19 16:39:21 ceriel Exp $ */ X #include #include #include X #define NITER 5 X double sqrt(double x) { X int exponent; X double val; X X if (__IsNan(x)) { X errno = EDOM; X return x; X } X if (x <= 0) { X if (x < 0) errno = EDOM; X return 0; X } X X if (x > DBL_MAX) return x; /* for infinity */ X X val = frexp(x, &exponent); X if (exponent & 1) { X exponent--; X val *= 2; X } X val = ldexp(val + 1.0, exponent/2 - 1); X /* was: val = (val + 1.0)/2.0; val = ldexp(val, exponent/2); */ X for (exponent = NITER - 1; exponent >= 0; exponent--) { X val = (val + x / val) / 2.0; X } X return val; } SHAR_EOF (set 20 06 04 09 23 44 14 'elkslibm/sqrt.c'; eval "$shar_touch") && chmod 0644 'elkslibm/sqrt.c' || $echo 'restore of' 'elkslibm/sqrt.c' 'failed' if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \ && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then md5sum -c << SHAR_EOF >/dev/null 2>&1 \ || $echo 'elkslibm/sqrt.c:' 'MD5 check failed' fdfba3ee2fdaabb58d87e1541841e65e elkslibm/sqrt.c SHAR_EOF else shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'elkslibm/sqrt.c'`" test 830 -eq "$shar_count" || $echo 'elkslibm/sqrt.c:' 'original size' '830,' 'current size' "$shar_count!" fi fi # ============= elkslibm/hugeval.c ============== if test -f 'elkslibm/hugeval.c' && test "$first_param" != -c; then $echo 'x -' SKIPPING 'elkslibm/hugeval.c' '(file already exists)' else $echo 'x -' extracting 'elkslibm/hugeval.c' '(text)' sed 's/^X//' << 'SHAR_EOF' > 'elkslibm/hugeval.c' && /* X * (c) copyright 1990 by the Vrije Universiteit, Amsterdam, The Netherlands. X * See the copyright notice in the ACK home directory, in the file "Copyright". X * X * Author: Hans van Eck X */ /* $Header: hugeval.c,v 1.1 90/10/24 14:29:42 eck Exp $ */ #include X double __huge_val(void) { X return 1.0e+1000; /* This will generate a warning */ } SHAR_EOF (set 20 06 04 09 23 44 14 'elkslibm/hugeval.c'; eval "$shar_touch") && chmod 0644 'elkslibm/hugeval.c' || $echo 'restore of' 'elkslibm/hugeval.c' 'failed' if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \ && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then md5sum -c << SHAR_EOF >/dev/null 2>&1 \ || $echo 'elkslibm/hugeval.c:' 'MD5 check failed' 721558fc352d2fecb84c17d73635e1ea elkslibm/hugeval.c SHAR_EOF else shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'elkslibm/hugeval.c'`" test 351 -eq "$shar_count" || $echo 'elkslibm/hugeval.c:' 'original size' '351,' 'current size' "$shar_count!" fi fi # ============= elkslibm/atan2.c ============== if test -f 'elkslibm/atan2.c' && test "$first_param" != -c; then $echo 'x -' SKIPPING 'elkslibm/atan2.c' '(file already exists)' else $echo 'x -' extracting 'elkslibm/atan2.c' '(text)' sed 's/^X//' << 'SHAR_EOF' > 'elkslibm/atan2.c' && /* X * (c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands. X * See the copyright notice in the ACK home directory, in the file "Copyright". X * X * Author: Ceriel J.H. Jacobs X */ /* $Header: atan2.c,v 1.2 89/12/18 15:42:35 eck Exp $ */ X #include #include #include "localmath.h" X double atan2(double y, double x) { X double absx, absy, val; X X if (x == 0 && y == 0) { X errno = EDOM; X return 0; X } X absy = y < 0 ? -y : y; X absx = x < 0 ? -x : x; X if (absy - absx == absy) { X /* x negligible compared to y */ X return y < 0 ? -M_PI_2 : M_PI_2; X } X if (absx - absy == absx) { X /* y negligible compared to x */ X val = 0.0; X } X else val = atan(y/x); X if (x > 0) { X /* first or fourth quadrant; already correct */ X return val; X } X if (y < 0) { X /* third quadrant */ X return val - M_PI; X } X return val + M_PI; } SHAR_EOF (set 20 06 04 09 23 44 14 'elkslibm/atan2.c'; eval "$shar_touch") && chmod 0644 'elkslibm/atan2.c' || $echo 'restore of' 'elkslibm/atan2.c' 'failed' if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \ && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then md5sum -c << SHAR_EOF >/dev/null 2>&1 \ || $echo 'elkslibm/atan2.c:' 'MD5 check failed' 40065f9364cdd4b6fdb2a16c1ae1fa49 elkslibm/atan2.c SHAR_EOF else shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'elkslibm/atan2.c'`" test 848 -eq "$shar_count" || $echo 'elkslibm/atan2.c:' 'original size' '848,' 'current size' "$shar_count!" fi fi # ============= elkslibm/isnan.c ============== if test -f 'elkslibm/isnan.c' && test "$first_param" != -c; then $echo 'x -' SKIPPING 'elkslibm/isnan.c' '(file already exists)' else $echo 'x -' extracting 'elkslibm/isnan.c' '(text)' sed 's/^X//' << 'SHAR_EOF' > 'elkslibm/isnan.c' && int __IsNan(double d) { #if defined(vax) || defined(pdp) #else X float f = d; X X if ((*((long *) &f) & 0x7f800000) == 0x7f800000 && X (*((long *) &f) & 0x007fffff) != 0) return 1; #endif X return 0; } SHAR_EOF (set 20 06 04 09 23 44 14 'elkslibm/isnan.c'; eval "$shar_touch") && chmod 0644 'elkslibm/isnan.c' || $echo 'restore of' 'elkslibm/isnan.c' 'failed' if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \ && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then md5sum -c << SHAR_EOF >/dev/null 2>&1 \ || $echo 'elkslibm/isnan.c:' 'MD5 check failed' 5da50bb4884be18812cb87684a6b1e7a elkslibm/isnan.c SHAR_EOF else shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'elkslibm/isnan.c'`" test 201 -eq "$shar_count" || $echo 'elkslibm/isnan.c:' 'original size' '201,' 'current size' "$shar_count!" fi fi rm -fr _sh16061 exit 0 --------------000408050706010400070100--