]>
Commit | Line | Data |
---|---|---|
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 |
17 | sqrt, sqrtf, sqrtl \- square root function | |
a02ff138 AC |
18 | .SH LIBRARY |
19 | Math 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 |
31 | Feature 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 | 43 | These functions return the nonnegative square root of |
022671eb | 44 | .IR x . |
47297adb | 45 | .SH RETURN VALUE |
631c6898 MK |
46 | On success, these functions return the square root of |
47 | .IR x . | |
c6d039a3 | 48 | .P |
631c6898 MK |
49 | If |
50 | .I x | |
51 | is a NaN, a NaN is returned. | |
c6d039a3 | 52 | .P |
631c6898 MK |
53 | If |
54 | .I x | |
55 | is +0 (\-0), +0 (\-0) is returned. | |
c6d039a3 | 56 | .P |
631c6898 MK |
57 | If |
58 | .I x | |
59 | is positive infinity, positive infinity is returned. | |
c6d039a3 | 60 | .P |
631c6898 MK |
61 | If |
62 | .I x | |
63 | is less than \-0, | |
efe294cb | 64 | a domain error occurs, |
631c6898 | 65 | and a NaN is returned. |
fea681da | 66 | .SH ERRORS |
631c6898 MK |
67 | See |
68 | .BR math_error (7) | |
69 | for information on how to determine whether an error has occurred | |
70 | when calling these functions. | |
c6d039a3 | 71 | .P |
631c6898 | 72 | The following errors can occur: |
fea681da | 73 | .TP |
631c6898 MK |
74 | Domain error: \fIx\fP less than \-0 |
75 | .I errno | |
76 | is set to | |
77 | .BR EDOM . | |
78 | An invalid floating-point exception | |
79 | .RB ( FE_INVALID ) | |
80 | is raised. | |
606e09e6 MS |
81 | .SH ATTRIBUTES |
82 | For an explanation of the terms used in this section, see | |
83 | .BR attributes (7). | |
84 | .TS | |
85 | allbox; | |
c466875e | 86 | lbx lb lb |
606e09e6 MS |
87 | l l l. |
88 | Interface Attribute Value | |
89 | T{ | |
9e54434e BR |
90 | .na |
91 | .nh | |
606e09e6 MS |
92 | .BR sqrt (), |
93 | .BR sqrtf (), | |
94 | .BR sqrtl () | |
95 | T} Thread safety MT-Safe | |
96 | .TE | |
3113c7f3 | 97 | .SH STANDARDS |
4131356c AC |
98 | C11, POSIX.1-2008. |
99 | .SH HISTORY | |
100 | C99, POSIX.1-2001. | |
c6d039a3 | 101 | .P |
631c6898 MK |
102 | The variant returning |
103 | .I double | |
104 | also conforms to | |
e0089d55 | 105 | SVr4, 4.3BSD, C89. |
47297adb | 106 | .SH SEE ALSO |
36268806 MK |
107 | .BR cbrt (3), |
108 | .BR csqrt (3), | |
fea681da | 109 | .BR hypot (3) |