1*476bc7b6Sguenther /* $OpenBSD: fabs.c,v 1.9 2014/04/17 09:01:25 guenther Exp $ */
2aeb694e3Smartynas
3aeb694e3Smartynas /*
4aeb694e3Smartynas * Copyright (c) 2002 Theo de Raadt
5aeb694e3Smartynas * All rights reserved.
6aeb694e3Smartynas *
7aeb694e3Smartynas * Redistribution and use in source and binary forms, with or without
8aeb694e3Smartynas * modification, are permitted provided that the following conditions
9aeb694e3Smartynas * are met:
10aeb694e3Smartynas * 1. Redistributions of source code must retain the above copyright
11aeb694e3Smartynas * notice, this list of conditions and the following disclaimer.
12aeb694e3Smartynas * 2. Redistributions in binary form must reproduce the above copyright
13aeb694e3Smartynas * notice, this list of conditions and the following disclaimer in the
14aeb694e3Smartynas * documentation and/or other materials provided with the distribution.
15aeb694e3Smartynas *
16aeb694e3Smartynas * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17aeb694e3Smartynas * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18aeb694e3Smartynas * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19aeb694e3Smartynas * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20aeb694e3Smartynas * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21aeb694e3Smartynas * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22aeb694e3Smartynas * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23aeb694e3Smartynas * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24aeb694e3Smartynas * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25aeb694e3Smartynas * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26aeb694e3Smartynas */
27aeb694e3Smartynas
28aeb694e3Smartynas #include <math.h>
29aeb694e3Smartynas
30aeb694e3Smartynas double
fabs(double x)31aeb694e3Smartynas fabs(double x)
32aeb694e3Smartynas {
33*476bc7b6Sguenther __asm__ volatile("fabs %0,%1" : "=f"(x) : "f"(x));
34aeb694e3Smartynas return (x);
35aeb694e3Smartynas }
36aeb694e3Smartynas
372fbf033eSmartynas __strong_alias(fabsl, fabs);
38