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