xref: /openbsd-src/lib/libm/man/csqrt.3 (revision 86f9d4cdda0e0267dccd8755ac0035525579c4a7)
1*86f9d4cdStedu.\"	$OpenBSD: csqrt.3,v 1.2 2013/06/05 03:40:26 tedu Exp $
22bfdbafeSmartynas.\"
32bfdbafeSmartynas.\" Copyright (c) 2011 Martynas Venckus <martynas@openbsd.org>
42bfdbafeSmartynas.\"
52bfdbafeSmartynas.\" Permission to use, copy, modify, and distribute this software for any
62bfdbafeSmartynas.\" purpose with or without fee is hereby granted, provided that the above
72bfdbafeSmartynas.\" copyright notice and this permission notice appear in all copies.
82bfdbafeSmartynas.\"
92bfdbafeSmartynas.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
102bfdbafeSmartynas.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
112bfdbafeSmartynas.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
122bfdbafeSmartynas.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
132bfdbafeSmartynas.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
142bfdbafeSmartynas.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
152bfdbafeSmartynas.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
162bfdbafeSmartynas.\"
17*86f9d4cdStedu.Dd $Mdocdate: June 5 2013 $
182bfdbafeSmartynas.Dt CSQRT 3
192bfdbafeSmartynas.Os
202bfdbafeSmartynas.Sh NAME
212bfdbafeSmartynas.Nm csqrt ,
222bfdbafeSmartynas.Nm csqrtf ,
232bfdbafeSmartynas.Nm csqrtl
242bfdbafeSmartynas.Nd complex square root
252bfdbafeSmartynas.Sh SYNOPSIS
26*86f9d4cdStedu.In complex.h
272bfdbafeSmartynas.Ft double complex
282bfdbafeSmartynas.Fn csqrt "double complex z"
292bfdbafeSmartynas.Ft float complex
302bfdbafeSmartynas.Fn csqrtf "float complex z"
312bfdbafeSmartynas.Ft long double complex
322bfdbafeSmartynas.Fn csqrtl "long double complex z"
332bfdbafeSmartynas.Sh DESCRIPTION
342bfdbafeSmartynasThe
352bfdbafeSmartynas.Fn csqrt ,
362bfdbafeSmartynas.Fn csqrtf
372bfdbafeSmartynasand
382bfdbafeSmartynas.Fn csqrtl
392bfdbafeSmartynasfunctions compute the complex square root of
402bfdbafeSmartynas.Fa z .
412bfdbafeSmartynas.Pp
422bfdbafeSmartynasIf
432bfdbafeSmartynas.Fa z
442bfdbafeSmartynas= x + iy, then
452bfdbafeSmartynas.Bd -literal -offset indent
462bfdbafeSmartynasRe csqrt(z) = [ (|z| + x) / 2 ]^(1/2).
472bfdbafeSmartynasIm csqrt(z) = [ (|z| - x) / 2 ]^(1/2).
482bfdbafeSmartynas.Ed
492bfdbafeSmartynas.Pp
502bfdbafeSmartynasNote that -csqrt(z) is also a square root of
512bfdbafeSmartynas.Fa z .
522bfdbafeSmartynasThe root chosen
532bfdbafeSmartynasis always in the right half plane and Im csqrt(z) has the same sign
542bfdbafeSmartynasas y.
552bfdbafeSmartynas.Sh RETURN VALUES
562bfdbafeSmartynasThe
572bfdbafeSmartynas.Fn csqrt ,
582bfdbafeSmartynas.Fn csqrtf
592bfdbafeSmartynasand
602bfdbafeSmartynas.Fn csqrtl
612bfdbafeSmartynasfunctions return the complex square root of
622bfdbafeSmartynas.Fa z .
632bfdbafeSmartynas.Sh SEE ALSO
642bfdbafeSmartynas.Xr cpow 3
652bfdbafeSmartynas.Sh STANDARDS
662bfdbafeSmartynasThe
672bfdbafeSmartynas.Fn csqrt ,
682bfdbafeSmartynas.Fn csqrtf
692bfdbafeSmartynasand
702bfdbafeSmartynas.Fn csqrtl
712bfdbafeSmartynasfunctions conform to
722bfdbafeSmartynas.St -isoC-99 .
73