]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man3/sqrt.3
man*/: srcfix (Use .P instead of .PP or .LP)
[thirdparty/man-pages.git] / man3 / sqrt.3
CommitLineData
a1eaacb1 1'\" t
fea681da 2.\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk)
631c6898
MK
3.\" and Copyright 2008, Linux Foundation, written by Michael Kerrisk
4.\" <mtk.manpages@gmail.com>
fea681da 5.\"
5fbde956 6.\" SPDX-License-Identifier: Linux-man-pages-copyleft
fea681da
MK
7.\"
8.\" References consulted:
9.\" Linux libc source code
10.\" Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991)
11.\" 386BSD man pages
12.\" Modified 1993-07-24 by Rik Faith (faith@cs.unc.edu)
13.\" Modified 2002-07-27 by Walter Harms
14.\" (walter.harms@informatik.uni-oldenburg.de)
4c1c5274 15.TH sqrt 3 (date) "Linux man-pages (unreleased)"
fea681da
MK
16.SH NAME
17sqrt, sqrtf, sqrtl \- square root function
a02ff138
AC
18.SH LIBRARY
19Math library
8fc3b2cf 20.RI ( libm ", " \-lm )
fea681da
MK
21.SH SYNOPSIS
22.nf
23.B #include <math.h>
c6d039a3 24.P
fea681da 25.BI "double sqrt(double " x );
fea681da 26.BI "float sqrtf(float " x );
fea681da
MK
27.BI "long double sqrtl(long double " x );
28.fi
c6d039a3 29.P
d39ad78f 30.RS -4
631c6898
MK
31Feature Test Macro Requirements for glibc (see
32.BR feature_test_macros (7)):
d39ad78f 33.RE
c6d039a3 34.P
631c6898
MK
35.BR sqrtf (),
36.BR sqrtl ():
9d2adbae 37.nf
5c10d2c5 38 _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
9d2adbae 39 || /* Since glibc 2.19: */ _DEFAULT_SOURCE
75c018a1 40 || /* glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
9d2adbae 41.fi
fea681da 42.SH DESCRIPTION
5600f73a 43These functions return the nonnegative square root of
022671eb 44.IR x .
47297adb 45.SH RETURN VALUE
631c6898
MK
46On success, these functions return the square root of
47.IR x .
c6d039a3 48.P
631c6898
MK
49If
50.I x
51is a NaN, a NaN is returned.
c6d039a3 52.P
631c6898
MK
53If
54.I x
55is +0 (\-0), +0 (\-0) is returned.
c6d039a3 56.P
631c6898
MK
57If
58.I x
59is positive infinity, positive infinity is returned.
c6d039a3 60.P
631c6898
MK
61If
62.I x
63is less than \-0,
efe294cb 64a domain error occurs,
631c6898 65and a NaN is returned.
fea681da 66.SH ERRORS
631c6898
MK
67See
68.BR math_error (7)
69for information on how to determine whether an error has occurred
70when calling these functions.
c6d039a3 71.P
631c6898 72The following errors can occur:
fea681da 73.TP
631c6898
MK
74Domain error: \fIx\fP less than \-0
75.I errno
76is set to
77.BR EDOM .
78An invalid floating-point exception
79.RB ( FE_INVALID )
80is raised.
606e09e6
MS
81.SH ATTRIBUTES
82For an explanation of the terms used in this section, see
83.BR attributes (7).
84.TS
85allbox;
c466875e 86lbx lb lb
606e09e6
MS
87l l l.
88Interface Attribute Value
89T{
9e54434e
BR
90.na
91.nh
606e09e6
MS
92.BR sqrt (),
93.BR sqrtf (),
94.BR sqrtl ()
95T} Thread safety MT-Safe
96.TE
3113c7f3 97.SH STANDARDS
4131356c
AC
98C11, POSIX.1-2008.
99.SH HISTORY
100C99, POSIX.1-2001.
c6d039a3 101.P
631c6898
MK
102The variant returning
103.I double
104also conforms to
e0089d55 105SVr4, 4.3BSD, C89.
47297adb 106.SH SEE ALSO
36268806
MK
107.BR cbrt (3),
108.BR csqrt (3),
fea681da 109.BR hypot (3)