s_cproj.c revision 181377
1181377Sdas/*- 2181377Sdas * Copyright (c) 2008 David Schultz <das@FreeBSD.ORG> 3181377Sdas * All rights reserved. 4181377Sdas * 5181377Sdas * Redistribution and use in source and binary forms, with or without 6181377Sdas * modification, are permitted provided that the following conditions 7181377Sdas * are met: 8181377Sdas * 1. Redistributions of source code must retain the above copyright 9181377Sdas * notice, this list of conditions and the following disclaimer. 10181377Sdas * 2. Redistributions in binary form must reproduce the above copyright 11181377Sdas * notice, this list of conditions and the following disclaimer in the 12181377Sdas * documentation and/or other materials provided with the distribution. 13181377Sdas * 14181377Sdas * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15181377Sdas * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16181377Sdas * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17181377Sdas * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18181377Sdas * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19181377Sdas * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20181377Sdas * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21181377Sdas * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22181377Sdas * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23181377Sdas * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24181377Sdas * SUCH DAMAGE. 25181377Sdas */ 26181377Sdas 27181377Sdas#include <sys/cdefs.h> 28181377Sdas__FBSDID("$FreeBSD: head/lib/msun/src/s_cproj.c 181377 2008-08-07 15:07:48Z das $"); 29181377Sdas 30181377Sdas#include <complex.h> 31181377Sdas#include <math.h> 32181377Sdas 33181377Sdas#include "math_private.h" 34181377Sdas 35181377Sdasdouble complex 36181377Sdascproj(double complex z) 37181377Sdas{ 38181377Sdas 39181377Sdas if (!isinf(creal(z)) && !isinf(cimag(z))) 40181377Sdas return (z); 41181377Sdas else 42181377Sdas return (cpack(INFINITY, copysign(0.0, cimag(z)))); 43181377Sdas} 44181377Sdas 45181377Sdas#if LDBL_MANT_DIG == 53 46181377Sdas__weak_reference(cproj, cprojl); 47181377Sdas#endif 48