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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [newlib-1.17.0/] [newlib/] [libm/] [math/] [wf_remainder.c] - Blame information for rev 455

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 148 jeremybenn
/* wf_remainder.c -- float version of w_remainder.c.
2
 * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
3
 */
4
 
5
/*
6
 * ====================================================
7
 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
8
 *
9
 * Developed at SunPro, a Sun Microsystems, Inc. business.
10
 * Permission to use, copy, modify, and distribute this
11
 * software is freely granted, provided that this notice
12
 * is preserved.
13
 * ====================================================
14
 */
15
 
16
/*
17
 * wrapper remainderf(x,p)
18
 */
19
 
20
#include "fdlibm.h"
21
#include <errno.h>
22
 
23
#ifdef __STDC__
24
        float remainderf(float x, float y)      /* wrapper remainder */
25
#else
26
        float remainderf(x,y)                   /* wrapper remainder */
27
        float x,y;
28
#endif
29
{
30
#ifdef _IEEE_LIBM
31
        return __ieee754_remainderf(x,y);
32
#else
33
        float z;
34
        struct exception exc;
35
        z = __ieee754_remainderf(x,y);
36
        if(_LIB_VERSION == _IEEE_ || isnanf(y)) return z;
37
        if(y==(float)0.0) {
38
            /* remainderf(x,0) */
39
            exc.type = DOMAIN;
40
            exc.name = "remainderf";
41
            exc.err = 0;
42
            exc.arg1 = (double)x;
43
            exc.arg2 = (double)y;
44
            exc.retval = 0.0/0.0;
45
            if (_LIB_VERSION == _POSIX_)
46
               errno = EDOM;
47
            else if (!matherr(&exc)) {
48
               errno = EDOM;
49
            }
50
            if (exc.err != 0)
51
               errno = exc.err;
52
            return (float)exc.retval;
53
        } else
54
            return z;
55
#endif
56
}
57
 
58
#ifdef _DOUBLE_IS_32BITS
59
 
60
#ifdef __STDC__
61
        double remainder(double x, double y)
62
#else
63
        double remainder(x,y)
64
        double x,y;
65
#endif
66
{
67
        return (double) remainderf((float) x, (float) y);
68
}
69
 
70
#endif /* defined(_DOUBLE_IS_32BITS) */
71
 
72
 
73
 
74
 

powered by: WebSVN 2.1.0

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