117303c62SDavid Schultz /*- 2*4d846d26SWarner Losh * SPDX-License-Identifier: BSD-2-Clause 35e53a4f9SPedro F. Giffuni * 417303c62SDavid Schultz * Copyright (c) 2005-2008 David Schultz <das@FreeBSD.ORG> 517303c62SDavid Schultz * All rights reserved. 617303c62SDavid Schultz * 717303c62SDavid Schultz * Redistribution and use in source and binary forms, with or without 817303c62SDavid Schultz * modification, are permitted provided that the following conditions 917303c62SDavid Schultz * are met: 1017303c62SDavid Schultz * 1. Redistributions of source code must retain the above copyright 1117303c62SDavid Schultz * notice, this list of conditions and the following disclaimer. 1217303c62SDavid Schultz * 2. Redistributions in binary form must reproduce the above copyright 1317303c62SDavid Schultz * notice, this list of conditions and the following disclaimer in the 1417303c62SDavid Schultz * documentation and/or other materials provided with the distribution. 1517303c62SDavid Schultz * 1617303c62SDavid Schultz * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 1717303c62SDavid Schultz * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1817303c62SDavid Schultz * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 1917303c62SDavid Schultz * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 2017303c62SDavid Schultz * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2117303c62SDavid Schultz * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2217303c62SDavid Schultz * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2317303c62SDavid Schultz * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2417303c62SDavid Schultz * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2517303c62SDavid Schultz * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2617303c62SDavid Schultz * SUCH DAMAGE. 2717303c62SDavid Schultz */ 2817303c62SDavid Schultz 2917303c62SDavid Schultz #include <sys/cdefs.h> 3017303c62SDavid Schultz __FBSDID("$FreeBSD$"); 3117303c62SDavid Schultz 3217303c62SDavid Schultz #include <complex.h> 3317303c62SDavid Schultz #include <math.h> 3417303c62SDavid Schultz 3517303c62SDavid Schultz long double 3617303c62SDavid Schultz cargl(long double complex z) 3717303c62SDavid Schultz { 3817303c62SDavid Schultz 3917303c62SDavid Schultz return (atan2l(cimagl(z), creall(z))); 4017303c62SDavid Schultz } 41