⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 libf77

📁 把fortran语言编的程序转为c语言编的程序, 运行环境linux
💻
📖 第 1 页 / 共 5 页
字号:
# to unbundle, sh this file (in an empty directory)mkdir libF77echo libF77/Notice 1>&2sed >libF77/Notice <<'//GO.SYSIN DD libF77/Notice' 's/^-//'-/****************************************************************-Copyright 1990, 1991, 1992, 1993 by AT&T Bell Laboratories and Bellcore.--Permission to use, copy, modify, and distribute this software-and its documentation for any purpose and without fee is hereby-granted, provided that the above copyright notice appear in all-copies and that both that the copyright notice and this-permission notice and warranty disclaimer appear in supporting-documentation, and that the names of AT&T Bell Laboratories or-Bellcore or any of their entities not be used in advertising or-publicity pertaining to distribution of the software without-specific, written prior permission.--AT&T and Bellcore disclaim all warranties with regard to this-software, including all implied warranties of merchantability-and fitness.  In no event shall AT&T or Bellcore be liable for-any special, indirect or consequential damages or any damages-whatsoever resulting from loss of use, data or profits, whether-in an action of contract, negligence or other tortious action,-arising out of or in connection with the use or performance of-this software.-****************************************************************/-//GO.SYSIN DD libF77/Noticeecho libF77/README 1>&2sed >libF77/README <<'//GO.SYSIN DD libF77/README' 's/^-//'-If your compiler does not recognize ANSI C headers,-compile with KR_headers defined:  either add -DKR_headers-to the definition of CFLAGS in the makefile, or insert--#define KR_headers--at the top of f2c.h , cabs.c , main.c , and sig_die.c .--Under MS-DOS, compile s_paus.c with -DMSDOS.--If you have a really ancient K&R C compiler that does not understand-void, add -Dvoid=int to the definition of CFLAGS in the makefile.--If you use a C++ compiler, first create a local f2c.h by appending-f2ch.add to the usual f2c.h, e.g., by issuing the command-	make f2c.h-which assumes f2c.h is installed in /usr/include .--If your system lacks onexit() and you are not using an ANSI C-compiler, then you should compile main.c, s_paus.c, s_stop.c, and-sig_die.c with NO_ONEXIT defined.  See the comments about onexit in-the makefile.--If your system has a double drem() function such that drem(a,b)-is the IEEE remainder function (with double a, b), then you may-wish to compile r_mod.c and d_mod.c with IEEE_drem defined.-On some systems, you may also need to compile with -Ddrem=remainder .--To check for transmission errors, issue the command-	make check-This assumes you have the xsum program whose source, xsum.c,-is distributed as part of "all from f2c/src".  If you do not-have xsum, you can obtain xsum.c by sending the following E-mail-message to netlib@research.att.com-	send xsum.c from f2c/src--The makefile assumes you have installed f2c.h in a standard-place (and does not cause recompilation when f2c.h is changed);-f2c.h comes with "all from f2c" (the source for f2c) and is-available separately ("f2c.h from f2c").--Most of the routines in libF77 are support routines for Fortran-intrinsic functions or for operations that f2c chooses not-to do "in line".  There are a few exceptions, summarized below ---functions and subroutines that appear to your program as ordinary-external Fortran routines.--1.	CALL ABORT prints a message and causes a core dump.--2.	ERF(r) and DERF(d) and the REAL and DOUBLE PRECISION-	error functions (with x REAL and d DOUBLE PRECISION);-	DERF must be declared DOUBLE PRECISION in your program.-	Both ERF and DERF assume your C library provides the-	underlying erf() function (which not all systems do).--3.	ERFC(r) and DERFC(d) are the complementary error functions:-	ERFC(r) = 1 - ERF(r) and DERFC(d) = 1.d0 - DERFC(d)-	(except that their results may be more accurate than-	explicitly evaluating the above formulae would give).-	Again, ERFC and r are REAL, and DERFC and d are DOUBLE-	PRECISION (and must be declared as such in your program),-	and ERFC and DERFC rely on your system's erfc().--4.	CALL GETARG(n,s), where n is an INTEGER and s is a CHARACTER-	variable, sets s to the n-th command-line argument (or to-	all blanks if there are fewer than n command-line arguments);-	CALL GETARG(0,s) sets s to the name of the program (on systems-	that support this feature).  See IARGC below.--5.	CALL GETENV(name, value), where name and value are of type-	CHARACTER, sets value to the environment value, $name, of-	name (or to blanks if $name has not been set).--6.	NARGS = IARGC() sets NARGS to the number of command-line-	arguments (an INTEGER value).--7.	CALL SIGNAL(n,func), where n is an INTEGER and func is an-	EXTERNAL procedure, arranges for func to be invoked when-	signal n occurs (on systems where this makes sense).--8.	CALL SYSTEM(cmd), where cmd is of type CHARACTER, passes-	cmd to the system's command processor (on systems where-	this can be done).--The makefile does not attempt to compile pow_qq.c, which is meant-for use with INTEGER*8.  To use it, you must modify f2c.h to-declare longint appropriately; then add pow_qq.o to the POW =-line in the makefile.--If you wish to allow the target of a (character string) concatenation-to be appear on its right-hand (at the cost of extra overhead for-all run-time concatenations), change "s_cat.o" to "s_catow.o" in-the makefile.  Note that the Fortran 77 Standard explicitly forbids-the target of a concatenation from appearing on its right-hand side.//GO.SYSIN DD libF77/READMEecho libF77/Version.c 1>&2sed >libF77/Version.c <<'//GO.SYSIN DD libF77/Version.c' 's/^-//'-static char junk[] = "\n@(#)LIBF77 VERSION 2.01 12 Jan. 1995\n";--/*-2.00	11 June 1980.  File version.c added to library.-2.01	31 May 1988.  s_paus() flushes stderr; names of hl_* fixed-	[ d]erf[c ] added-	 8 Aug. 1989: #ifdefs for f2c -i2 added to s_cat.c-	29 Nov. 1989: s_cmp returns long (for f2c)-	30 Nov. 1989: arg types from f2c.h-	12 Dec. 1989: s_rnge allows long names-	19 Dec. 1989: getenv_ allows unsorted environment-	28 Mar. 1990: add exit(0) to end of main()-	 2 Oct. 1990: test signal(...) == SIG_IGN rather than & 01 in main-	17 Oct. 1990: abort() calls changed to sig_die(...,1)-	22 Oct. 1990: separate sig_die from main-	25 Apr. 1991: minor, theoretically invisible tweaks to s_cat, sig_die-	31 May  1991: make system_ return status-	18 Dec. 1991: change long to ftnlen (for -i2) many places-	28 Feb. 1992: repair z_sqrt.c (scribbled on input, gave wrong answer)-	18 July 1992: for n < 0, repair handling of 0**n in pow_[dr]i.c-			and m**n in pow_hh.c and pow_ii.c;-			catch SIGTRAP in main() for error msg before abort-	23 July 1992: switch to ANSI prototypes unless KR_headers is #defined-	23 Oct. 1992: fix botch in signal_.c (erroneous deref of 2nd arg);-			change Cabs to f__cabs.-	12 March 1993: various tweaks for C++-	 2 June 1994: adjust so abnormal terminations invoke f_exit just once-	16 Sept. 1994: s_cmp: treat characters as unsigned in comparisons.-	19 Sept. 1994: s_paus: flush after end of PAUSE; add -DMSDOS-	12 Jan. 1995:	pow_[dhiqrz][hiq]: adjust x**i to work on machines-			that sign-extend right shifts when i is the most-			negative integer.-*///GO.SYSIN DD libF77/Version.cecho libF77/abort_.c 1>&2sed >libF77/abort_.c <<'//GO.SYSIN DD libF77/abort_.c' 's/^-//'-#include "stdio.h"-#include "f2c.h"--#ifdef KR_headers-extern VOID sig_die();--int abort_()-#else-extern void sig_die(char*,int);--int abort_(void)-#endif-{-sig_die("Fortran abort routine called", 1);-#ifdef __cplusplus-return 0;-#endif-}//GO.SYSIN DD libF77/abort_.cecho libF77/c_abs.c 1>&2sed >libF77/c_abs.c <<'//GO.SYSIN DD libF77/c_abs.c' 's/^-//'-#include "f2c.h"--#ifdef KR_headers-extern double f__cabs();--double c_abs(z) complex *z;-#else-extern double f__cabs(double, double);--double c_abs(complex *z)-#endif-{-return( f__cabs( z->r, z->i ) );-}//GO.SYSIN DD libF77/c_abs.cecho libF77/c_cos.c 1>&2sed >libF77/c_cos.c <<'//GO.SYSIN DD libF77/c_cos.c' 's/^-//'-#include "f2c.h"--#ifdef KR_headers-extern double sin(), cos(), sinh(), cosh();--VOID c_cos(r, z) complex *r, *z;-#else-#undef abs-#include "math.h"--void c_cos(complex *r, complex *z)-#endif-{-r->r = cos(z->r) * cosh(z->i);-r->i = - sin(z->r) * sinh(z->i);-}//GO.SYSIN DD libF77/c_cos.cecho libF77/c_div.c 1>&2sed >libF77/c_div.c <<'//GO.SYSIN DD libF77/c_div.c' 's/^-//'-#include "f2c.h"--#ifdef KR_headers-extern VOID sig_die();-VOID c_div(c, a, b)-complex *a, *b, *c;-#else-extern void sig_die(char*,int);-void c_div(complex *c, complex *a, complex *b)-#endif-{-double ratio, den;-double abr, abi;--if( (abr = b->r) < 0.)-	abr = - abr;-if( (abi = b->i) < 0.)-	abi = - abi;-if( abr <= abi )-	{-	if(abi == 0)-		sig_die("complex division by zero", 1);-	ratio = (double)b->r / b->i ;-	den = b->i * (1 + ratio*ratio);-	c->r = (a->r*ratio + a->i) / den;-	c->i = (a->i*ratio - a->r) / den;-	}--else-	{-	ratio = (double)b->i / b->r ;-	den = b->r * (1 + ratio*ratio);-	c->r = (a->r + a->i*ratio) / den;-	c->i = (a->i - a->r*ratio) / den;-	}-}//GO.SYSIN DD libF77/c_div.cecho libF77/c_exp.c 1>&2sed >libF77/c_exp.c <<'//GO.SYSIN DD libF77/c_exp.c' 's/^-//'-#include "f2c.h"--#ifdef KR_headers-extern double exp(), cos(), sin();-- VOID c_exp(r, z) complex *r, *z;-#else-#undef abs-#include "math.h"--void c_exp(complex *r, complex *z)-#endif-{-double expx;--expx = exp(z->r);-r->r = expx * cos(z->i);-r->i = expx * sin(z->i);-}//GO.SYSIN DD libF77/c_exp.cecho libF77/c_log.c 1>&2sed >libF77/c_log.c <<'//GO.SYSIN DD libF77/c_log.c' 's/^-//'-#include "f2c.h"--#ifdef KR_headers-extern double log(), f__cabs(), atan2();-VOID c_log(r, z) complex *r, *z;-#else-#undef abs-#include "math.h"-extern double f__cabs(double, double);--void c_log(complex *r, complex *z)-#endif-{-r->i = atan2(z->i, z->r);-r->r = log( f__cabs(z->r, z->i) );-}//GO.SYSIN DD libF77/c_log.cecho libF77/c_sin.c 1>&2sed >libF77/c_sin.c <<'//GO.SYSIN DD libF77/c_sin.c' 's/^-//'-#include "f2c.h"--#ifdef KR_headers-extern double sin(), cos(), sinh(), cosh();--VOID c_sin(r, z) complex *r, *z;-#else-#undef abs-#include "math.h"--void c_sin(complex *r, complex *z)-#endif-{-r->r = sin(z->r) * cosh(z->i);-r->i = cos(z->r) * sinh(z->i);-}//GO.SYSIN DD libF77/c_sin.cecho libF77/c_sqrt.c 1>&2sed >libF77/c_sqrt.c <<'//GO.SYSIN DD libF77/c_sqrt.c' 's/^-//'-#include "f2c.h"--#ifdef KR_headers-extern double sqrt(), f__cabs();--VOID c_sqrt(r, z) complex *r, *z;-#else-#undef abs-#include "math.h"-extern double f__cabs(double, double);--void c_sqrt(complex *r, complex *z)-#endif-{-double mag, t;--if( (mag = f__cabs(z->r, z->i)) == 0.)-	r->r = r->i = 0.;-else if(z->r > 0)-	{-	r->r = t = sqrt(0.5 * (mag + z->r) );-	t = z->i / t;-	r->i = 0.5 * t;-	}-else-	{-	t = sqrt(0.5 * (mag - z->r) );-	if(z->i < 0)-		t = -t;-	r->i = t;-	t = z->i / t;-	r->r = 0.5 * t;-	}-}//GO.SYSIN DD libF77/c_sqrt.cecho libF77/cabs.c 1>&2sed >libF77/cabs.c <<'//GO.SYSIN DD libF77/cabs.c' 's/^-//'-#ifdef KR_headers-extern double sqrt();-double f__cabs(real, imag) double real, imag;-#else-#undef abs-#include "math.h"-double f__cabs(double real, double imag)-#endif-{-double temp;--if(real < 0)-	real = -real;-if(imag < 0)-	imag = -imag;-if(imag > real){-	temp = real;-	real = imag;-	imag = temp;-}-if((real+imag) == real)-	return(real);--temp = imag/real;-temp = real*sqrt(1.0 + temp*temp);  /*overflow!!*/-return(temp);-}//GO.SYSIN DD libF77/cabs.cecho libF77/d_abs.c 1>&2sed >libF77/d_abs.c <<'//GO.SYSIN DD libF77/d_abs.c' 's/^-//'-#include "f2c.h"--#ifdef KR_headers-double d_abs(x) doublereal *x;-#else-double d_abs(doublereal *x)-#endif-{-if(*x >= 0)-	return(*x);-return(- *x);-}//GO.SYSIN DD libF77/d_abs.cecho libF77/d_acos.c 1>&2sed >libF77/d_acos.c <<'//GO.SYSIN DD libF77/d_acos.c' 's/^-//'-#include "f2c.h"--#ifdef KR_headers-double acos();-double d_acos(x) doublereal *x;-#else-#undef abs-#include "math.h"-double d_acos(doublereal *x)-#endif-{-return( acos(*x) );-}//GO.SYSIN DD libF77/d_acos.cecho libF77/d_asin.c 1>&2sed >libF77/d_asin.c <<'//GO.SYSIN DD libF77/d_asin.c' 's/^-//'-#include "f2c.h"--#ifdef KR_headers-double asin();-double d_asin(x) doublereal *x;-#else-#undef abs-#include "math.h"-double d_asin(doublereal *x)-#endif-{-return( asin(*x) );-}//GO.SYSIN DD libF77/d_asin.cecho libF77/d_atan.c 1>&2sed >libF77/d_atan.c <<'//GO.SYSIN DD libF77/d_atan.c' 's/^-//'-#include "f2c.h"--#ifdef KR_headers-double atan();-double d_atan(x) doublereal *x;-#else-#undef abs-#include "math.h"-double d_atan(doublereal *x)-#endif-{-return( atan(*x) );-}//GO.SYSIN DD libF77/d_atan.cecho libF77/d_atn2.c 1>&2sed >libF77/d_atn2.c <<'//GO.SYSIN DD libF77/d_atn2.c' 's/^-//'-#include "f2c.h"--#ifdef KR_headers-double atan2();-double d_atn2(x,y) doublereal *x, *y;-#else-#undef abs-#include "math.h"-double d_atn2(doublereal *x, doublereal *y)-#endif-{-return( atan2(*x,*y) );-}//GO.SYSIN DD libF77/d_atn2.cecho libF77/d_cnjg.c 1>&2sed >libF77/d_cnjg.c <<'//GO.SYSIN DD libF77/d_cnjg.c' 's/^-//'-#include "f2c.h"-- VOID-#ifdef KR_headers-d_cnjg(r, z) doublecomplex *r, *z;-#else-d_cnjg(doublecomplex *r, doublecomplex *z)-#endif-{-r->r = z->r;-r->i = - z->i;-}//GO.SYSIN DD libF77/d_cnjg.cecho libF77/d_cos.c 1>&2sed >libF77/d_cos.c <<'//GO.SYSIN DD libF77/d_cos.c' 's/^-//'-#include "f2c.h"--#ifdef KR_headers-double cos();-double d_cos(x) doublereal *x;-#else-#undef abs-#include "math.h"-double d_cos(doublereal *x)-#endif-{-return( cos(*x) );-}//GO.SYSIN DD libF77/d_cos.cecho libF77/d_cosh.c 1>&2sed >libF77/d_cosh.c <<'//GO.SYSIN DD libF77/d_cosh.c' 's/^-//'-#include "f2c.h"--#ifdef KR_headers-double cosh();-double d_cosh(x) doublereal *x;-#else-#undef abs-#include "math.h"-double d_cosh(doublereal *x)-#endif-{-return( cosh(*x) );-}//GO.SYSIN DD libF77/d_cosh.cecho libF77/d_dim.c 1>&2sed >libF77/d_dim.c <<'//GO.SYSIN DD libF77/d_dim.c' 's/^-//'-#include "f2c.h"--#ifdef KR_headers-double d_dim(a,b) doublereal *a, *b;-#else-double d_dim(doublereal *a, doublereal *b)-#endif-{-return( *a > *b ? *a - *b : 0);-}//GO.SYSIN DD libF77/d_dim.cecho libF77/d_exp.c 1>&2sed >libF77/d_exp.c <<'//GO.SYSIN DD libF77/d_exp.c' 's/^-//'-#include "f2c.h"--#ifdef KR_headers-double exp();-double d_exp(x) doublereal *x;-#else-#undef abs-#include "math.h"-double d_exp(doublereal *x)-#endif-{-return( exp(*x) );-}//GO.SYSIN DD libF77/d_exp.cecho libF77/d_imag.c 1>&2sed >libF77/d_imag.c <<'//GO.SYSIN DD libF77/d_imag.c' 's/^-//'-#include "f2c.h"--#ifdef KR_headers-double d_imag(z) doublecomplex *z;-#else-double d_imag(doublecomplex *z)-#endif-{-return(z->i);-}//GO.SYSIN DD libF77/d_imag.cecho libF77/d_int.c 1>&2sed >libF77/d_int.c <<'//GO.SYSIN DD libF77/d_int.c' 's/^-//'-#include "f2c.h"--#ifdef KR_headers-double floor();-double d_int(x) doublereal *x;-#else-#undef abs-#include "math.h"-double d_int(doublereal *x)-#endif-{-return( (*x>0) ? floor(*x) : -floor(- *x) );-}//GO.SYSIN DD libF77/d_int.cecho libF77/d_lg10.c 1>&2sed >libF77/d_lg10.c <<'//GO.SYSIN DD libF77/d_lg10.c' 's/^-//'-#include "f2c.h"--#define log10e 0.43429448190325182765--#ifdef KR_headers

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -