1174561Sdas/*-
2174561Sdas * Copyright (c) 2005 David Schultz <das@FreeBSD.ORG>
3174561Sdas * All rights reserved.
4174561Sdas *
5174561Sdas * Redistribution and use in source and binary forms, with or without
6174561Sdas * modification, are permitted provided that the following conditions
7174561Sdas * are met:
8174561Sdas * 1. Redistributions of source code must retain the above copyright
9174561Sdas *    notice, this list of conditions and the following disclaimer.
10174561Sdas * 2. Redistributions in binary form must reproduce the above copyright
11174561Sdas *    notice, this list of conditions and the following disclaimer in the
12174561Sdas *    documentation and/or other materials provided with the distribution.
13174561Sdas *
14174561Sdas * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15174561Sdas * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16174561Sdas * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17174561Sdas * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18174561Sdas * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19174561Sdas * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20174561Sdas * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21174561Sdas * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22174561Sdas * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23174561Sdas * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24174561Sdas * SUCH DAMAGE.
25174561Sdas */
26174561Sdas
27174561Sdas#include <sys/cdefs.h>
28174561Sdas__FBSDID("$FreeBSD$");
29174561Sdas
30174561Sdas#include <complex.h>
31174561Sdas#include <math.h>
32174561Sdas
33174561Sdasdouble
34174561Sdascarg(double complex z)
35174561Sdas{
36174561Sdas
37174561Sdas	return (atan2(cimag(z), creal(z)));
38174561Sdas}
39