1bef54937SStefan Farfeleder.\" Copyright (c) 2004 Stefan Farfeleder 2bef54937SStefan Farfeleder.\" All rights reserved. 3bef54937SStefan Farfeleder.\" 4bef54937SStefan Farfeleder.\" Redistribution and use in source and binary forms, with or without 5bef54937SStefan Farfeleder.\" modification, are permitted provided that the following conditions 6bef54937SStefan Farfeleder.\" are met: 7bef54937SStefan Farfeleder.\" 1. Redistributions of source code must retain the above copyright 8bef54937SStefan Farfeleder.\" notice, this list of conditions and the following disclaimer. 9bef54937SStefan Farfeleder.\" 2. Redistributions in binary form must reproduce the above copyright 10bef54937SStefan Farfeleder.\" notice, this list of conditions and the following disclaimer in the 11bef54937SStefan Farfeleder.\" documentation and/or other materials provided with the distribution. 12bef54937SStefan Farfeleder.\" 13bef54937SStefan Farfeleder.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 14bef54937SStefan Farfeleder.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 15bef54937SStefan Farfeleder.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 16bef54937SStefan Farfeleder.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 17bef54937SStefan Farfeleder.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 18bef54937SStefan Farfeleder.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 19bef54937SStefan Farfeleder.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 20bef54937SStefan Farfeleder.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 21bef54937SStefan Farfeleder.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 22bef54937SStefan Farfeleder.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 23bef54937SStefan Farfeleder.\" SUCH DAMAGE. 24bef54937SStefan Farfeleder.\" 255e9470f1SDavid Schultz.Dd August 7, 2008 26bef54937SStefan Farfeleder.Dt CIMAG 3 27bef54937SStefan Farfeleder.Os 28bef54937SStefan Farfeleder.Sh NAME 2983e0359dSRuslan Ermilov.Nm cimag , cimagf , cimagl , 3083e0359dSRuslan Ermilov.Nm conj , conjf , conjl , 315e9470f1SDavid Schultz.Nm cproj , cprojf , cprojl , 3283e0359dSRuslan Ermilov.Nm creal , crealf , creall 3383e0359dSRuslan Ermilov.Nd "functions to manipulate complex numbers" 34bef54937SStefan Farfeleder.Sh LIBRARY 35bef54937SStefan Farfeleder.Lb libm 36bef54937SStefan Farfeleder.Sh SYNOPSIS 37bef54937SStefan Farfeleder.In complex.h 38bef54937SStefan Farfeleder.Ft double 39bef54937SStefan Farfeleder.Fn cimag "double complex z" 40bef54937SStefan Farfeleder.Ft float 41bef54937SStefan Farfeleder.Fn cimagf "float complex z" 4283e0359dSRuslan Ermilov.Ft "long double" 43bef54937SStefan Farfeleder.Fn cimagl "long double complex z" 4483e0359dSRuslan Ermilov.Ft "double complex" 45bef54937SStefan Farfeleder.Fn conj "double complex z" 4683e0359dSRuslan Ermilov.Ft "float complex" 47bef54937SStefan Farfeleder.Fn conjf "float complex z" 4883e0359dSRuslan Ermilov.Ft "long double complex" 49bef54937SStefan Farfeleder.Fn conjl "long double complex z" 505e9470f1SDavid Schultz.Ft "double complex" 515e9470f1SDavid Schultz.Fn cproj "double complex z" 525e9470f1SDavid Schultz.Ft "float complex" 535e9470f1SDavid Schultz.Fn cprojf "float complex z" 545e9470f1SDavid Schultz.Ft "long double complex" 555e9470f1SDavid Schultz.Fn cprojl "long double complex z" 56bef54937SStefan Farfeleder.Ft double 57bef54937SStefan Farfeleder.Fn creal "double complex z" 58bef54937SStefan Farfeleder.Ft float 59bef54937SStefan Farfeleder.Fn crealf "float complex z" 6083e0359dSRuslan Ermilov.Ft "long double" 61bef54937SStefan Farfeleder.Fn creall "long double complex z" 62bef54937SStefan Farfeleder.Sh DESCRIPTION 63bef54937SStefan FarfelederLet 64bef54937SStefan Farfeleder.Sm off 65bef54937SStefan Farfeleder.Fa a + b * Em i 66bef54937SStefan Farfeleder.Sm on 67bef54937SStefan Farfelederdenote the complex number 6883e0359dSRuslan Ermilov.Fa z . 69bef54937SStefan Farfeleder.Pp 70bef54937SStefan FarfelederThe 715e9470f1SDavid Schultz.Fn creal 725e9470f1SDavid Schultzfunctions return the real part 735e9470f1SDavid Schultz.Fa a , 745e9470f1SDavid Schultzand the 75bef54937SStefan Farfeleder.Fn cimag 76bef54937SStefan Farfelederfunctions return the imaginary part 77bef54937SStefan Farfeleder.Fa b . 78bef54937SStefan Farfeleder.Pp 79bef54937SStefan FarfelederThe 80bef54937SStefan Farfeleder.Fn conj 81bef54937SStefan Farfelederfunctions return the complex conjugate 82bef54937SStefan Farfeleder.Sm off 83bef54937SStefan Farfeleder.Fa a - b * Em i . 84bef54937SStefan Farfeleder.Sm on 85bef54937SStefan Farfeleder.Pp 86bef54937SStefan FarfelederThe 875e9470f1SDavid Schultz.Fn cproj 885e9470f1SDavid Schultzfunctions return the projection onto the Riemann sphere. 895e9470f1SDavid SchultzIf 905e9470f1SDavid Schultz.Fa z 915e9470f1SDavid Schultzcontains an infinite component, then the result is 925e9470f1SDavid Schultz.Fa \*(If \*(Pm 0 Ns * Ns Em i , 935e9470f1SDavid Schultzwhere the (zero) imaginary part of the result has the same sign as 945e9470f1SDavid Schultz.Fa b . 955e9470f1SDavid SchultzOtherwise, the result is 965e9470f1SDavid Schultz.Fa z . 975e9470f1SDavid Schultz.Pp 985e9470f1SDavid SchultzThese functions do not signal any floating point exceptions. 99bef54937SStefan Farfeleder.Sh STANDARDS 100bef54937SStefan FarfelederThe 101bef54937SStefan Farfeleder.Fn cimag , 1025e9470f1SDavid Schultz.Fn conj , 1035e9470f1SDavid Schultz.Fn cproj , 104bef54937SStefan Farfelederand 105bef54937SStefan Farfeleder.Fn creal 106bef54937SStefan Farfelederfunctions conform to 107bef54937SStefan Farfeleder.St -isoC-99 . 108bef54937SStefan Farfeleder.Sh HISTORY 109bef54937SStefan FarfelederThe 110bef54937SStefan Farfeleder.Fn cimag , 111bef54937SStefan Farfeleder.Fn conj 112bef54937SStefan Farfelederand 113bef54937SStefan Farfeleder.Fn creal 114bef54937SStefan Farfelederfunctions first appeared in 115bef54937SStefan Farfeleder.Fx 5.3 . 1165e9470f1SDavid SchultzThe 1175e9470f1SDavid Schultz.Fn cproj 1185e9470f1SDavid Schultzfunctions appeared in 1195e9470f1SDavid Schultz.Fx 8.0 . 120