Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Portable Math Library (Part 1a of 6 REPOST)

19 views
Skip to first unread message

f...@mcdsun.uucp

unread,
Apr 29, 1987, 5:09:39 PM4/29/87
to

It appears that Part 1 of 6 of the pml posting was truncated or lost
because it exceeded 64000 characters; *NOT* 64K (???). Anyway, I've
split the contents up into two postings, Part 1a and Part 1b.

#! /bin/sh
# This is a shell archive. Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file". To overwrite existing
# files, type "sh file -c". You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g.. If this archive is complete, you
# will see the following message at the end:
# "End of archive 1 (of 1)."
# Contents: doc doc/trlr.r funcs funcs/doc funcs/doc/funcs.r
# funcs/environ funcs/environ/Makefile funcs/environ/testfrexp.in
# funcs/environ/testfrexp.out funcs/environ/testldexp.in
# funcs/environ/testldexp.out funcs/environ/testmodf.in
# funcs/environ/testmodf.out funcs/src funcs/src/Makefile
# funcs/src/cabs.c funcs/src/cadd.c funcs/src/casin.c
# funcs/src/catan.c funcs/src/ccos.c funcs/src/ccosh.c
# funcs/src/cexp.c funcs/src/clog.c funcs/src/crcp.c
# funcs/src/csin.c funcs/src/csinh.c funcs/unused tests tests/unused
# Wrapped by fnf@mcdsun on Wed Apr 29 14:02:08 1987
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test ! -d doc ; then
echo shar: Creating directory \"doc\"
mkdir doc
fi
if test -f doc/trlr.r -a "${1}" != "-c" ; then
echo shar: Will not over-write existing file \"doc/trlr.r\"
else
echo shar: Extracting \"doc/trlr.r\" \(376 characters\)
sed "s/^X//" >doc/trlr.r <<'END_OF_doc/trlr.r'
X.bp
X.ce
XREFERENCES
X.sp 3
X.nf
XP. A. Fox, A. D. Hall, and N. L. Schryer,
XThe PORT Mathematical Subroutine Library,
XACM Transactions on Mathematical Software,
XVol 4, No. 2, June 1978, pp 104-126.
X.sp 3
XBrian Ford,
XParameterization of the Environment for Transportable Numerical Software,
XACM Transactions on Mathematical Software,
XVol 4, No. 2, June 1978, pp 100-103.
X
X.bp
X.xp
X
X
END_OF_doc/trlr.r
if test 376 -ne `wc -c <doc/trlr.r`; then
echo shar: \"doc/trlr.r\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test ! -d funcs ; then
echo shar: Creating directory \"funcs\"
mkdir funcs
fi
if test ! -d funcs/doc ; then
echo shar: Creating directory \"funcs/doc\"
mkdir funcs/doc
fi
if test -f funcs/doc/funcs.r -a "${1}" != "-c" ; then
echo shar: Will not over-write existing file \"funcs/doc/funcs.r\"
else
echo shar: Extracting \"funcs/doc/funcs.r\" \(460 characters\)
sed "s/^X//" >funcs/doc/funcs.r <<'END_OF_funcs/doc/funcs.r'
X.he '\*(td''abs'
X.bp
X.fo ''- % -''
X.sh 2 "abs double precision absolute value"
X.sp 3
X.ce
X*******
X.ce
X* abs *
X.ce
X*******
X.sp 3
X.(x
Xabs
X.)x
X.(x
Xmachine independent routines
X.)x
X.(x
Xmath libraries
X.)x
X.ul 1
XDESCRIPTION
X.sp 1
X.in 8
XReturns absolute value of double precision number.
X.sp 1
X.in 0
X.ul 1
XUSAGE
X.sp 1
X.nf
X.in 8
Xdouble abs(x)
Xdouble x;
X.sp 1
X.in 0
X.ul 1
XPROGRAMMER
X.sp 1
X.in 8
XFred Fish
XEngineering Software Tools
XP.O. Box 2035
XTempe, Az 85281
X.sp 1
END_OF_funcs/doc/funcs.r
if test 460 -ne `wc -c <funcs/doc/funcs.r`; then
echo shar: \"funcs/doc/funcs.r\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test ! -d funcs/environ ; then
echo shar: Creating directory \"funcs/environ\"
mkdir funcs/environ
fi
if test -f funcs/environ/Makefile -a "${1}" != "-c" ; then
echo shar: Will not over-write existing file \"funcs/environ/Makefile\"
else
echo shar: Extracting \"funcs/environ/Makefile\" \(216 characters\)
sed "s/^X//" >funcs/environ/Makefile <<'END_OF_funcs/environ/Makefile'
Xall : testfrexp testldexp testmodf
X
Xtestfrexp : testfrexp.c
X cc -o testfrexp testfrexp.c -lm
X
Xtestldexp : testldexp.c
X cc -o testldexp testldexp.c -lm
X
Xtestmodf : testmodf.c
X cc -o testmodf testmodf.c -lm
END_OF_funcs/environ/Makefile
if test 216 -ne `wc -c <funcs/environ/Makefile`; then
echo shar: \"funcs/environ/Makefile\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f funcs/environ/testfrexp.in -a "${1}" != "-c" ; then
echo shar: Will not over-write existing file \"funcs/environ/testfrexp.in\"
else
echo shar: Extracting \"funcs/environ/testfrexp.in\" \(283 characters\)
sed "s/^X//" >funcs/environ/testfrexp.in <<'END_OF_funcs/environ/testfrexp.in'
X0.000000e+00
X1.000000e+00
X2.000000e+00
X4.000000e+00
X8.000000e+00
X2.560000e+02
X3.276800e+04
X-1.000000e+00
X-2.000000e+00
X-4.000000e+00
X-8.000000e+00
X-2.560000e+02
X-3.276800e+04
X1.234500e+00
X1.234500e+10
X3.456700e+20
X3.456700e-05
X-1.234500e+00
X-1.234500e+10
X-3.456700e+20
X-3.456700e-05
END_OF_funcs/environ/testfrexp.in
if test 283 -ne `wc -c <funcs/environ/testfrexp.in`; then
echo shar: \"funcs/environ/testfrexp.in\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f funcs/environ/testfrexp.out -a "${1}" != "-c" ; then
echo shar: Will not over-write existing file \"funcs/environ/testfrexp.out\"
else
echo shar: Extracting \"funcs/environ/testfrexp.out\" \(339 characters\)
sed "s/^X//" >funcs/environ/testfrexp.out <<'END_OF_funcs/environ/testfrexp.out'
X0.000000e+00 -1021
X5.000000e-01 1
X5.000000e-01 2
X5.000000e-01 3
X5.000000e-01 4
X5.000000e-01 9
X5.000000e-01 16
X-5.000000e-01 1
X-5.000000e-01 2
X-5.000000e-01 3
X-5.000000e-01 4
X-5.000000e-01 9
X-5.000000e-01 16
X6.172500e-01 1
X7.185736e-01 34
X5.855878e-01 69
X5.663457e-01 -14
X-6.172500e-01 1
X-7.185736e-01 34
X-5.855878e-01 69
X-5.663457e-01 -14
END_OF_funcs/environ/testfrexp.out
if test 339 -ne `wc -c <funcs/environ/testfrexp.out`; then
echo shar: \"funcs/environ/testfrexp.out\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f funcs/environ/testldexp.in -a "${1}" != "-c" ; then
echo shar: Will not over-write existing file \"funcs/environ/testldexp.in\"
else
echo shar: Extracting \"funcs/environ/testldexp.in\" \(339 characters\)
sed "s/^X//" >funcs/environ/testldexp.in <<'END_OF_funcs/environ/testldexp.in'
X0.000000e+00 -1021
X5.000000e-01 1
X5.000000e-01 2
X5.000000e-01 3
X5.000000e-01 4
X5.000000e-01 9
X5.000000e-01 16
X-5.000000e-01 1
X-5.000000e-01 2
X-5.000000e-01 3
X-5.000000e-01 4
X-5.000000e-01 9
X-5.000000e-01 16
X6.172500e-01 1
X7.185736e-01 34
X5.855878e-01 69
X5.663457e-01 -14
X-6.172500e-01 1
X-7.185736e-01 34
X-5.855878e-01 69
X-5.663457e-01 -14
END_OF_funcs/environ/testldexp.in
if test 339 -ne `wc -c <funcs/environ/testldexp.in`; then
echo shar: \"funcs/environ/testldexp.in\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f funcs/environ/testldexp.out -a "${1}" != "-c" ; then
echo shar: Will not over-write existing file \"funcs/environ/testldexp.out\"
else
echo shar: Extracting \"funcs/environ/testldexp.out\" \(283 characters\)
sed "s/^X//" >funcs/environ/testldexp.out <<'END_OF_funcs/environ/testldexp.out'
X0.000000e+00
X1.000000e+00
X2.000000e+00
X4.000000e+00
X8.000000e+00
X2.560000e+02
X3.276800e+04
X-1.000000e+00
X-2.000000e+00
X-4.000000e+00
X-8.000000e+00
X-2.560000e+02
X-3.276800e+04
X1.234500e+00
X1.234500e+10
X3.456700e+20
X3.456700e-05
X-1.234500e+00
X-1.234500e+10
X-3.456700e+20
X-3.456700e-05
END_OF_funcs/environ/testldexp.out
if test 283 -ne `wc -c <funcs/environ/testldexp.out`; then
echo shar: \"funcs/environ/testldexp.out\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f funcs/environ/testmodf.in -a "${1}" != "-c" ; then
echo shar: Will not over-write existing file \"funcs/environ/testmodf.in\"
else
echo shar: Extracting \"funcs/environ/testmodf.in\" \(283 characters\)
sed "s/^X//" >funcs/environ/testmodf.in <<'END_OF_funcs/environ/testmodf.in'
X0.000000e+00
X1.000000e+00
X2.000000e+00
X4.000000e+00
X8.000000e+00
X2.560000e+02
X3.276800e+04
X-1.000000e+00
X-2.000000e+00
X-4.000000e+00
X-8.000000e+00
X-2.560000e+02
X-3.276800e+04
X1.234500e+00
X1.234500e+10
X3.456700e+20
X3.456700e-05
X-1.234500e+00
X-1.234500e+10
X-3.456700e+20
X-3.456700e-05
END_OF_funcs/environ/testmodf.in
if test 283 -ne `wc -c <funcs/environ/testmodf.in`; then
echo shar: \"funcs/environ/testmodf.in\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f funcs/environ/testmodf.out -a "${1}" != "-c" ; then
echo shar: Will not over-write existing file \"funcs/environ/testmodf.out\"
else
echo shar: Extracting \"funcs/environ/testmodf.out\" \(557 characters\)
sed "s/^X//" >funcs/environ/testmodf.out <<'END_OF_funcs/environ/testmodf.out'
X0.000000e+00 0.000000e+00
X0.000000e+00 1.000000e+00
X0.000000e+00 2.000000e+00
X0.000000e+00 4.000000e+00
X0.000000e+00 8.000000e+00
X0.000000e+00 2.560000e+02
X0.000000e+00 3.276800e+04
X0.000000e+00 -1.000000e+00
X0.000000e+00 -2.000000e+00
X0.000000e+00 -4.000000e+00
X0.000000e+00 -8.000000e+00
X0.000000e+00 -2.560000e+02
X0.000000e+00 -3.276800e+04
X2.345000e-01 1.000000e+00
X0.000000e+00 1.234500e+10
X0.000000e+00 3.456700e+20
X3.456700e-05 0.000000e+00
X-2.345000e-01 -1.000000e+00
X0.000000e+00 -1.234500e+10
X0.000000e+00 -3.456700e+20
X-3.456700e-05 0.000000e+00
END_OF_funcs/environ/testmodf.out
if test 557 -ne `wc -c <funcs/environ/testmodf.out`; then
echo shar: \"funcs/environ/testmodf.out\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test ! -d funcs/src ; then
echo shar: Creating directory \"funcs/src\"
mkdir funcs/src
fi
if test -f funcs/src/Makefile -a "${1}" != "-c" ; then
echo shar: Will not over-write existing file \"funcs/src/Makefile\"
else
echo shar: Extracting \"funcs/src/Makefile\" \(1358 characters\)
sed "s/^X//" >funcs/src/Makefile <<'END_OF_funcs/src/Makefile'
X#
X# FILE
X#
X# Makefile build and install the pml library
X#
X# SYNOPSIS
X#
X# make funcs make version of library in local directory
X# make install install the library (must be root)
X#
X# WARNING
X#
X# The order of the modules listed in the "LEVEL<n>" macros
X# is significant since these are the orders in which
X# they will be loaded into the library archive. Although
X# some machines support randomly ordered libraries, ordering
X# them correctly doesn't hurt...
X
XLIB = /usr/lib
X
XINC = /usr/include
X
XCFLAGS = -O -DIEEE
X
XLEVEL0 = ldexp.o frexp.o modf.o matherr.o
X
XLEVEL1 = sign.o mod.o poly.o dabs.o sqrt.o
X
XLEVEL2 = acos.o acosh.o asin.o asinh.o atan2.o atan.o \
X log10.o tan.o \
X tanh.o sinh.o cosh.o atanh.o \
X log.o sin.o cos.o exp.o max.o min.o
X
XLEVEL3 = casin.o cacos.o cmult.o catan.o ccosh.o clog.o \
X crcp.o csinh.o csqrt.o ctan.o ctanh.o cexp.o \
X ccos.o csin.o cdiv.o csubt.o cabs.o
X
XLEVEL4 = cadd.o
X
XOBJ = $(LEVEL4) $(LEVEL3) $(LEVEL2) $(LEVEL1)
X
X#
X# The default thing to make.
X#
X
Xdefault: libpml.a
X
Xlibpml.a: $(OBJ)
X ar cr libpml.a $(OBJ)
X
X$(OBJ) : pml.h
X
X#
X# Stuff to do installation
X#
X
Xinstall : $(LIB)/libpml.a $(INC)/pmluser.h
X
X$(LIB)/libpml.a: libpml.a
X cp libpml.a $(LIB)/libpml.a
X
X$(INC)/pmluser.h : pmluser.h
X cp pmluser.h $(INC)/pmluser.h
X
X#
X# Clean up the directory.
X#
X
Xclean:
X rm -f *.o *.BAK libpml.a *.tmp *.bak nohup.out
END_OF_funcs/src/Makefile
if test 1358 -ne `wc -c <funcs/src/Makefile`; then
echo shar: \"funcs/src/Makefile\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f funcs/src/cabs.c -a "${1}" != "-c" ; then
echo shar: Will not over-write existing file \"funcs/src/cabs.c\"
else
echo shar: Extracting \"funcs/src/cabs.c\" \(1722 characters\)
sed "s/^X//" >funcs/src/cabs.c <<'END_OF_funcs/src/cabs.c'
X/************************************************************************
X * *
X * N O T I C E *
X * *
X * Copyright Abandoned, 1987, Fred Fish *
X * *
X * This previously copyrighted work has been placed into the *
X * public domain by the author (Fred Fish) and may be freely used *
X * for any purpose, private or commercial. I would appreciate *
X * it, as a courtesy, if this notice is left in all copies and *
X * derivative works. Thank you, and enjoy... *
X * *
X * The author makes no warranty of any kind with respect to this *
X * product and explicitly disclaims any implied warranties of *
X * merchantability or fitness for any particular purpose. *
X * *
X ************************************************************************
X */
X
X
X/*
X * FUNCTION
X *
X * cabs double precision complex absolute value
X *
X * KEY WORDS
X *
X * cabs
X * complex functions
X * machine independent routines
X * math libraries
X *
X * DESCRIPTION
X *
X * Computes double precision absolute value of a double
X * precision complex argument, where "absolute value"
X * is taken to mean magnitude. The result replaces the
X * argument.
X *
X * USAGE
X *
X * double cabs (z)
X * COMPLEX z;
X *
X * PROGRAMMER
X *
X * Fred Fish
X * Tempe, Az
X *
X * INTERNALS
X *
X * Computes cabs (z) where z = (x) + j(y) from:
X *
X * cabs (z) = sqrt (x*x + y*y)
X *
X */
X
X#include <stdio.h>
X#include <pmluser.h>
X#include "pml.h"
X
X
Xdouble cabs (z)
XCOMPLEX z;
X{
X double result;
X extern double sqrt ();
X
X ENTER ("cabs");
X DEBUG4 ("cabsin", "arg %le +j %le", z.real, z.imag);
X result = sqrt ((z.real * z.real) + (z.imag * z.imag));
X DEBUG3 ("cabsout", "result %le", result);
X LEAVE ();
X return (result);
X}
END_OF_funcs/src/cabs.c
if test 1722 -ne `wc -c <funcs/src/cabs.c`; then
echo shar: \"funcs/src/cabs.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f funcs/src/cadd.c -a "${1}" != "-c" ; then
echo shar: Will not over-write existing file \"funcs/src/cadd.c\"
else
echo shar: Extracting \"funcs/src/cadd.c\" \(1820 characters\)
sed "s/^X//" >funcs/src/cadd.c <<'END_OF_funcs/src/cadd.c'
X/************************************************************************
X * *
X * N O T I C E *
X * *
X * Copyright Abandoned, 1987, Fred Fish *
X * *
X * This previously copyrighted work has been placed into the *
X * public domain by the author (Fred Fish) and may be freely used *
X * for any purpose, private or commercial. I would appreciate *
X * it, as a courtesy, if this notice is left in all copies and *
X * derivative works. Thank you, and enjoy... *
X * *
X * The author makes no warranty of any kind with respect to this *
X * product and explicitly disclaims any implied warranties of *
X * merchantability or fitness for any particular purpose. *
X * *
X ************************************************************************
X */
X
X
X/*
X * FUNCTION
X *
X * cadd double precision complex addition
X *
X * KEY WORDS
X *
X * cadd
X * complex functions
X * machine independent routines
X * math libraries
X *
X * DESCRIPTION
X *
X * Computes double precision complex result of addition of
X * first double precision complex argument with second double
X * precision complex argument.
X *
X * Note that the complex addition function is
X * so simple that it would not normally be called as a function
X * but simply done "inline". It is supplied mostly for
X * completeness.
X *
X * USAGE
X *
X * COMPLEX cadd (z1, z2)
X * COMPLEX z1;
X * COMPLEX z2;
X *
X * PROGRAMMER
X *
X * Fred Fish
X * Tempe, Az 85281
X * (602) 966-8871
X *
X * INTERNALS
X *
X * Computes cadd(z1,z2) from:
X *
X * 1. Let z1 = a + j b
X * Let z2 = c + j d
X *
X * 2. Then cadd(z1,z2) = (a + c) + j (b + d)
X *
X */
X
X#include <stdio.h>
X#include <pmluser.h>
X#include "pml.h"
X
X
XCOMPLEX cadd (z1, z2)
XCOMPLEX z1;
XCOMPLEX z2;
X{
X ENTER ("cadd");
X z1.real += z2.real;
X z1.imag += z2.imag;
X LEAVE ();
X return (z1);
X}
END_OF_funcs/src/cadd.c
if test 1820 -ne `wc -c <funcs/src/cadd.c`; then
echo shar: \"funcs/src/cadd.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f funcs/src/casin.c -a "${1}" != "-c" ; then
echo shar: Will not over-write existing file \"funcs/src/casin.c\"
else
echo shar: Extracting \"funcs/src/casin.c\" \(1876 characters\)
sed "s/^X//" >funcs/src/casin.c <<'END_OF_funcs/src/casin.c'
X/************************************************************************
X * *
X * N O T I C E *
X * *
X * Copyright Abandoned, 1987, Fred Fish *
X * *
X * This previously copyrighted work has been placed into the *
X * public domain by the author (Fred Fish) and may be freely used *
X * for any purpose, private or commercial. I would appreciate *
X * it, as a courtesy, if this notice is left in all copies and *
X * derivative works. Thank you, and enjoy... *
X * *
X * The author makes no warranty of any kind with respect to this *
X * product and explicitly disclaims any implied warranties of *
X * merchantability or fitness for any particular purpose. *
X * *
X ************************************************************************
X */
X
X
X/*
X * FUNCTION
X *
X * casin complex double precision arc sine
X *
X * KEY WORDS
X *
X * casin
X * machine independent routines
X * complex functions
X * math libraries
X *
X * DESCRIPTION
X *
X * Computes double precision complex arc sine of
X * a double precision complex argument.
X *
X * USAGE
X *
X * COMPLEX casin (z)
X * COMPLEX z;
X *
X * PROGRAMMER
X *
X * Fred Fish
X * Tempe, Az 85281
X * (602) 966-8871
X *
X * INTERNALS
X *
X * Computes complex arc sine of z = x + j y from:
X *
X * casin(z) = -j * clog(csqrt(1-z*z) + j*z)
X *
X */
X
X#include <stdio.h>
X#include <pmluser.h>
X#include "pml.h"
X
X
XCOMPLEX casin (z)
XCOMPLEX z;
X{
X COMPLEX temp;
X extern COMPLEX csqrt (), clog (), cmult ();
X
X ENTER ("casin");
X DEBUG4 ("casinin", "arg %le %le", z.real, z.imag);
X temp = cmult (z, z);
X temp.real = 1.0 - temp.real;
X temp.imag = -temp.imag;
X temp = csqrt (temp);
X temp.real -= z.imag;
X temp.imag += z.real;
X temp = clog (temp);
X z.real = temp.imag;
X z.imag = -temp.real;
X DEBUG4 ("casinout", "result %le %le", z.real, z.imag);
X LEAVE ();
X return (z);
X}
END_OF_funcs/src/casin.c
if test 1876 -ne `wc -c <funcs/src/casin.c`; then
echo shar: \"funcs/src/casin.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f funcs/src/catan.c -a "${1}" != "-c" ; then
echo shar: Will not over-write existing file \"funcs/src/catan.c\"
else
echo shar: Extracting \"funcs/src/catan.c\" \(1857 characters\)
sed "s/^X//" >funcs/src/catan.c <<'END_OF_funcs/src/catan.c'
X/************************************************************************
X * *
X * N O T I C E *
X * *
X * Copyright Abandoned, 1987, Fred Fish *
X * *
X * This previously copyrighted work has been placed into the *
X * public domain by the author (Fred Fish) and may be freely used *
X * for any purpose, private or commercial. I would appreciate *
X * it, as a courtesy, if this notice is left in all copies and *
X * derivative works. Thank you, and enjoy... *
X * *
X * The author makes no warranty of any kind with respect to this *
X * product and explicitly disclaims any implied warranties of *
X * merchantability or fitness for any particular purpose. *
X * *
X ************************************************************************
X */
X
X
X/*
X * FUNCTION
X *
X * catan complex double precision arc tangent
X *
X * KEY WORDS
X *
X * catan
X * machine independent routines
X * complex functions
X * math libraries
X *
X * DESCRIPTION
X *
X * Computes double precision complex arc tangent of
X * a double precision complex argument.
X *
X * USAGE
X *
X * COMPLEX catan (z)
X * COMPLEX z;
X *
X * PROGRAMMER
X *
X * Fred Fish
X * Tempe, Az 85281
X * (602) 966-8871
X *
X * INTERNALS
X *
X * Computes complex arc tangent of z = x + j y from:
X *
X * catan(z) = -j/2 * clog( (j+z) / (j-z) )
X *
X */
X
X#include <stdio.h>
X#include <pmluser.h>
X#include "pml.h"
X
X
XCOMPLEX catan (z)
XCOMPLEX z;
X{
X COMPLEX temp;
X double swaptemp;
X extern COMPLEX cdiv (), clog ();
X
X ENTER ("catan");
X DEBUG4 ("catanin", "arg %le %le", z.real, z.imag);
X temp.real = -z.real;
X temp.imag = 1.0 - z.imag;
X z.imag += 1.0;
X z = cdiv (z, temp);
X z = clog (z);
X swaptemp = z.real;
X z.real = -0.5 * z.imag;
X z.imag = 0.5 * swaptemp;
X DEBUG4 ("catanout", "result %le %le", z.real, z.imag);
X LEAVE ();
X return (z);
X}
END_OF_funcs/src/catan.c
if test 1857 -ne `wc -c <funcs/src/catan.c`; then
echo shar: \"funcs/src/catan.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f funcs/src/ccos.c -a "${1}" != "-c" ; then
echo shar: Will not over-write existing file \"funcs/src/ccos.c\"
else
echo shar: Extracting \"funcs/src/ccos.c\" \(1881 characters\)
sed "s/^X//" >funcs/src/ccos.c <<'END_OF_funcs/src/ccos.c'
X/************************************************************************
X * *
X * N O T I C E *
X * *
X * Copyright Abandoned, 1987, Fred Fish *
X * *
X * This previously copyrighted work has been placed into the *
X * public domain by the author (Fred Fish) and may be freely used *
X * for any purpose, private or commercial. I would appreciate *
X * it, as a courtesy, if this notice is left in all copies and *
X * derivative works. Thank you, and enjoy... *
X * *
X * The author makes no warranty of any kind with respect to this *
X * product and explicitly disclaims any implied warranties of *
X * merchantability or fitness for any particular purpose. *
X * *
X ************************************************************************
X */
X
X
X/*
X * FUNCTION
X *
X * ccos complex double precision cosine
X *
X * KEY WORDS
X *
X * ccos
X * complex functions
X * machine independent routines
X * math libraries
X *
X * DESCRIPTION
X *
X * Computes double precision complex cosine of a double
X * precision complex argument.
X *
X * USAGE
X *
X * COMPLEX ccos (z)
X * COMPLEX z;
X *
X * REFERENCES
X *
X * Fortran 77 user's guide, Digital Equipment Corp. pp B-12
X *
X * PROGRAMMER
X *
X * Fred Fish
X * Tempe, Az 85281
X * (602) 966-8871
X *
X * INTERNALS
X *
X * Computes complex cosine of z = x + j y from:
X *
X * 1. r_ccos = cos(x) * cosh(y)
X *
X * 2. i_ccos = -sin(x) * sinh(y)
X *
X * 3. ccos(z) = r_ccos + j i_ccos
X *
X */
X
X#include <stdio.h>
X#include <pmluser.h>
X#include "pml.h"
X
X
XCOMPLEX ccos (z)
XCOMPLEX z;
X{
X COMPLEX result;
X extern double sin(), cos(), sinh(), cosh();
X
X ENTER ("ccos");
X DEBUG4 ("ccosin", "arg %le %le", z.real, z.imag);
X result.real = cos(z.real) * cosh(z.imag);
X result.imag = -sin(z.real) * sinh(z.imag);
X DEBUG4 ("ccosout", "result %le %le", result.real, result.imag);
X LEAVE ();
X return (result);
X}
END_OF_funcs/src/ccos.c
if test 1881 -ne `wc -c <funcs/src/ccos.c`; then
echo shar: \"funcs/src/ccos.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f funcs/src/ccosh.c -a "${1}" != "-c" ; then
echo shar: Will not over-write existing file \"funcs/src/ccosh.c\"
else
echo shar: Extracting \"funcs/src/ccosh.c\" \(1842 characters\)
sed "s/^X//" >funcs/src/ccosh.c <<'END_OF_funcs/src/ccosh.c'
X/************************************************************************
X * *
X * N O T I C E *
X * *
X * Copyright Abandoned, 1987, Fred Fish *
X * *
X * This previously copyrighted work has been placed into the *
X * public domain by the author (Fred Fish) and may be freely used *
X * for any purpose, private or commercial. I would appreciate *
X * it, as a courtesy, if this notice is left in all copies and *
X * derivative works. Thank you, and enjoy... *
X * *
X * The author makes no warranty of any kind with respect to this *
X * product and explicitly disclaims any implied warranties of *
X * merchantability or fitness for any particular purpose. *
X * *
X ************************************************************************
X */
X
X
X/*
X * FUNCTION
X *
X * ccosh complex double precision hyperbolic cosine
X *
X * KEY WORDS
X *
X * ccosh
X * machine independent routines
X * complex functions
X * math libraries
X *
X * DESCRIPTION
X *
X * Computes double precision complex hyperbolic cosine of
X * a double precision complex argument.
X *
X * USAGE
X *
X * COMPLEX ccosh (z)
X * COMPLEX z;
X *
X * PROGRAMMER
X *
X * Fred Fish
X * Tempe, Az 85281
X * (602) 966-8871
X *
X * INTERNALS
X *
X * Computes complex hyperbolic cosine of Z = x + j y from:
X *
X * ccosh(z) = 0.5 * ( cexp(z) + cexp(-z) )
X *
X */
X
X#include <stdio.h>
X#include <pmluser.h>
X#include "pml.h"
X
X
XCOMPLEX ccosh (z)
XCOMPLEX z;
X{
X COMPLEX cexpmz;
X extern COMPLEX cexp ();
X
X ENTER ("ccosh");
X DEBUG4 ("ccoshin", "arg %le %le", z.real, z.imag);
X cexpmz.real = -z.real;
X cexpmz.imag = -z.imag;
X cexpmz = cexp (cexpmz);
X z = cexp (z);
X z.real += cexpmz.real;
X z.imag += cexpmz.imag;
X z.real *= 0.5;
X z.imag *= 0.5;
X DEBUG4 ("ccoshout", "result %le %le", z.real, z.imag);
X LEAVE ();
X return (z);
X}
END_OF_funcs/src/ccosh.c
if test 1842 -ne `wc -c <funcs/src/ccosh.c`; then
echo shar: \"funcs/src/ccosh.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f funcs/src/cexp.c -a "${1}" != "-c" ; then
echo shar: Will not over-write existing file \"funcs/src/cexp.c\"
else
echo shar: Extracting \"funcs/src/cexp.c\" \(1910 characters\)
sed "s/^X//" >funcs/src/cexp.c <<'END_OF_funcs/src/cexp.c'
X/************************************************************************
X * *
X * N O T I C E *
X * *
X * Copyright Abandoned, 1987, Fred Fish *
X * *
X * This previously copyrighted work has been placed into the *
X * public domain by the author (Fred Fish) and may be freely used *
X * for any purpose, private or commercial. I would appreciate *
X * it, as a courtesy, if this notice is left in all copies and *
X * derivative works. Thank you, and enjoy... *
X * *
X * The author makes no warranty of any kind with respect to this *
X * product and explicitly disclaims any implied warranties of *
X * merchantability or fitness for any particular purpose. *
X * *
X ************************************************************************
X */
X
X
X/*
X * FUNCTION
X *
X * cexp complex double precision exponential
X *
X * KEY WORDS
X *
X * cexp
X * complex functions
X * machine independent routines
X * math libraries
X *
X * DESCRIPTION
X *
X * Computes double precision complex exponential of
X * a double precision complex argument.
X *
X * USAGE
X *
X * COMPLEX cexp (z)
X * COMPLEX z;
X *
X * REFERENCES
X *
X * Fortran 77 user's guide, Digital Equipment Corp. pp B-13
X *
X * PROGRAMMER
X *
X * Fred Fish
X * Tempe, Az 85281
X * (602) 966-8871
X *
X * INTERNALS
X *
X * Computes complex exponential of z = x + j y from:
X *
X * 1. r_cexp = exp(x) * cos(y)
X *
X * 2. i_cexp = exp(x) * sin(y)
X *
X * 3. cexp(z) = r_cexp + j i_cexp
X *
X */
X
X#include <stdio.h>
X#include <pmluser.h>
X#include "pml.h"
X
X
XCOMPLEX cexp (z)
XCOMPLEX z;
X{
X COMPLEX result;
X double expx;
X extern double exp(), sin(), cos();
X
X ENTER ("cexp");
X DEBUG4 ("cexpin", "arg %le %le", z.real, z.imag);
X expx = exp (z.real);
X result.real = expx * cos (z.imag);
X result.imag = expx * sin (z.imag);
X DEBUG4 ("cexpout", "result %le %le", result.real, result.imag);
X LEAVE ();
X return (result);
X}
END_OF_funcs/src/cexp.c
if test 1910 -ne `wc -c <funcs/src/cexp.c`; then
echo shar: \"funcs/src/cexp.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f funcs/src/clog.c -a "${1}" != "-c" ; then
echo shar: Will not over-write existing file \"funcs/src/clog.c\"
else
echo shar: Extracting \"funcs/src/clog.c\" \(1870 characters\)
sed "s/^X//" >funcs/src/clog.c <<'END_OF_funcs/src/clog.c'
X/************************************************************************
X * *
X * N O T I C E *
X * *
X * Copyright Abandoned, 1987, Fred Fish *
X * *
X * This previously copyrighted work has been placed into the *
X * public domain by the author (Fred Fish) and may be freely used *
X * for any purpose, private or commercial. I would appreciate *
X * it, as a courtesy, if this notice is left in all copies and *
X * derivative works. Thank you, and enjoy... *
X * *
X * The author makes no warranty of any kind with respect to this *
X * product and explicitly disclaims any implied warranties of *
X * merchantability or fitness for any particular purpose. *
X * *
X ************************************************************************
X */
X
X
X/*
X * FUNCTION
X *
X * clog complex double precision natural logarithm
X *
X * KEY WORDS
X *
X * clog
X * complex functions
X * machine independent routines
X * math libraries
X *
X * DESCRIPTION
X *
X * Computes double precision complex natural logarithm of
X * a double precision complex argument.
X *
X * USAGE
X *
X * COMPLEX clog (z)
X * COMPLEX z;
X *
X * REFERENCES
X *
X * Fortran 77 user's guide, Digital Equipment Corp. pp B-13
X *
X * PROGRAMMER
X *
X * Fred Fish
X * Tempe, Az 85281
X * (602) 966-8871
X *
X * INTERNALS
X *
X * Computes complex natural logarithm of z = x + j y from:
X *
X * 1. r_clog = log(cabs(z))
X *
X * 2. i_clog = atan2(x,y)
X *
X * 3. clog(z) = r_clog + j i_clog
X *
X */
X
X#include <stdio.h>
X#include <pmluser.h>
X#include "pml.h"
X
X
XCOMPLEX clog (z)
XCOMPLEX z;
X{
X double temp;
X extern double cabs (), atan2(), log ();
X
X ENTER ("clog");
X DEBUG4 ("clogin", "arg %le %le", z.real, z.imag);
X temp = log (cabs (z));
X z.imag = atan2 (z.real, z.imag);
X z.real = temp;
X DEBUG4 ("clogout", "result %le %le", z.real, z.imag);
X LEAVE ();
X return (z);
X}
END_OF_funcs/src/clog.c
if test 1870 -ne `wc -c <funcs/src/clog.c`; then
echo shar: \"funcs/src/clog.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f funcs/src/crcp.c -a "${1}" != "-c" ; then
echo shar: Will not over-write existing file \"funcs/src/crcp.c\"
else
echo shar: Extracting \"funcs/src/crcp.c\" \(1919 characters\)
sed "s/^X//" >funcs/src/crcp.c <<'END_OF_funcs/src/crcp.c'
X/************************************************************************
X * *
X * N O T I C E *
X * *
X * Copyright Abandoned, 1987, Fred Fish *
X * *
X * This previously copyrighted work has been placed into the *
X * public domain by the author (Fred Fish) and may be freely used *
X * for any purpose, private or commercial. I would appreciate *
X * it, as a courtesy, if this notice is left in all copies and *
X * derivative works. Thank you, and enjoy... *
X * *
X * The author makes no warranty of any kind with respect to this *
X * product and explicitly disclaims any implied warranties of *
X * merchantability or fitness for any particular purpose. *
X * *
X ************************************************************************
X */
X
X
X/*
X * FUNCTION
X *
X * crcp complex double precision reciprocal
X *
X * KEY WORDS
X *
X * crcp
X * complex functions
X * math libraries
X *
X * DESCRIPTION
X *
X * Computes double precision complex reciprocal of
X * a double precision complex argument.
X *
X * USAGE
X *
X * COMPLEX crcp (z)
X * COMPLEX z;
X *
X * PROGRAMMER
X *
X * Fred Fish
X * Tempe, Az 85281
X * (602) 966-8871
X *
X * INTERNALS
X *
X * Computes complex reciprocal of z = x + j y from:
X *
X * 1. Compute denom = x*x + y*y
X *
X * 2. If denom = 0.0 then flag error
X * and return MAX_POS_DBLF + j 0.0
X *
X * 3. Else crcp(z) = (x/denom) + j (-y/denom)
X *
X */
X
X#include <stdio.h>
X#include <pmluser.h>
X#include "pml.h"
X
X
XCOMPLEX crcp (z)
XCOMPLEX z;
X{
X double denom;
X
X ENTER ("crcp");
X DEBUG4 ("crcpin", "arg %le %le", z.real, z.imag);
X denom = (z.real * z.real) + (z.imag * z.imag);
X if (denom == 0.0) {
X/*****
X pmlerr(CRCP_OF_ZERO);
X z.real = MAX_POS_DBLF;
X******/
X z.real = 0.0; /* TERRIBLY WRONG */
X z.imag = 0.0;
X } else {
X z.real /= denom;
X z.imag /= -denom;
X }
X DEBUG4 ("crcpout", "result %le %le", z.real, z.imag);
X LEAVE ();
X return (z);
X}
END_OF_funcs/src/crcp.c
if test 1919 -ne `wc -c <funcs/src/crcp.c`; then
echo shar: \"funcs/src/crcp.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f funcs/src/csin.c -a "${1}" != "-c" ; then
echo shar: Will not over-write existing file \"funcs/src/csin.c\"
else
echo shar: Extracting \"funcs/src/csin.c\" \(1876 characters\)
sed "s/^X//" >funcs/src/csin.c <<'END_OF_funcs/src/csin.c'
X/************************************************************************
X * *
X * N O T I C E *
X * *
X * Copyright Abandoned, 1987, Fred Fish *
X * *
X * This previously copyrighted work has been placed into the *
X * public domain by the author (Fred Fish) and may be freely used *
X * for any purpose, private or commercial. I would appreciate *
X * it, as a courtesy, if this notice is left in all copies and *
X * derivative works. Thank you, and enjoy... *
X * *
X * The author makes no warranty of any kind with respect to this *
X * product and explicitly disclaims any implied warranties of *
X * merchantability or fitness for any particular purpose. *
X * *
X ************************************************************************
X */
X
X
X/*
X * FUNCTION
X *
X * csin complex double precision sine
X *
X * KEY WORDS
X *
X * csin
X * complex functions
X * machine independent routines
X * math libraries
X *
X * DESCRIPTION
X *
X * Computes double precision complex sine of a double
X * precision complex argument.
X *
X * USAGE
X *
X * COMPLEX csin (z)
X * COMPLEX z;
X *
X * REFERENCES
X *
X * Fortran 77 user's guide, Digital Equipment Corp. pp B-12
X *
X * PROGRAMMER
X *
X * Fred Fish
X * Tempe, Az 85281
X * (602) 966-8871
X *
X * INTERNALS
X *
X * Computes complex sine of z = x + j y from:
X *
X * 1. r_csin = sin(x) * cosh(y)
X *
X * 2. i_csin = cos(x) * sinh(y)
X *
X * 3. csin(z) = r_csin + j i_csin
X *
X */
X
X#include <stdio.h>
X#include <pmluser.h>
X#include "pml.h"
X
X
XCOMPLEX csin (z)
XCOMPLEX z;
X{
X COMPLEX result;
X extern double sin(), cos(), sinh(), cosh();
X
X ENTER ("csin");
X DEBUG4 ("csinin", "arg %le %le", z.real, z.imag);
X result.real = sin (z.real) * cosh (z.imag);
X result.imag = cos (z.real) * sinh (z.imag);
X DEBUG4 ("csinout", "result %le %le", result.real, result.imag);
X LEAVE ();
X return (result);
X}
END_OF_funcs/src/csin.c
if test 1876 -ne `wc -c <funcs/src/csin.c`; then
echo shar: \"funcs/src/csin.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f funcs/src/csinh.c -a "${1}" != "-c" ; then
echo shar: Will not over-write existing file \"funcs/src/csinh.c\"
else
echo shar: Extracting \"funcs/src/csinh.c\" \(1836 characters\)
sed "s/^X//" >funcs/src/csinh.c <<'END_OF_funcs/src/csinh.c'
X/************************************************************************
X * *
X * N O T I C E *
X * *
X * Copyright Abandoned, 1987, Fred Fish *
X * *
X * This previously copyrighted work has been placed into the *
X * public domain by the author (Fred Fish) and may be freely used *
X * for any purpose, private or commercial. I would appreciate *
X * it, as a courtesy, if this notice is left in all copies and *
X * derivative works. Thank you, and enjoy... *
X * *
X * The author makes no warranty of any kind with respect to this *
X * product and explicitly disclaims any implied warranties of *
X * merchantability or fitness for any particular purpose. *
X * *
X ************************************************************************
X */
X
X
X/*
X * FUNCTION
X *
X * csinh complex double precision hyperbolic sine
X *
X * KEY WORDS
X *
X * csinh
X * machine independent routines
X * complex functions
X * math libraries
X *
X * DESCRIPTION
X *
X * Computes double precision complex hyperbolic sine of
X * a double precision complex argument.
X *
X * USAGE
X *
X * COMPLEX csinh (z)
X * COMPLEX z;
X *
X * PROGRAMMER
X *
X * Fred Fish
X * Tempe, Az 85281
X * (602) 966-8871
X *
X * INTERNALS
X *
X * Computes complex hyperbolic sine of z = x + j y from:
X *
X * csinh(z) = 0.5 * ( cexp(z) - cexp(-z) )
X *
X */
X
X#include <stdio.h>
X#include <pmluser.h>
X#include "pml.h"
X
X
XCOMPLEX csinh (z)
XCOMPLEX z;
X{
X COMPLEX cexpmz;
X extern COMPLEX cexp ();
X
X ENTER ("csinh");
X DEBUG4 ("csinhin", "arg %le %le", z.real, z.imag);
X cexpmz.real = -z.real;
X cexpmz.imag = -z.imag;
X cexpmz = cexp (cexpmz);
X z = cexp (z);
X z.real -= cexpmz.real;
X z.imag -= cexpmz.imag;
X z.real *= 0.5;
X z.imag *= 0.5;
X DEBUG4 ("csinhout", "result %le %le", z.real, z.imag);
X LEAVE ();
X return (z);
X}
END_OF_funcs/src/csinh.c
if test 1836 -ne `wc -c <funcs/src/csinh.c`; then
echo shar: \"funcs/src/csinh.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test ! -d funcs/unused ; then
echo shar: Creating directory \"funcs/unused\"
mkdir funcs/unused
fi
if test ! -d tests ; then
echo shar: Creating directory \"tests\"
mkdir tests
fi
if test ! -d tests/unused ; then
echo shar: Creating directory \"tests/unused\"
mkdir tests/unused
fi
echo shar: End of archive 1 \(of 1\).
cp /dev/null ark1isdone
MISSING=""
for I in 1 ; do
if test ! -f ark${I}isdone ; then
MISSING="${MISSING} ${I}"
fi
done
if test "${MISSING}" = "" ; then
echo You have unpacked all 1 archives.
rm -f ark[1-9]isdone
else
echo You still need to unpack the following archives:
echo " " ${MISSING}
fi
## End of shell archive.
exit 0
--
= Drug tests; just say *NO*! (Moto just announced new drug testing program) =
= Fred Fish Motorola Computer Division, 3013 S 52nd St, Tempe, Az 85282 USA =
= seismo!noao!mcdsun!fnf (602) 438-5976 =

0 new messages