Commit | Line | Data |
---|---|---|
15637ed4 RG |
1 | .\" Copyright (c) 1985, 1991 Regents of the University of California. |
2 | .\" All rights reserved. | |
3 | .\" | |
4 | .\" Redistribution and use in source and binary forms, with or without | |
5 | .\" modification, are permitted provided that the following conditions | |
6 | .\" are met: | |
7 | .\" 1. Redistributions of source code must retain the above copyright | |
8 | .\" notice, this list of conditions and the following disclaimer. | |
9 | .\" 2. Redistributions in binary form must reproduce the above copyright | |
10 | .\" notice, this list of conditions and the following disclaimer in the | |
11 | .\" documentation and/or other materials provided with the distribution. | |
12 | .\" 3. All advertising materials mentioning features or use of this software | |
13 | .\" must display the following acknowledgement: | |
14 | .\" This product includes software developed by the University of | |
15 | .\" California, Berkeley and its contributors. | |
16 | .\" 4. Neither the name of the University nor the names of its contributors | |
17 | .\" may be used to endorse or promote products derived from this software | |
18 | .\" without specific prior written permission. | |
19 | .\" | |
20 | .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | |
21 | .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
22 | .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
23 | .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
24 | .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
25 | .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
26 | .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
27 | .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
28 | .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
29 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
30 | .\" SUCH DAMAGE. | |
31 | .\" | |
32 | .\" @(#)sqrt.3 6.4 (Berkeley) 5/6/91 | |
33 | .\" | |
34 | .Dd May 6, 1991 | |
35 | .Dt SQRT 3 | |
36 | .Os | |
37 | .Sh NAME | |
38 | .Nm cbrt , | |
39 | .Nm sqrt | |
40 | .Nd cube root and square root functions | |
41 | .Sh SYNOPSIS | |
42 | .Fd #include <math.h> | |
43 | .Ft double | |
44 | .Fn cbrt "double x" | |
45 | .Ft double | |
46 | .Fn sqrt "double x" | |
47 | .Sh DESCRIPTION | |
48 | The | |
49 | .Fn cbrt | |
50 | function computes | |
51 | the cube root of | |
52 | .Ar x . | |
53 | .Pp | |
54 | The | |
55 | .Fn sqrt | |
56 | computes the | |
57 | non-negative square root of x. | |
58 | .Sh RETURN VALUES | |
59 | The | |
60 | .Fn cbrt | |
61 | function returns the requested cube root. | |
62 | The | |
63 | .Fn sqrt | |
64 | function returns the requested square root | |
65 | unless an error occurs. | |
66 | On the | |
67 | .Tn VAX | |
68 | or | |
69 | .Tn Tahoe | |
70 | processor an attempt to take the | |
71 | .Fn sqrt | |
72 | of negative | |
73 | .Fa x | |
74 | causes an error; in this event, | |
75 | the global variable | |
76 | .Va errno | |
77 | is set to | |
78 | .Dv EDOM | |
79 | and a reserved operand fault is generated. | |
80 | .Sh ERROR (due to Roundoff etc.) | |
81 | The | |
82 | .Fn cbrt | |
83 | function | |
84 | is accurate to within 0.7 | |
85 | .Em ulps . | |
86 | .Pp | |
87 | The | |
88 | .Fn sqrt | |
89 | function on a | |
90 | .Tn VAX | |
91 | is accurate to within 0.501 | |
92 | .Em ulps . | |
93 | Sqrt on a machine that conforms to | |
94 | .Tn IEEE | |
95 | 754 is correctly rounded | |
96 | in accordance with the rounding mode in force; the error is less than | |
97 | half an | |
98 | .Em ulp | |
99 | in the default mode (round\-to\-nearest). | |
100 | An | |
101 | .Em ulp | |
102 | is one | |
103 | .Em U Ns nit | |
104 | in the | |
105 | .Em L Ns ast | |
106 | .Em P Ns lace | |
107 | carried. | |
108 | .Sh SEE ALSO | |
109 | .Xr math 3 , | |
110 | .Xr infnan 3 | |
111 | .Sh STANDARDS | |
112 | The | |
113 | .Nm sqrt | |
114 | function conforms to | |
115 | .St -ansiC . | |
116 | .Sh HISTORY | |
117 | The | |
118 | .Nm cbrt | |
119 | function appeared in | |
120 | .Bx 4.3 . |