OSDN Git Service

Import translated manuals from JM CVS Repository.
[linuxjm/jm.git] / manual / LDP_man-pages / original / man3 / sqrt.3
1 .\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk)
2 .\" and Copyright 2008, Linux Foundation, written by Michael Kerrisk
3 .\"     <mtk.manpages@gmail.com>
4 .\"
5 .\" Permission is granted to make and distribute verbatim copies of this
6 .\" manual provided the copyright notice and this permission notice are
7 .\" preserved on all copies.
8 .\"
9 .\" Permission is granted to copy and distribute modified versions of this
10 .\" manual under the conditions for verbatim copying, provided that the
11 .\" entire resulting derived work is distributed under the terms of a
12 .\" permission notice identical to this one.
13 .\"
14 .\" Since the Linux kernel and libraries are constantly changing, this
15 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
16 .\" responsibility for errors or omissions, or for damages resulting from
17 .\" the use of the information contained herein.  The author(s) may not
18 .\" have taken the same level of care in the production of this manual,
19 .\" which is licensed free of charge, as they might when working
20 .\" professionally.
21 .\"
22 .\" Formatted or processed versions of this manual, if unaccompanied by
23 .\" the source, must acknowledge the copyright and authors of this work.
24 .\"
25 .\" References consulted:
26 .\"     Linux libc source code
27 .\"     Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991)
28 .\"     386BSD man pages
29 .\" Modified 1993-07-24 by Rik Faith (faith@cs.unc.edu)
30 .\" Modified 2002-07-27 by Walter Harms
31 .\"     (walter.harms@informatik.uni-oldenburg.de)
32 .TH SQRT 3  2008-08-05 ""  "Linux Programmer's Manual"
33 .SH NAME
34 sqrt, sqrtf, sqrtl \- square root function
35 .SH SYNOPSIS
36 .nf
37 .B #include <math.h>
38 .sp
39 .BI "double sqrt(double " x );
40 .br
41 .BI "float sqrtf(float " x );
42 .br
43 .BI "long double sqrtl(long double " x );
44 .fi
45 .sp
46 Link with \fI\-lm\fP.
47 .sp
48 .in -4n
49 Feature Test Macro Requirements for glibc (see
50 .BR feature_test_macros (7)):
51 .in
52 .sp
53 .ad l
54 .BR sqrtf (),
55 .BR sqrtl ():
56 _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE\ >=\ 600 || _ISOC99_SOURCE; or
57 .I cc\ -std=c99
58 .ad b
59 .SH DESCRIPTION
60 The
61 .BR sqrt ()
62 function returns the nonnegative square root of \fIx\fP.
63 .SH "RETURN VALUE"
64 On success, these functions return the square root of
65 .IR x .
66
67 If
68 .I x
69 is a NaN, a NaN is returned.
70
71 If
72 .I x
73 is +0 (\-0), +0 (\-0) is returned.
74
75 If
76 .I x
77 is positive infinity, positive infinity is returned.
78
79 If
80 .I x
81 is less than \-0,
82 a domain error occurs,
83 and a NaN is returned.
84 .SH ERRORS
85 See
86 .BR math_error (7)
87 for information on how to determine whether an error has occurred
88 when calling these functions.
89 .PP
90 The following errors can occur:
91 .TP
92 Domain error: \fIx\fP less than \-0
93 .I errno
94 is set to
95 .BR EDOM .
96 An invalid floating-point exception
97 .RB ( FE_INVALID )
98 is raised.
99 .SH "CONFORMING TO"
100 C99, POSIX.1-2001.
101 The variant returning
102 .I double
103 also conforms to
104 SVr4, 4.3BSD, C89.
105 .SH "SEE ALSO"
106 .BR cbrt (3),
107 .BR csqrt (3),
108 .BR hypot (3)