Initial import, 0.1 + pk 0.2.4-B1
[unix-history] / lib / libm / common_source / sqrt.3
CommitLineData
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
48The
49.Fn cbrt
50function computes
51the cube root of
52.Ar x .
53.Pp
54The
55.Fn sqrt
56computes the
57non-negative square root of x.
58.Sh RETURN VALUES
59The
60.Fn cbrt
61function returns the requested cube root.
62The
63.Fn sqrt
64function returns the requested square root
65unless an error occurs.
66On the
67.Tn VAX
68or
69.Tn Tahoe
70processor an attempt to take the
71.Fn sqrt
72of negative
73.Fa x
74causes an error; in this event,
75the global variable
76.Va errno
77is set to
78.Dv EDOM
79and a reserved operand fault is generated.
80.Sh ERROR (due to Roundoff etc.)
81The
82.Fn cbrt
83function
84is accurate to within 0.7
85.Em ulps .
86.Pp
87The
88.Fn sqrt
89function on a
90.Tn VAX
91is accurate to within 0.501
92.Em ulps .
93Sqrt on a machine that conforms to
94.Tn IEEE
95754 is correctly rounded
96in accordance with the rounding mode in force; the error is less than
97half an
98.Em ulp
99in the default mode (round\-to\-nearest).
100An
101.Em ulp
102is one
103.Em U Ns nit
104in the
105.Em L Ns ast
106.Em P Ns lace
107carried.
108.Sh SEE ALSO
109.Xr math 3 ,
110.Xr infnan 3
111.Sh STANDARDS
112The
113.Nm sqrt
114function conforms to
115.St -ansiC .
116.Sh HISTORY
117The
118.Nm cbrt
119function appeared in
120.Bx 4.3 .