~ubuntu-branches/ubuntu/trusty/libf2c2/trusty

« back to all changes in this revision

Viewing changes to libF77/README

  • Committer: Bazaar Package Importer
  • Author(s): Alan Bain
  • Date: 2008-05-19 22:50:54 UTC
  • mfrom: (2.1.4 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080519225054-jlymia0wdvvfq7dg
Tags: 20061008-4
Remove CVS directory left in source package

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
If your compiler does not recognize ANSI C headers,
2
 
compile with KR_headers defined:  either add -DKR_headers
3
 
to the definition of CFLAGS in the makefile, or insert
4
 
 
5
 
#define KR_headers
6
 
 
7
 
at the top of f2c.h , cabs.c , main.c , and sig_die.c .
8
 
 
9
 
Under MS-DOS, compile s_paus.c with -DMSDOS.
10
 
 
11
 
If you have a really ancient K&R C compiler that does not understand
12
 
void, add -Dvoid=int to the definition of CFLAGS in the makefile.
13
 
 
14
 
If you use a C++ compiler, first create a local f2c.h by appending
15
 
f2ch.add to the usual f2c.h, e.g., by issuing the command
16
 
        make f2c.h
17
 
which assumes f2c.h is installed in /usr/include .
18
 
 
19
 
If your system lacks onexit() and you are not using an ANSI C
20
 
compiler, then you should compile main.c, s_paus.c, s_stop.c, and
21
 
sig_die.c with NO_ONEXIT defined.  See the comments about onexit in
22
 
the makefile.
23
 
 
24
 
If your system has a double drem() function such that drem(a,b)
25
 
is the IEEE remainder function (with double a, b), then you may
26
 
wish to compile r_mod.c and d_mod.c with IEEE_drem defined.
27
 
On some systems, you may also need to compile with -Ddrem=remainder .
28
 
 
29
 
To check for transmission errors, issue the command
30
 
        make check
31
 
This assumes you have the xsum program whose source, xsum.c,
32
 
is distributed as part of "all from f2c/src".  If you do not
33
 
have xsum, you can obtain xsum.c by sending the following E-mail
34
 
message to netlib@netlib.bell-labs.com
35
 
        send xsum.c from f2c/src
36
 
 
37
 
The makefile assumes you have installed f2c.h in a standard
38
 
place (and does not cause recompilation when f2c.h is changed);
39
 
f2c.h comes with "all from f2c" (the source for f2c) and is
40
 
available separately ("f2c.h from f2c").
41
 
 
42
 
Most of the routines in libF77 are support routines for Fortran
43
 
intrinsic functions or for operations that f2c chooses not
44
 
to do "in line".  There are a few exceptions, summarized below --
45
 
functions and subroutines that appear to your program as ordinary
46
 
external Fortran routines.
47
 
 
48
 
If you use the REAL valued functions listed below (ERF, ERFC,
49
 
DTIME, and ETIME) with "f2c -R", then you need to compile the
50
 
corresponding source files with -DREAL=float.  To do this, it is
51
 
perhaps simplest to add "-DREAL=float" to CFLAGS in the makefile.
52
 
 
53
 
1.      CALL ABORT prints a message and causes a core dump.
54
 
 
55
 
2.      ERF(r) and DERF(d) and the REAL and DOUBLE PRECISION
56
 
        error functions (with x REAL and d DOUBLE PRECISION);
57
 
        DERF must be declared DOUBLE PRECISION in your program.
58
 
        Both ERF and DERF assume your C library provides the
59
 
        underlying erf() function (which not all systems do).
60
 
 
61
 
3.      ERFC(r) and DERFC(d) are the complementary error functions:
62
 
        ERFC(r) = 1 - ERF(r) and DERFC(d) = 1.d0 - DERFC(d)
63
 
        (except that their results may be more accurate than
64
 
        explicitly evaluating the above formulae would give).
65
 
        Again, ERFC and r are REAL, and DERFC and d are DOUBLE
66
 
        PRECISION (and must be declared as such in your program),
67
 
        and ERFC and DERFC rely on your system's erfc().
68
 
 
69
 
4.      CALL GETARG(n,s), where n is an INTEGER and s is a CHARACTER
70
 
        variable, sets s to the n-th command-line argument (or to
71
 
        all blanks if there are fewer than n command-line arguments);
72
 
        CALL GETARG(0,s) sets s to the name of the program (on systems
73
 
        that support this feature).  See IARGC below.
74
 
 
75
 
5.      CALL GETENV(name, value), where name and value are of type
76
 
        CHARACTER, sets value to the environment value, $name, of
77
 
        name (or to blanks if $name has not been set).
78
 
 
79
 
6.      NARGS = IARGC() sets NARGS to the number of command-line
80
 
        arguments (an INTEGER value).
81
 
 
82
 
7.      CALL SIGNAL(n,func), where n is an INTEGER and func is an
83
 
        EXTERNAL procedure, arranges for func to be invoked when
84
 
        signal n occurs (on systems where this makes sense).
85
 
 
86
 
8.      CALL SYSTEM(cmd), where cmd is of type CHARACTER, passes
87
 
        cmd to the system's command processor (on systems where
88
 
        this can be done).
89
 
        
90
 
If your compiler complains about the signal calls in main.c, s_paus.c,
91
 
and signal_.c, you may need to adjust signal1.h suitably.  See the
92
 
comments in signal1.h.
93
 
 
94
 
8.      ETIME(ARR) and DTIME(ARR) are REAL functions that return
95
 
        execution times.  ARR is declared REAL ARR(2).  The elapsed
96
 
        user and system CPU times are stored in ARR(1) and ARR(2),
97
 
        respectively.  ETIME returns the total elapsed CPU time,
98
 
        i.e., ARR(1) + ARR(2).  DTIME returns total elapsed CPU
99
 
        time since the previous call on DTIME.
100
 
 
101
 
9.      CALL SYSTEM(cmd), where cmd is of type CHARACTER, passes
102
 
        cmd to the system's command processor (on systems where
103
 
        this can be done).
104
 
 
105
 
The makefile does not attempt to compile pow_qq.c, qbitbits.c,
106
 
and qbitshft.c, which are meant for use with INTEGER*8.  To use
107
 
INTEGER*8, you must modify f2c.h to declare longint and ulongint
108
 
appropriately; then add pow_qq.o to the POW = line in the makefile,
109
 
and add " qbitbits.o qbitshft.o" to the makefile's F90BIT = line.
110
 
 
111
 
Following Fortran 90, s_cat.c and s_copy.c allow the target of a
112
 
(character string) assignment to be appear on its right-hand, at
113
 
the cost of some extra overhead for all run-time concatenations.
114
 
If you prefer the  extra efficiency that comes with the Fortran 77
115
 
requirement that the left-hand side of a character assignment not
116
 
be involved in the right-hand side, compile s_cat.c and s_copy.c
117
 
with -DNO_OVERWRITE .
118
 
 
119
 
If your system lacks a ranlib command, you don't need it.
120
 
Either comment out the makefile's ranlib invocation, or install
121
 
a harmless "ranlib" command somewhere in your PATH, such as the
122
 
one-line shell script
123
 
 
124
 
        exit 0
125
 
 
126
 
or (on some systems)
127
 
 
128
 
        exec /usr/bin/ar lts $1 >/dev/null
129
 
 
130
 
If your compiler complains about the signal calls in main.c, s_paus.c,
131
 
and signal_.c, you may need to adjust signal1.h suitably.  See the
132
 
comments in signal1.h.
133
 
 
134
 
By default, the routines that implement complex and double complex
135
 
division, c_div.c and z_div.c, call sig_die to print an error message
136
 
and exit if they see a divisor of 0, as this is sometimes helpful for
137
 
debugging.  On systems with IEEE arithmetic, compiling c_div.c and
138
 
z_div.c with -DIEEE_COMPLEX_DIVIDE causes them instead to set both
139
 
the real and imaginary parts of the result to +INFINITY if the
140
 
numerator is nonzero, or to NaN if it vanishes.
141
 
 
142
 
The initializations for "f2c -trapuv" are done by _uninit_f2c(),
143
 
whose source is uninit.c, introduced June 2001.  On IEEE-arithmetic
144
 
systems, _uninit_f2c should initialize floating-point variables to
145
 
signaling NaNs and, at its first invocation, should enable the
146
 
invalid operation exception.  Alas, the rules for distinguishing
147
 
signaling from quiet NaNs were not specified in the IEEE P754 standard,
148
 
nor were the precise means of enabling and disabling IEEE-arithmetic
149
 
exceptions, and these details are thus system dependent.  There are
150
 
#ifdef's in uninit.c that specify them for some popular systems.  If
151
 
yours is not one of these systems, it may take some detective work to
152
 
discover the appropriate details for your system.  Sometimes it helps
153
 
to look in the standard include directories for header files with
154
 
relevant-sounding names, such as ieeefp.h, nan.h, or trap.h, and
155
 
it may be simplest to run experiments to see what distinguishes a
156
 
signaling from a quiet NaN.  (If x is initialized to a signaling
157
 
NaN and the invalid operation exception is masked off, as it should
158
 
be by default on IEEE-arithmetic systems, then computing, say,
159
 
y = x + 1 will yield a quiet NaN.)