xref: /freebsd/lib/libc/arm/gen/fabs.c (revision 2357939bc239bd5334a169b62313806178dd8f30)
12357939bSOlivier Houchard /*	$NetBSD: fabs.c,v 1.2 2002/05/26 11:48:01 wiz Exp $	*/
22357939bSOlivier Houchard 
32357939bSOlivier Houchard /*
42357939bSOlivier Houchard  * Copyright (c) 1996 Mark Brinicombe
52357939bSOlivier Houchard  *
62357939bSOlivier Houchard  * Redistribution and use in source and binary forms, with or without
72357939bSOlivier Houchard  * modification, are permitted provided that the following conditions
82357939bSOlivier Houchard  * are met:
92357939bSOlivier Houchard  * 1. Redistributions of source code must retain the above copyright
102357939bSOlivier Houchard  *    notice, this list of conditions and the following disclaimer.
112357939bSOlivier Houchard  * 2. Redistributions in binary form must reproduce the above copyright
122357939bSOlivier Houchard  *    notice, this list of conditions and the following disclaimer in the
132357939bSOlivier Houchard  *    documentation and/or other materials provided with the distribution.
142357939bSOlivier Houchard  * 3. All advertising materials mentioning features or use of this software
152357939bSOlivier Houchard  *    must display the following acknowledgement:
162357939bSOlivier Houchard  *	This product includes software developed by Mark Brinicombe
172357939bSOlivier Houchard  * 4. Neither the name of the University nor the names of its contributors
182357939bSOlivier Houchard  *    may be used to endorse or promote products derived from this software
192357939bSOlivier Houchard  *    without specific prior written permission.
202357939bSOlivier Houchard  *
212357939bSOlivier Houchard  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
222357939bSOlivier Houchard  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
232357939bSOlivier Houchard  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
242357939bSOlivier Houchard  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
252357939bSOlivier Houchard  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
262357939bSOlivier Houchard  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
272357939bSOlivier Houchard  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
282357939bSOlivier Houchard  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
292357939bSOlivier Houchard  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
302357939bSOlivier Houchard  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
312357939bSOlivier Houchard  * SUCH DAMAGE.
322357939bSOlivier Houchard  */
332357939bSOlivier Houchard 
342357939bSOlivier Houchard /*
352357939bSOlivier Houchard  * fabs(x) returns the absolute value of x.
362357939bSOlivier Houchard  */
372357939bSOlivier Houchard #include <sys/cdefs.h>
382357939bSOlivier Houchard __FBSDID("$FreeBSD$");
392357939bSOlivier Houchard 
402357939bSOlivier Houchard double
412357939bSOlivier Houchard fabs(double x)
422357939bSOlivier Houchard {
432357939bSOlivier Houchard 	if (x < 0)
442357939bSOlivier Houchard 		x = -x;
452357939bSOlivier Houchard 	return(x);
462357939bSOlivier Houchard }
47