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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [newlib-1.18.0/] [newlib/] [libm/] [math/] [w_remainder.c] - Blame information for rev 307

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

Line No. Rev Author Line
1 207 jeremybenn
 
2
/* @(#)w_remainder.c 5.1 93/09/24 */
3
/*
4
 * ====================================================
5
 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
6
 *
7
 * Developed at SunPro, a Sun Microsystems, Inc. business.
8
 * Permission to use, copy, modify, and distribute this
9
 * software is freely granted, provided that this notice
10
 * is preserved.
11
 * ====================================================
12
 */
13
 
14
/*
15
FUNCTION
16
<<remainder>>, <<remainderf>>---round and  remainder
17
INDEX
18
        remainder
19
INDEX
20
        remainderf
21
 
22
ANSI_SYNOPSIS
23
        #include <math.h>
24
        double remainder(double <[x]>, double <[y]>);
25
        float remainderf(float <[x]>, float <[y]>);
26
 
27
TRAD_SYNOPSIS
28
        #include <math.h>
29
        double remainder(<[x]>,<[y]>)
30
        double <[x]>, <[y]>;
31
        float remainderf(<[x]>,<[y]>)
32
        float <[x]>, <[y]>;
33
 
34
DESCRIPTION
35
<<remainder>> and <<remainderf>> find the remainder of
36
<[x]>/<[y]>; this value is in the range -<[y]>/2 .. +<[y]>/2.
37
 
38
RETURNS
39
<<remainder>> returns the integer result as a double.
40
 
41
PORTABILITY
42
<<remainder>> is a System V release 4.
43
<<remainderf>> is an extension.
44
 
45
*/
46
 
47
/*
48
 * wrapper remainder(x,p)
49
 */
50
 
51
#include "fdlibm.h"
52
#include <errno.h>
53
 
54
#ifndef _DOUBLE_IS_32BITS
55
 
56
#ifdef __STDC__
57
        double remainder(double x, double y)    /* wrapper remainder */
58
#else
59
        double remainder(x,y)                   /* wrapper remainder */
60
        double x,y;
61
#endif
62
{
63
#ifdef _IEEE_LIBM
64
        return __ieee754_remainder(x,y);
65
#else
66
        double z;
67
        struct exception exc;
68
        z = __ieee754_remainder(x,y);
69
        if(_LIB_VERSION == _IEEE_ || isnan(y)) return z;
70
        if(y==0.0) {
71
            /* remainder(x,0) */
72
            exc.type = DOMAIN;
73
            exc.name = "remainder";
74
            exc.err = 0;
75
            exc.arg1 = x;
76
            exc.arg2 = y;
77
            exc.retval = 0.0/0.0;
78
            if (_LIB_VERSION == _POSIX_)
79
               errno = EDOM;
80
            else if (!matherr(&exc)) {
81
               errno = EDOM;
82
            }
83
            if (exc.err != 0)
84
               errno = exc.err;
85
            return exc.retval;
86
        } else
87
            return z;
88
#endif
89
}
90
 
91
#endif /* defined(_DOUBLE_IS_32BITS) */
92
 
93
 
94
 
95
 
96
 
97
 
98
 
99
 
100
 
101
 
102
 
103
 
104
 
105
 
106
 
107
 
108
 

powered by: WebSVN 2.1.0

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