~ubuntu-branches/ubuntu/precise/eglibc/precise-201308281639

« back to all changes in this revision

Viewing changes to sysdeps/ieee754/ldbl-128/e_remainderl.c

  • Committer: Package Import Robot
  • Author(s): Matthias Klose
  • Date: 2012-02-08 01:58:09 UTC
  • mfrom: (1.5.3) (288.1.12 precise)
  • Revision ID: package-import@ubuntu.com-20120208015809-ulscst7uteq3e22z
Tags: 2.15~pre6-0ubuntu10
Merge from Debian (r5151, 2.13-26).

Show diffs side-by-side

added added

removed removed

Lines of Context:
7
7
 *
8
8
 * Developed at SunPro, a Sun Microsystems, Inc. business.
9
9
 * Permission to use, copy, modify, and distribute this
10
 
 * software is freely granted, provided that this notice 
 
10
 * software is freely granted, provided that this notice
11
11
 * is preserved.
12
12
 * ====================================================
13
13
 */
14
14
 
15
15
/* __ieee754_remainderl(x,p)
16
 
 * Return :                  
17
 
 *      returns  x REM p  =  x - [x/p]*p as if in infinite 
18
 
 *      precise arithmetic, where [x/p] is the (infinite bit) 
 
16
 * Return :
 
17
 *      returns  x REM p  =  x - [x/p]*p as if in infinite
 
18
 *      precise arithmetic, where [x/p] is the (infinite bit)
19
19
 *      integer nearest x/p (in half way case choose the even one).
20
 
 * Method : 
 
20
 * Method :
21
21
 *      Based on fmodl() return x-[x/p]chopped*p exactlp.
22
22
 */
23
23
 
24
24
#include "math.h"
25
25
#include "math_private.h"
26
26
 
27
 
#ifdef __STDC__
28
27
static const long double zero = 0.0L;
29
 
#else
30
 
static long double zero = 0.0L;
31
 
#endif
32
 
 
33
 
 
34
 
#ifdef __STDC__
35
 
        long double __ieee754_remainderl(long double x, long double p)
36
 
#else
37
 
        long double __ieee754_remainderl(x,p)
38
 
        long double x,p;
39
 
#endif
 
28
 
 
29
 
 
30
long double
 
31
__ieee754_remainderl(long double x, long double p)
40
32
{
41
33
        int64_t hx,hp;
42
34
        u_int64_t sx,lx,lp;
49
41
        hx &= 0x7fffffffffffffffLL;
50
42
 
51
43
    /* purge off exception values */
52
 
        if((hp|lp)==0) return (x*p)/(x*p);      /* p = 0 */
 
44
        if((hp|lp)==0) return (x*p)/(x*p);      /* p = 0 */
53
45
        if((hx>=0x7fff000000000000LL)||                 /* x not finite */
54
46
          ((hp>=0x7fff000000000000LL)&&                 /* p is NaN */
55
47
          (((hp-0x7fff000000000000LL)|lp)!=0)))
76
68
        SET_LDOUBLE_MSW64(x,hx^sx);
77
69
        return x;
78
70
}
 
71
strong_alias (__ieee754_remainderl, __remainderl_finite)