15e9470f1SDavid Schultz /*- 25e9470f1SDavid Schultz * Copyright (c) 2008 David Schultz <das@FreeBSD.ORG> 35e9470f1SDavid Schultz * All rights reserved. 45e9470f1SDavid Schultz * 55e9470f1SDavid Schultz * Redistribution and use in source and binary forms, with or without 65e9470f1SDavid Schultz * modification, are permitted provided that the following conditions 75e9470f1SDavid Schultz * are met: 85e9470f1SDavid Schultz * 1. Redistributions of source code must retain the above copyright 95e9470f1SDavid Schultz * notice, this list of conditions and the following disclaimer. 105e9470f1SDavid Schultz * 2. Redistributions in binary form must reproduce the above copyright 115e9470f1SDavid Schultz * notice, this list of conditions and the following disclaimer in the 125e9470f1SDavid Schultz * documentation and/or other materials provided with the distribution. 135e9470f1SDavid Schultz * 145e9470f1SDavid Schultz * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 155e9470f1SDavid Schultz * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 165e9470f1SDavid Schultz * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 175e9470f1SDavid Schultz * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 185e9470f1SDavid Schultz * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 195e9470f1SDavid Schultz * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 205e9470f1SDavid Schultz * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 215e9470f1SDavid Schultz * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 225e9470f1SDavid Schultz * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 235e9470f1SDavid Schultz * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 245e9470f1SDavid Schultz * SUCH DAMAGE. 255e9470f1SDavid Schultz */ 265e9470f1SDavid Schultz 275e9470f1SDavid Schultz #include <sys/cdefs.h> 285e9470f1SDavid Schultz __FBSDID("$FreeBSD$"); 295e9470f1SDavid Schultz 305e9470f1SDavid Schultz #include <complex.h> 315e9470f1SDavid Schultz #include <math.h> 325e9470f1SDavid Schultz 335e9470f1SDavid Schultz #include "math_private.h" 345e9470f1SDavid Schultz 355e9470f1SDavid Schultz double complex 365e9470f1SDavid Schultz cproj(double complex z) 375e9470f1SDavid Schultz { 385e9470f1SDavid Schultz 395e9470f1SDavid Schultz if (!isinf(creal(z)) && !isinf(cimag(z))) 405e9470f1SDavid Schultz return (z); 415e9470f1SDavid Schultz else 42*2cec876aSEd Schouten return (CMPLX(INFINITY, copysign(0.0, cimag(z)))); 435e9470f1SDavid Schultz } 445e9470f1SDavid Schultz 455e9470f1SDavid Schultz #if LDBL_MANT_DIG == 53 465e9470f1SDavid Schultz __weak_reference(cproj, cprojl); 475e9470f1SDavid Schultz #endif 48