xref: /freebsd/lib/msun/man/cimag.3 (revision 7899f917b1c0ea178f1d2be0cfb452086d079d23)
1.\" Copyright (c) 2004 Stefan Farfeleder
2.\" All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\"    notice, this list of conditions and the following disclaimer.
9.\" 2. Redistributions in binary form must reproduce the above copyright
10.\"    notice, this list of conditions and the following disclaimer in the
11.\"    documentation and/or other materials provided with the distribution.
12.\"
13.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23.\" SUCH DAMAGE.
24.\"
25.Dd August 7, 2008
26.Dt CIMAG 3
27.Os
28.Sh NAME
29.Nm cimag , cimagf , cimagl ,
30.Nm conj , conjf , conjl ,
31.Nm cproj , cprojf , cprojl ,
32.Nm creal , crealf , creall
33.Nd "functions to manipulate complex numbers"
34.Sh LIBRARY
35.Lb libm
36.Sh SYNOPSIS
37.In complex.h
38.Ft double
39.Fn cimag "double complex z"
40.Ft float
41.Fn cimagf "float complex z"
42.Ft "long double"
43.Fn cimagl "long double complex z"
44.Ft "double complex"
45.Fn conj "double complex z"
46.Ft "float complex"
47.Fn conjf "float complex z"
48.Ft "long double complex"
49.Fn conjl "long double complex z"
50.Ft "double complex"
51.Fn cproj "double complex z"
52.Ft "float complex"
53.Fn cprojf "float complex z"
54.Ft "long double complex"
55.Fn cprojl "long double complex z"
56.Ft double
57.Fn creal "double complex z"
58.Ft float
59.Fn crealf "float complex z"
60.Ft "long double"
61.Fn creall "long double complex z"
62.Sh DESCRIPTION
63Let
64.Sm off
65.Fa a + b * Em i
66.Sm on
67denote the complex number
68.Fa z .
69.Pp
70The
71.Fn creal
72functions return the real part
73.Fa a ,
74and the
75.Fn cimag
76functions return the imaginary part
77.Fa b .
78.Pp
79The
80.Fn conj
81functions return the complex conjugate
82.Sm off
83.Fa a - b * Em i .
84.Sm on
85.Pp
86The
87.Fn cproj
88functions return the projection onto the Riemann sphere.
89If
90.Fa z
91contains an infinite component, then the result is
92.Fa \*(If \*(Pm 0 Ns * Ns Em i ,
93where the (zero) imaginary part of the result has the same sign as
94.Fa b .
95Otherwise, the result is
96.Fa z .
97.Pp
98These functions do not signal any floating point exceptions.
99.Sh STANDARDS
100The
101.Fn cimag ,
102.Fn conj ,
103.Fn cproj ,
104and
105.Fn creal
106functions conform to
107.St -isoC-99 .
108.Sh HISTORY
109The
110.Fn cimag ,
111.Fn conj
112and
113.Fn creal
114functions first appeared in
115.Fx 5.3 .
116The
117.Fn cproj
118functions appeared in
119.Fx 8.0 .
120