Initial import from FreeBSD RELENG_4:
[dragonfly.git] / lib / libm / common_source / sqrt.3
1 .\" Copyright (c) 1985, 1991, 1993
2 .\"     The Regents of the University of California.  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      8.1 (Berkeley) 6/4/93
33 .\" $FreeBSD: src/lib/libm/common_source/sqrt.3,v 1.4.2.3 2001/03/06 16:46:22 ru Exp $
34 .\"
35 .Dd June 4, 1993
36 .Dt SQRT 3
37 .Os
38 .Sh NAME
39 .Nm cbrt ,
40 .Nm sqrt
41 .Nd cube root and square root functions
42 .Sh LIBRARY
43 .Lb libm
44 .Sh SYNOPSIS
45 .Fd #include <math.h>
46 .Ft double
47 .Fn cbrt "double x"
48 .Ft double
49 .Fn sqrt "double x"
50 .Sh DESCRIPTION
51 The
52 .Fn cbrt
53 function computes
54 the cube root of
55 .Ar x .
56 .Pp
57 The
58 .Fn sqrt
59 computes the
60 non-negative square root of x.
61 .Sh RETURN VALUES
62 The
63 .Fn cbrt
64 function returns the requested cube root.
65 The
66 .Fn sqrt
67 function returns the requested square root
68 unless an error occurs.
69 On the
70 .Tn VAX
71 or
72 .Tn Tahoe
73 processor an attempt to take the
74 .Fn sqrt
75 of negative
76 .Fa x
77 causes an error; in this event,
78 the global variable
79 .Va errno
80 is set to
81 .Er EDOM
82 and a reserved operand fault is generated.
83 .Sh ERROR (due to Roundoff etc.)
84 The
85 .Fn cbrt
86 function
87 is accurate to within 0.7
88 .Em ulps .
89 .Pp
90 The
91 .Fn sqrt
92 function on a
93 .Tn VAX
94 is accurate to within 0.501
95 .Em ulps .
96 Sqrt on a machine that conforms to
97 .Tn IEEE
98 754 is correctly rounded
99 in accordance with the rounding mode in force; the error is less than
100 half an
101 .Em ulp
102 in the default mode (round\-to\-nearest).
103 An
104 .Em ulp
105 is one
106 .Em U Ns nit
107 in the
108 .Em L Ns ast
109 .Em P Ns lace
110 carried.
111 .Sh SEE ALSO
112 .Xr infnan 3 ,
113 .Xr math 3
114 .Sh STANDARDS
115 The
116 .Fn sqrt
117 function conforms to
118 .St -isoC .
119 .Sh HISTORY
120 The
121 .Fn cbrt
122 function appeared in
123 .Bx 4.3 .