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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [newlib-1.17.0/] [newlib/] [libm/] [common/] [s_remquo.c] - Blame information for rev 855

Go to most recent revision | 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
#ifndef _DOUBLE_IS_32BITS
10
 
11
#ifdef __STDC__
12
        double remquo(double x, double y, int *quo)     /* wrapper remquo */
13
#else
14
        double remquo(x,y,quo)                  /* wrapper remquo */
15
        double x,y;
16
        int *quo;
17
#endif
18
{
19
        int signx, signy, signres;
20
        int mswx;
21
        int mswy;
22
        double x_over_y;
23
 
24
        GET_HIGH_WORD(mswx, x);
25
        GET_HIGH_WORD(mswy, y);
26
 
27
        signx = (mswx & 0x80000000) >> 31;
28
        signy = (mswy & 0x80000000) >> 31;
29
 
30
        signres = (signx ^ signy) ? -1 : 1;
31
 
32
        x_over_y = fabs(x / y);
33
 
34
        *quo = signres * (lrint(x_over_y) & 0x7f);
35
 
36
        return remainder(x,y);
37
}
38
 
39
#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.