OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [linux/] [uClibc/] [libm/] [w_sqrtf.c] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1325 phoenix
/* vi: set sw=4 ts=4: */
2
/* sqrtf for uClibc
3
 *
4
 * Copyright (C) 2002 by Erik Andersen <andersen@uclibc.org>
5
 *
6
 * This program is free software; you can redistribute it and/or modify it
7
 * under the terms of the GNU Library General Public License as published by
8
 * the Free Software Foundation; either version 2 of the License, or (at your
9
 * option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful, but WITHOUT
12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13
 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License
14
 * for more details.
15
 *
16
 * You should have received a copy of the GNU Library General Public License
17
 * along with this program; if not, write to the Free Software Foundation,
18
 * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
 */
20
 
21
/*
22
 * wrapper for sqrt(x)
23
 */
24
 
25
#include "math.h"
26
#include "math_private.h"
27
 
28
#ifdef __STDC__
29
        float sqrtf(float x)            /* wrapper sqrt */
30
#else
31
        float sqrtf(x)                  /* wrapper sqrt */
32
        float x;
33
#endif
34
{
35
#ifdef _IEEE_LIBM
36
        return __ieee754_sqrt(x);
37
#else
38
        float z;
39
        z = __ieee754_sqrt(x);
40
        if(_LIB_VERSION == _IEEE_ || isnan(x)) return z;
41
        if(x<0.0) {
42
            return __kernel_standard(x,x,26); /* sqrt(negative) */
43
        } else
44
            return z;
45
#endif
46
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.