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/] [common/] [sf_remquo.c] - Blame information for rev 158

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 148 jeremybenn
/* Copyright (C) 2002 by  Red Hat, Incorporated. All rights reserved.
2
 *
3
 * Permission to use, copy, modify, and distribute this software
4
 * is freely granted, provided that this notice is preserved.
5
 */
6
 
7
#include "fdlibm.h"
8
 
9
#ifdef __STDC__
10
        float remquof(float x, float y, int *quo)       /* wrapper remquof */
11
#else
12
        float remquof(x,y,quo)                  /* wrapper remquof */
13
        float x,y;
14
        int *quo;
15
#endif
16
{
17
        int signx, signy, signres;
18
        int wx;
19
        int wy;
20
        float x_over_y;
21
 
22
        GET_FLOAT_WORD(wx, x);
23
        GET_FLOAT_WORD(wy, y);
24
 
25
        signx = (wx & 0x80000000) >> 31;
26
        signy = (wy & 0x80000000) >> 31;
27
 
28
        signres = (signx ^ signy) ? -1 : 1;
29
 
30
        x_over_y = fabsf(x / y);
31
 
32
        *quo = signres * (lrintf(x_over_y) & 0x7f);
33
 
34
        return remainderf(x,y);
35
}
36
 
37
#ifdef _DOUBLE_IS_32BITS
38
 
39
#ifdef __STDC__
40
        double remquo(double x, double y, int *quo)     /* wrapper remquof */
41
#else
42
        double remquo(x,y,quo)                  /* wrapper remquof */
43
        double x,y;
44
        int *quo;
45
#endif
46
{
47
        return (double) remquof((float) x, (float) y, quo);
48
}
49
 
50
#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.