source: trunk/libs/newlib/src/newlib/libm/math/wf_remainder.c @ 471

Last change on this file since 471 was 444, checked in by satin@…, 6 years ago

add newlib,libalmos-mkh, restructure shared_syscalls.h and mini-libc

File size: 1.6 KB
Line 
1/* 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_ || isnan(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
Note: See TracBrowser for help on using the repository browser.