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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [linux/] [uClibc/] [libm/] [w_sqrtf.c] - Diff between revs 1325 and 1765

Only display areas with differences | Details | Blame | View Log

Rev 1325 Rev 1765
/* vi: set sw=4 ts=4: */
/* vi: set sw=4 ts=4: */
/* sqrtf for uClibc
/* sqrtf for uClibc
 *
 *
 * Copyright (C) 2002 by Erik Andersen <andersen@uclibc.org>
 * Copyright (C) 2002 by Erik Andersen <andersen@uclibc.org>
 *
 *
 * This program is free software; you can redistribute it and/or modify it
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Library General Public License as published by
 * under the terms of the GNU Library General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or (at your
 * the Free Software Foundation; either version 2 of the License, or (at your
 * option) any later version.
 * option) any later version.
 *
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License
 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License
 * for more details.
 * for more details.
 *
 *
 * You should have received a copy of the GNU Library General Public License
 * You should have received a copy of the GNU Library General Public License
 * along with this program; if not, write to the Free Software Foundation,
 * along with this program; if not, write to the Free Software Foundation,
 * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 */
 */
 
 
/*
/*
 * wrapper for sqrt(x)
 * wrapper for sqrt(x)
 */
 */
 
 
#include "math.h"
#include "math.h"
#include "math_private.h"
#include "math_private.h"
 
 
#ifdef __STDC__
#ifdef __STDC__
        float sqrtf(float x)            /* wrapper sqrt */
        float sqrtf(float x)            /* wrapper sqrt */
#else
#else
        float sqrtf(x)                  /* wrapper sqrt */
        float sqrtf(x)                  /* wrapper sqrt */
        float x;
        float x;
#endif
#endif
{
{
#ifdef _IEEE_LIBM
#ifdef _IEEE_LIBM
        return __ieee754_sqrt(x);
        return __ieee754_sqrt(x);
#else
#else
        float z;
        float z;
        z = __ieee754_sqrt(x);
        z = __ieee754_sqrt(x);
        if(_LIB_VERSION == _IEEE_ || isnan(x)) return z;
        if(_LIB_VERSION == _IEEE_ || isnan(x)) return z;
        if(x<0.0) {
        if(x<0.0) {
            return __kernel_standard(x,x,26); /* sqrt(negative) */
            return __kernel_standard(x,x,26); /* sqrt(negative) */
        } else
        } else
            return z;
            return z;
#endif
#endif
}
}
 
 

powered by: WebSVN 2.1.0

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