Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watmath!clyde!cbatt!ihnp4!ptsfa!styx!ames!sri-spam!sri-unix!husc6!uwvax!oddjob!hao!noao!mcdsun!fnf From: fnf@mcdsun.UUCP Newsgroups: net.sources Subject: Portable Math Library (Part 1a of 6 REPOST) Message-ID: <306@mcdsun.UUCP> Date: Wed, 29-Apr-87 17:09:39 EDT Article-I.D.: mcdsun.306 Posted: Wed Apr 29 17:09:39 1987 Date-Received: Sat, 2-May-87 01:23:21 EDT Organization: Motorola Microcomputer Division, Tempe, Az. Lines: 1483 Keywords: was truncated 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 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 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/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/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.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/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.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/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.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/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" 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/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 X#include 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/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 X#include 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/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 X#include 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/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 X#include 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/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 X#include 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/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 X#include 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/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 X#include 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/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 X#include 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/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 X#include 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/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 X#include 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/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 X#include 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