diff options
author | obrien <obrien@FreeBSD.org> | 2001-12-18 04:13:58 +0000 |
---|---|---|
committer | obrien <obrien@FreeBSD.org> | 2001-12-18 04:13:58 +0000 |
commit | 831bff53656079693b62da2cf232523cf6e1ab9a (patch) | |
tree | f6d8eb29c087fffa30708c88073309756adc5fd4 /contrib/libf2c/libF77 | |
parent | d76fbe2f80d191c5c6f7ad7ebc39c5a369908a22 (diff) | |
download | FreeBSD-src-831bff53656079693b62da2cf232523cf6e1ab9a.zip FreeBSD-src-831bff53656079693b62da2cf232523cf6e1ab9a.tar.gz |
Virgin import of GCC 3.0.2's libf2c
Diffstat (limited to 'contrib/libf2c/libF77')
-rw-r--r-- | contrib/libf2c/libF77/Version.c | 15 | ||||
-rwxr-xr-x | contrib/libf2c/libF77/configure | 135 | ||||
-rw-r--r-- | contrib/libf2c/libF77/configure.in | 5 | ||||
-rw-r--r-- | contrib/libf2c/libF77/dtime_.c | 4 | ||||
-rw-r--r-- | contrib/libf2c/libF77/etime_.c | 3 | ||||
-rw-r--r-- | contrib/libf2c/libF77/s_cat.c | 4 | ||||
-rw-r--r-- | contrib/libf2c/libF77/z_log.c | 47 |
7 files changed, 117 insertions, 96 deletions
diff --git a/contrib/libf2c/libF77/Version.c b/contrib/libf2c/libF77/Version.c index a1cb51f..ad367f4 100644 --- a/contrib/libf2c/libF77/Version.c +++ b/contrib/libf2c/libF77/Version.c @@ -1,9 +1,9 @@ -static char junk[] = "\n@(#)LIBF77 VERSION 19991115\n"; +static char junk[] = "\n@(#)LIBF77 VERSION 20000929\n"; /* */ -char __G77_LIBF77_VERSION__[] = "0.5.26 20000711 (prerelease)"; +char __G77_LIBF77_VERSION__[] = "0.5.26 20011023 (release)"; /* 2.00 11 June 1980. File version.c added to library. @@ -69,6 +69,17 @@ char __G77_LIBF77_VERSION__[] = "0.5.26 20000711 (prerelease)"; also vanishes or not. VERSION not changed. 15 Nov. 1999: s_rnge.c: add casts for the case of sizeof(ftnint) == sizeof(int) < sizeof(long). + 10 March 2000: z_log.c: improve accuracy of Real(log(z)) for, e.g., + z near (+-1,eps) with |eps| small. For the old + evaluation, compile with -DPre20000310 . + 20 April 2000: s_cat.c: tweak argument types to accord with + calls by f2c when ftnint and ftnlen are of + different sizes (different numbers of bits). + 4 July 2000: adjustments to permit compilation by C++ compilers; + VERSION string remains unchanged. NOT APPLIED FOR G77. + 29 Sept. 2000: dtime_.c, etime_.c: use floating-point divide. + dtime_.d, erf_.c, erfc_.c, etime.c: for use with + "f2c -R", compile with -DREAL=float. */ #include <stdio.h> diff --git a/contrib/libf2c/libF77/configure b/contrib/libf2c/libF77/configure index b4ea9f3..9017e83 100755 --- a/contrib/libf2c/libF77/configure +++ b/contrib/libf2c/libF77/configure @@ -522,12 +522,15 @@ fi + + + # For g77 we'll set CC to point at the built gcc, but this will get it into # the makefiles # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:531: checking for $ac_word" >&5 +echo "configure:534: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -557,7 +560,7 @@ if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:561: checking for $ac_word" >&5 +echo "configure:564: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -608,7 +611,7 @@ fi # Extract the first word of "cl", so it can be a program name with args. set dummy cl; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:612: checking for $ac_word" >&5 +echo "configure:615: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -639,55 +642,9 @@ fi test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } fi -echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:644: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 - -ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross - -cat > conftest.$ac_ext << EOF - -#line 655 "configure" -#include "confdefs.h" - -main(){return(0);} -EOF -if { (eval echo configure:660: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - ac_cv_prog_cc_works=yes - # If we can't run a trivial program, we are probably using a cross compiler. - if (./conftest; exit) 2>/dev/null; then - ac_cv_prog_cc_cross=no - else - ac_cv_prog_cc_cross=yes - fi -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - ac_cv_prog_cc_works=no -fi -rm -fr conftest* -ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross - -echo "$ac_t""$ac_cv_prog_cc_works" 1>&6 -if test $ac_cv_prog_cc_works = no; then - { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } -fi -echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:686: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 -echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 -cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:691: checking whether we are using GNU C" >&5 +echo "configure:648: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -696,7 +653,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:700: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:657: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -715,7 +672,7 @@ ac_test_CFLAGS="${CFLAGS+set}" ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:719: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:676: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -750,7 +707,7 @@ fi test "$AR" || AR=ar echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 -echo "configure:754: checking whether ${MAKE-make} sets \${MAKE}" >&5 +echo "configure:711: checking whether ${MAKE-make} sets \${MAKE}" >&5 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -780,7 +737,7 @@ fi # Sanity check for the cross-compilation case: echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:784: checking how to run the C preprocessor" >&5 +echo "configure:741: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -795,13 +752,13 @@ else # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext <<EOF -#line 799 "configure" +#line 756 "configure" #include "confdefs.h" #include <assert.h> Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:805: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:762: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -812,13 +769,13 @@ else rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext <<EOF -#line 816 "configure" +#line 773 "configure" #include "confdefs.h" #include <assert.h> Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:822: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:779: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -829,13 +786,13 @@ else rm -rf conftest* CPP="${CC-cc} -nologo -E" cat > conftest.$ac_ext <<EOF -#line 833 "configure" +#line 790 "configure" #include "confdefs.h" #include <assert.h> Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:839: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:796: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -861,17 +818,17 @@ echo "$ac_t""$CPP" 1>&6 ac_safe=`echo "stdio.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for stdio.h""... $ac_c" 1>&6 -echo "configure:865: checking for stdio.h" >&5 +echo "configure:822: checking for stdio.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 870 "configure" +#line 827 "configure" #include "confdefs.h" #include <stdio.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:875: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:832: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -899,12 +856,12 @@ fi echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:903: checking for ANSI C header files" >&5 +echo "configure:860: checking for ANSI C header files" >&5 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 908 "configure" +#line 865 "configure" #include "confdefs.h" #include <stdlib.h> #include <stdarg.h> @@ -912,7 +869,7 @@ else #include <float.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:916: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:873: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -929,7 +886,7 @@ rm -f conftest* if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext <<EOF -#line 933 "configure" +#line 890 "configure" #include "confdefs.h" #include <string.h> EOF @@ -947,7 +904,7 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat > conftest.$ac_ext <<EOF -#line 951 "configure" +#line 908 "configure" #include "confdefs.h" #include <stdlib.h> EOF @@ -968,7 +925,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext <<EOF -#line 972 "configure" +#line 929 "configure" #include "confdefs.h" #include <ctype.h> #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -979,7 +936,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF -if { (eval echo configure:983: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:940: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else @@ -1004,12 +961,12 @@ fi echo $ac_n "checking for posix""... $ac_c" 1>&6 -echo "configure:1008: checking for posix" >&5 +echo "configure:965: checking for posix" >&5 if eval "test \"`echo '$''{'g77_cv_header_posix'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1013 "configure" +#line 970 "configure" #include "confdefs.h" #include <sys/types.h> #include <unistd.h> @@ -1035,12 +992,12 @@ echo "$ac_t""$g77_cv_header_posix" 1>&6 # We can rely on the GNU library being posix-ish. I guess checking the # header isn't actually like checking the functions, though... echo $ac_n "checking for GNU library""... $ac_c" 1>&6 -echo "configure:1039: checking for GNU library" >&5 +echo "configure:996: checking for GNU library" >&5 if eval "test \"`echo '$''{'g77_cv_lib_gnu'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1044 "configure" +#line 1001 "configure" #include "confdefs.h" #include <stdio.h> #ifdef __GNU_LIBRARY__ @@ -1063,12 +1020,12 @@ fi echo "$ac_t""$g77_cv_lib_gnu" 1>&6 echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6 -echo "configure:1067: checking return type of signal handlers" >&5 +echo "configure:1024: checking return type of signal handlers" >&5 if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1072 "configure" +#line 1029 "configure" #include "confdefs.h" #include <sys/types.h> #include <signal.h> @@ -1085,7 +1042,7 @@ int main() { int i; ; return 0; } EOF -if { (eval echo configure:1089: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1046: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_type_signal=void else @@ -1106,12 +1063,12 @@ EOF # we'll get atexit by default if test $ac_cv_header_stdc != yes; then echo $ac_n "checking for atexit""... $ac_c" 1>&6 -echo "configure:1110: checking for atexit" >&5 +echo "configure:1067: checking for atexit" >&5 if eval "test \"`echo '$''{'ac_cv_func_atexit'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1115 "configure" +#line 1072 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char atexit(); below. */ @@ -1134,7 +1091,7 @@ atexit(); ; return 0; } EOF -if { (eval echo configure:1138: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1095: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_atexit=yes" else @@ -1159,12 +1116,12 @@ else EOF echo $ac_n "checking for onexit""... $ac_c" 1>&6 -echo "configure:1163: checking for onexit" >&5 +echo "configure:1120: checking for onexit" >&5 if eval "test \"`echo '$''{'ac_cv_func_onexit'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1168 "configure" +#line 1125 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char onexit(); below. */ @@ -1187,7 +1144,7 @@ onexit(); ; return 0; } EOF -if { (eval echo configure:1191: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1148: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_onexit=yes" else @@ -1205,12 +1162,12 @@ if eval "test \"`echo '$ac_cv_func_'onexit`\" = yes"; then else echo "$ac_t""no" 1>&6 echo $ac_n "checking for on_exit""... $ac_c" 1>&6 -echo "configure:1209: checking for on_exit" >&5 +echo "configure:1166: checking for on_exit" >&5 if eval "test \"`echo '$''{'ac_cv_func_on_exit'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1214 "configure" +#line 1171 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char on_exit(); below. */ @@ -1233,7 +1190,7 @@ on_exit(); ; return 0; } EOF -if { (eval echo configure:1237: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1194: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_on_exit=yes" else @@ -1263,7 +1220,7 @@ else true fi echo $ac_n "checking for drem in -lm""... $ac_c" 1>&6 -echo "configure:1267: checking for drem in -lm" >&5 +echo "configure:1224: checking for drem in -lm" >&5 ac_lib_var=`echo m'_'drem | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1271,7 +1228,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lm $LIBS" cat > conftest.$ac_ext <<EOF -#line 1275 "configure" +#line 1232 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -1282,7 +1239,7 @@ int main() { drem() ; return 0; } EOF -if { (eval echo configure:1286: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1243: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else diff --git a/contrib/libf2c/libF77/configure.in b/contrib/libf2c/libF77/configure.in index a9f282e..9d34482 100644 --- a/contrib/libf2c/libF77/configure.in +++ b/contrib/libf2c/libF77/configure.in @@ -23,6 +23,11 @@ AC_PREREQ(2.12.1) AC_INIT(getarg_.c) dnl Checks for programs. + +dnl FIXME AC_PROG_CC wants CC to be able to link things, but it may +dnl not be able to. +define([AC_PROG_CC_WORKS],[]) + # For g77 we'll set CC to point at the built gcc, but this will get it into # the makefiles AC_PROG_CC diff --git a/contrib/libf2c/libF77/dtime_.c b/contrib/libf2c/libF77/dtime_.c index 4b37320..e2c3a03 100644 --- a/contrib/libf2c/libF77/dtime_.c +++ b/contrib/libf2c/libF77/dtime_.c @@ -45,8 +45,8 @@ dtime_(float *tarray) static struct tms t0; times(&t); - tarray[0] = (t.tms_utime - t0.tms_utime) / Hz; - tarray[1] = (t.tms_stime - t0.tms_stime) / Hz; + tarray[0] = (double)(t.tms_utime - t0.tms_utime) / Hz; + tarray[1] = (double)(t.tms_stime - t0.tms_stime) / Hz; t0 = t; return tarray[0] + tarray[1]; #endif diff --git a/contrib/libf2c/libF77/etime_.c b/contrib/libf2c/libF77/etime_.c index e88cfd8..0c3209d 100644 --- a/contrib/libf2c/libF77/etime_.c +++ b/contrib/libf2c/libF77/etime_.c @@ -41,6 +41,7 @@ etime_(float *tarray) struct tms t; times(&t); - return (tarray[0] = t.tms_utime/Hz) + (tarray[1] = t.tms_stime/Hz); + return (tarray[0] = (double)t.tms_utime/Hz) + + (tarray[1] = (double)t.tms_stime/Hz); #endif } diff --git a/contrib/libf2c/libF77/s_cat.c b/contrib/libf2c/libF77/s_cat.c index f462fd2..77a94f6 100644 --- a/contrib/libf2c/libF77/s_cat.c +++ b/contrib/libf2c/libF77/s_cat.c @@ -22,9 +22,9 @@ VOID #ifdef KR_headers -s_cat(lp, rpp, rnp, np, ll) char *lp, *rpp[]; ftnlen rnp[], *np, ll; +s_cat(lp, rpp, rnp, np, ll) char *lp, *rpp[]; ftnint rnp[], *np; ftnlen ll; #else -s_cat(char *lp, char *rpp[], ftnlen rnp[], ftnlen *np, ftnlen ll) +s_cat(char *lp, char *rpp[], ftnint rnp[], ftnint *np, ftnlen ll) #endif { ftnlen i, nc; diff --git a/contrib/libf2c/libF77/z_log.c b/contrib/libf2c/libF77/z_log.c index 34c56d4..9dcc7f7 100644 --- a/contrib/libf2c/libF77/z_log.c +++ b/contrib/libf2c/libF77/z_log.c @@ -10,7 +10,54 @@ extern double f__cabs(double, double); void z_log(doublecomplex *r, doublecomplex *z) #endif { + double s, s0, t, t2, u, v; double zi = z->i, zr = z->r; + r->i = atan2(zi, zr); +#ifdef Pre20000310 r->r = log( f__cabs( zr, zi ) ); +#else + if (zi < 0) + zi = -zi; + if (zr < 0) + zr = -zr; + if (zr < zi) { + t = zi; + zi = zr; + zr = t; + } + t = zi/zr; + s = zr * sqrt(1 + t*t); + /* now s = f__cabs(zi,zr), and zr = |zr| >= |zi| = zi */ + if ((t = s - 1) < 0) + t = -t; + if (t > .01) + r->r = log(s); + else { + +#ifdef Comment + + log(1+x) = x - x^2/2 + x^3/3 - x^4/4 + - ... + + = x(1 - x/2 + x^2/3 -+...) + + [sqrt(y^2 + z^2) - 1] * [sqrt(y^2 + z^2) + 1] = y^2 + z^2 - 1, so + + sqrt(y^2 + z^2) - 1 = (y^2 + z^2 - 1) / [sqrt(y^2 + z^2) + 1] + +#endif /*Comment*/ + + t = ((zr*zr - 1.) + zi*zi) / (s + 1); + t2 = t*t; + s = 1. - 0.5*t; + u = v = 1; + do { + s0 = s; + u *= t2; + v += 2; + s += u/v - t*u/(v+1); + } while(s > s0); + r->r = s*t; + } +#endif } |