Commit | Line | Data |
---|---|---|
b8ea98e1 DR |
1 | .TH INTRO 3 |
2 | .SH NAME | |
3 | intro \- introduction to library functions | |
4 | .SH SYNOPSIS | |
5 | .B #include <stdio.h> | |
6 | .PP | |
7 | .B #include <math.h> | |
8 | .SH DESCRIPTION | |
9 | This section describes functions that may be found | |
10 | in various libraries, other than those functions | |
11 | that directly invoke UNIX system primitives, | |
12 | which are described in section 2. | |
13 | Functions are divided into various libraries distinguished | |
14 | by the section number at the top of the page: | |
15 | .TP 6n | |
16 | (3) | |
17 | These functions, together with those of section 2 and those | |
18 | marked (3S), constitute library | |
19 | .I libc, | |
20 | which is automatically loaded by the C compiler | |
21 | .IR cc (1) | |
22 | and the Fortran compiler | |
23 | .IR f77 (1). | |
24 | The link editor | |
25 | .IR ld (1) | |
26 | searches this library under the `\-lc' option. | |
27 | Declarations for some of these functions may be obtained | |
28 | from include files indicated on the appropriate pages. | |
29 | .TP | |
30 | (3M) | |
31 | These functions constitute the math library, | |
32 | .I libm. | |
33 | They are automatically loaded as needed by the Fortran compiler | |
34 | .IR f77 (1). | |
35 | The link editor searches this library under the `\-lm' option. | |
36 | Declarations for these functions may be obtained from | |
37 | the include file <math.h>. | |
38 | .TP | |
39 | (3S) | |
40 | These functions constitute the | |
41 | `standard I/O package', | |
42 | see | |
43 | .IR stdio (3). | |
44 | These functions are in the library | |
45 | .I libc | |
46 | already mentioned. | |
47 | Declarations for these functions may be obtained from | |
48 | the include file <stdio.h>. | |
49 | .TP | |
50 | (3X) | |
51 | Various | |
52 | specialized libraries have not been given distinctive | |
53 | captions. | |
54 | The files in which these libraries are found are named | |
55 | on the appropriate pages. | |
56 | .SH FILES | |
57 | /lib/libc.a | |
58 | .br | |
59 | /lib/libm.a, /usr/lib/libm.a (one or the other) | |
60 | .SH SEE ALSO | |
61 | stdio(3), | |
62 | nm(1), ld(1), cc(1), f77(1), intro(2) | |
63 | .SH DIAGNOSTICS | |
64 | Functions in the math library (3M) may return | |
65 | conventional values when the function is undefined for the | |
66 | given arguments or when the value is not representable. | |
67 | In these cases the external variable | |
68 | .I errno | |
69 | (see | |
70 | .IR intro (2)) | |
71 | is set to the value EDOM | |
72 | or ERANGE. | |
73 | The values of EDOM and ERANGE are defined in | |
74 | the include file | |
75 | .I <math.h>. | |
76 | .SH ASSEMBLER | |
77 | In assembly language these functions may be accessed | |
78 | by simulating the C calling sequence. | |
79 | For example, | |
80 | .IR ecvt (3) | |
81 | might be called this way: | |
82 | .IP "" | |
83 | .globl _ecvt | |
84 | .nf | |
85 | setd | |
86 | mov $sign,\-(sp) | |
87 | mov $decpt,\-(sp) | |
88 | mov ndigit,\-(sp) | |
89 | movf value,\-(sp) | |
90 | jsr pc,_ecvt | |
91 | add $14.,sp | |
92 | .fi |