1178580Simp/* $NetBSD: fabs.c,v 1.2 2002/05/26 11:48:01 wiz Exp $ */ 2178580Simp 3178580Simp/* 4178580Simp * Copyright (c) 1996 Mark Brinicombe 5178580Simp * 6178580Simp * Redistribution and use in source and binary forms, with or without 7178580Simp * modification, are permitted provided that the following conditions 8178580Simp * are met: 9178580Simp * 1. Redistributions of source code must retain the above copyright 10178580Simp * notice, this list of conditions and the following disclaimer. 11178580Simp * 2. Redistributions in binary form must reproduce the above copyright 12178580Simp * notice, this list of conditions and the following disclaimer in the 13178580Simp * documentation and/or other materials provided with the distribution. 14178580Simp * 3. All advertising materials mentioning features or use of this software 15178580Simp * must display the following acknowledgement: 16178580Simp * This product includes software developed by Mark Brinicombe 17178580Simp * 4. Neither the name of the University nor the names of its contributors 18178580Simp * may be used to endorse or promote products derived from this software 19178580Simp * without specific prior written permission. 20178580Simp * 21178580Simp * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 22178580Simp * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23178580Simp * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24178580Simp * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 25178580Simp * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26178580Simp * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27178580Simp * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28178580Simp * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29178580Simp * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30178580Simp * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31178580Simp * SUCH DAMAGE. 32178580Simp */ 33178580Simp 34178580Simp/* 35178580Simp * fabs(x) returns the absolute value of x. 36178580Simp */ 37178580Simp#include <sys/cdefs.h> 38178580Simp__FBSDID("$FreeBSD: releng/10.3/lib/libc/mips/gen/fabs.c 178580 2008-04-26 12:08:02Z imp $"); 39178580Simp 40178580Simpdouble 41178580Simpfabs(double x) 42178580Simp{ 43178580Simp if (x < 0) 44178580Simp x = -x; 45178580Simp return(x); 46178580Simp} 47