xref: /freebsd/lib/msun/man/sqrt.3 (revision 4c8945a06b01a5c8122cdeb402af36bb46a06acc)
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.\" 4. Neither the name of the University nor the names of its contributors
13.\"    may be used to endorse or promote products derived from this software
14.\"    without specific prior written permission.
15.\"
16.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
17.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
20.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26.\" SUCH DAMAGE.
27.\"
28.\"     from: @(#)sqrt.3	6.4 (Berkeley) 5/6/91
29.\" $FreeBSD$
30.\"
31.Dd March 1, 2008
32.Dt SQRT 3
33.Os
34.Sh NAME
35.Nm cbrt ,
36.Nm cbrtf ,
37.Nm sqrt ,
38.Nm sqrtf ,
39.Nm sqrtl
40.Nd cube root and square root functions
41.Sh LIBRARY
42.Lb libm
43.Sh SYNOPSIS
44.In math.h
45.Ft double
46.Fn cbrt "double x"
47.Ft float
48.Fn cbrtf "float x"
49.Ft double
50.Fn sqrt "double x"
51.Ft float
52.Fn sqrtf "float x"
53.Ft long double
54.Fn sqrtl "long double x"
55.Sh DESCRIPTION
56The
57.Fn cbrt
58and the
59.Fn cbrtf
60functions compute
61the cube root of
62.Ar x .
63.Pp
64The
65.Fn sqrt ,
66.Fn sqrtf ,
67and
68.Fn sqrtl
69functions compute the
70non-negative square root of x.
71.Sh RETURN VALUES
72The
73.Fn cbrt
74and the
75.Fn cbrtf
76functions return the requested cube root.
77The
78.Fn sqrt ,
79.Fn sqrtf ,
80and
81.Fn sqrtl
82functions return the requested square root
83unless an error occurs.
84An attempt to take the
85.Fn sqrt
86of negative
87.Fa x
88raises an invalid exception and causes an \*(Na to be returned
89(except that the square root of -0 is valid and equal to -0.)
90.Sh SEE ALSO
91.Xr fenv 3 ,
92.Xr math 3
93.Sh STANDARDS
94The
95.Fn cbrt ,
96.Fn cbrtf ,
97.Fn sqrt ,
98.Fn sqrtf ,
99and
100.Fn sqrtl
101functions conform to
102.St -isoC-99 .
103.Sh HISTORY
104The
105.Fn cbrt
106function appeared in
107.Bx 4.3 .
108The
109.Fn sqrtl
110function appeared in
111.Fx 8.0 .
112