summaryrefslogtreecommitdiffstats
path: root/lib/msun/man/csqrt.3
blob: 132b314394b9346ef18f2c53de5c3f0620c57c4d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
.\" Copyright (c) 2007 David Schultz <das@FreeBSD.org>
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\"    notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\"    notice, this list of conditions and the following disclaimer in the
.\"    documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $FreeBSD$
.\"
.Dd December 14, 2007
.Dt CSQRT 3
.Os
.Sh NAME
.Nm csqrt ,
.Nm csqrtf
.Nd complex square root functions
.Sh LIBRARY
.Lb libm
.Sh SYNOPSIS
.In complex.h
.Ft double complex
.Fn csqrt "double complex z"
.Ft float complex
.Fn csqrtf "float complex z"
.Sh DESCRIPTION
The
.Fn csqrt
and
.Fn csqrtf
functions compute the square root of
.Fa z
in the complex plane, with a branch cut along the negative real axis.
In other words,
.Fn csqrt
and
.Fn csqrtf
always return the square root whose real part is non-negative.
.Sh RETURN VALUES
These functions return the requested square root.
The square root of 0 is
.Li +0 \*(Pm 0 ,
where the imaginary parts of the input and respective result have
the same sign.
For infinities and \*(Nas, the following rules apply, with the
earlier rules having precedence:
.Bl -column -offset indent "-\*(If + \*(Na*I" "\*(If \*(Pm \*(If*I  " "(for all k)"
.Em Input	Result
k + \*(If*I	\*(If + \*(If*I	(for all k)
-\*(If + \*(Na*I	\*(Na \*(Pm \*(If*I
\*(If + \*(Na*I	\*(If + \*(Na*I
k + \*(Na*I	\*(Na + \*(Na*I
\*(Na + k*I	\*(Na + \*(Na*I
-\*(If + k*I	+0 + \*(If*I
\*(If + k*I	\*(If + 0*I
.El
.Pp
For numbers with negative imaginary parts, the above special cases
apply given the identity:
.Dl csqrt(conj(z) = conj(sqrt(z))
Note that the sign of \*(Na is indeterminate.
Also, if the real or imaginary part of the input is finite and
an \*(Na is generated, an invalid exception will be thrown.
.Sh SEE ALSO
.Xr cabs 3 ,
.Xr fenv 3 ,
.Xr math 3 ,
.Sh STANDARDS
The
.Fn csqrt
and
.Fn csqrtf
functions conform to
.St -isoC-99 .
.Sh BUGS
For
.Fn csqrt ,
inexact results are not correctly rounded in general.
OpenPOWER on IntegriCloud