xref: /openbsd/lib/libm/man/sqrt.3 (revision 17df1aa7)
1.\"	$OpenBSD: sqrt.3,v 1.11 2008/12/12 00:10:26 martynas Exp $
2.\" Copyright (c) 1985, 1991 Regents of the University of California.
3.\" All rights reserved.
4.\"
5.\" Redistribution and use in source and binary forms, with or without
6.\" modification, are permitted provided that the following conditions
7.\" are met:
8.\" 1. Redistributions of source code must retain the above copyright
9.\"    notice, this list of conditions and the following disclaimer.
10.\" 2. Redistributions in binary form must reproduce the above copyright
11.\"    notice, this list of conditions and the following disclaimer in the
12.\"    documentation and/or other materials provided with the distribution.
13.\" 3. Neither the name of the University nor the names of its contributors
14.\"    may be used to endorse or promote products derived from this software
15.\"    without specific prior written permission.
16.\"
17.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
18.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
21.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27.\" SUCH DAMAGE.
28.\"
29.\"     from: @(#)sqrt.3	6.4 (Berkeley) 5/6/91
30.\"
31.Dd $Mdocdate: December 12 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 SYNOPSIS
42.Fd #include <math.h>
43.Ft double
44.Fn cbrt "double x"
45.Ft float
46.Fn cbrtf "float x"
47.Ft double
48.Fn sqrt "double x"
49.Ft float
50.Fn sqrtf "float x"
51.Ft long double
52.Fn sqrtl "long double x"
53.Sh DESCRIPTION
54The
55.Fn cbrt
56function computes the cube root of
57.Ar x .
58The
59.Fn cbrtf
60function is a single precision version of
61.Fn cbrt .
62.Pp
63The
64.Fn sqrt
65function computes
66the non-negative square root of x.
67The
68.Fn sqrtf
69function is a single precision version of
70.Fn sqrt .
71The
72.Fn sqrtl
73function is an extended precision version of
74.Fn sqrt .
75.Sh RETURN VALUES
76If x is negative,
77.Fn sqrt "x" ,
78.Fn sqrtf "x"
79and
80.Fn sqrtl "x"
81set the global variable
82.Va errno
83to EDOM.
84.Sh SEE ALSO
85.Xr math 3
86.Sh HISTORY
87The
88.Fn cbrt
89function appeared in
90.Bx 4.3 .
91