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

Subversion Repositories openrisc

[/] [openrisc/] [tags/] [gnu-src/] [newlib-1.18.0/] [newlib-1.18.0-or32-1.0rc1/] [newlib/] [libm/] [math/] [w_remainder.c] - Diff between revs 207 and 345

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

Rev 207 Rev 345
 
 
/* @(#)w_remainder.c 5.1 93/09/24 */
/* @(#)w_remainder.c 5.1 93/09/24 */
/*
/*
 * ====================================================
 * ====================================================
 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
 *
 *
 * Developed at SunPro, a Sun Microsystems, Inc. business.
 * Developed at SunPro, a Sun Microsystems, Inc. business.
 * Permission to use, copy, modify, and distribute this
 * Permission to use, copy, modify, and distribute this
 * software is freely granted, provided that this notice
 * software is freely granted, provided that this notice
 * is preserved.
 * is preserved.
 * ====================================================
 * ====================================================
 */
 */
 
 
/*
/*
FUNCTION
FUNCTION
<<remainder>>, <<remainderf>>---round and  remainder
<<remainder>>, <<remainderf>>---round and  remainder
INDEX
INDEX
        remainder
        remainder
INDEX
INDEX
        remainderf
        remainderf
 
 
ANSI_SYNOPSIS
ANSI_SYNOPSIS
        #include <math.h>
        #include <math.h>
        double remainder(double <[x]>, double <[y]>);
        double remainder(double <[x]>, double <[y]>);
        float remainderf(float <[x]>, float <[y]>);
        float remainderf(float <[x]>, float <[y]>);
 
 
TRAD_SYNOPSIS
TRAD_SYNOPSIS
        #include <math.h>
        #include <math.h>
        double remainder(<[x]>,<[y]>)
        double remainder(<[x]>,<[y]>)
        double <[x]>, <[y]>;
        double <[x]>, <[y]>;
        float remainderf(<[x]>,<[y]>)
        float remainderf(<[x]>,<[y]>)
        float <[x]>, <[y]>;
        float <[x]>, <[y]>;
 
 
DESCRIPTION
DESCRIPTION
<<remainder>> and <<remainderf>> find the remainder of
<<remainder>> and <<remainderf>> find the remainder of
<[x]>/<[y]>; this value is in the range -<[y]>/2 .. +<[y]>/2.
<[x]>/<[y]>; this value is in the range -<[y]>/2 .. +<[y]>/2.
 
 
RETURNS
RETURNS
<<remainder>> returns the integer result as a double.
<<remainder>> returns the integer result as a double.
 
 
PORTABILITY
PORTABILITY
<<remainder>> is a System V release 4.
<<remainder>> is a System V release 4.
<<remainderf>> is an extension.
<<remainderf>> is an extension.
 
 
*/
*/
 
 
/*
/*
 * wrapper remainder(x,p)
 * wrapper remainder(x,p)
 */
 */
 
 
#include "fdlibm.h"
#include "fdlibm.h"
#include <errno.h>
#include <errno.h>
 
 
#ifndef _DOUBLE_IS_32BITS
#ifndef _DOUBLE_IS_32BITS
 
 
#ifdef __STDC__
#ifdef __STDC__
        double remainder(double x, double y)    /* wrapper remainder */
        double remainder(double x, double y)    /* wrapper remainder */
#else
#else
        double remainder(x,y)                   /* wrapper remainder */
        double remainder(x,y)                   /* wrapper remainder */
        double x,y;
        double x,y;
#endif
#endif
{
{
#ifdef _IEEE_LIBM
#ifdef _IEEE_LIBM
        return __ieee754_remainder(x,y);
        return __ieee754_remainder(x,y);
#else
#else
        double z;
        double z;
        struct exception exc;
        struct exception exc;
        z = __ieee754_remainder(x,y);
        z = __ieee754_remainder(x,y);
        if(_LIB_VERSION == _IEEE_ || isnan(y)) return z;
        if(_LIB_VERSION == _IEEE_ || isnan(y)) return z;
        if(y==0.0) {
        if(y==0.0) {
            /* remainder(x,0) */
            /* remainder(x,0) */
            exc.type = DOMAIN;
            exc.type = DOMAIN;
            exc.name = "remainder";
            exc.name = "remainder";
            exc.err = 0;
            exc.err = 0;
            exc.arg1 = x;
            exc.arg1 = x;
            exc.arg2 = y;
            exc.arg2 = y;
            exc.retval = 0.0/0.0;
            exc.retval = 0.0/0.0;
            if (_LIB_VERSION == _POSIX_)
            if (_LIB_VERSION == _POSIX_)
               errno = EDOM;
               errno = EDOM;
            else if (!matherr(&exc)) {
            else if (!matherr(&exc)) {
               errno = EDOM;
               errno = EDOM;
            }
            }
            if (exc.err != 0)
            if (exc.err != 0)
               errno = exc.err;
               errno = exc.err;
            return exc.retval;
            return exc.retval;
        } else
        } else
            return z;
            return z;
#endif
#endif
}
}
 
 
#endif /* defined(_DOUBLE_IS_32BITS) */
#endif /* defined(_DOUBLE_IS_32BITS) */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

powered by: WebSVN 2.1.0

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