~ubuntu-branches/ubuntu/wily/musl/wily

« back to all changes in this revision

Viewing changes to src/math/frexpl.c

  • Committer: Package Import Robot
  • Author(s): Kevin Bortis
  • Date: 2013-09-27 23:47:18 UTC
  • mfrom: (1.1.1)
  • Revision ID: package-import@ubuntu.com-20130927234718-a96bgcnvzx5buf60
Tags: 0.9.14-1
* Import upstream version 0.9.14
* Only build on fully supported architectures
* Point to new homepage in control file (Closes: #724277)
* Revorked debian/rules
* Solved possible problem with postrm script (Closes: #724247)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#include <math.h>
2
 
#include <stdint.h>
3
 
#include <float.h>
4
 
 
5
 
#if LDBL_MANT_DIG == 64 && LDBL_MAX_EXP == 16384
6
 
 
7
 
/* This version is for 80-bit little endian long double */
8
 
 
9
 
long double frexpl(long double x, int *e)
10
 
{
11
 
        union { long double ld; uint16_t hw[5]; } y = { x };
12
 
        int ee = y.hw[4]&0x7fff;
 
1
#include "libm.h"
 
2
 
 
3
#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
 
4
long double frexpl(long double x, int *e)
 
5
{
 
6
        return frexp(x, e);
 
7
}
 
8
#elif (LDBL_MANT_DIG == 64 || LDBL_MANT_DIG == 113) && LDBL_MAX_EXP == 16384
 
9
long double frexpl(long double x, int *e)
 
10
{
 
11
        union ldshape u = {x};
 
12
        int ee = u.i.se & 0x7fff;
13
13
 
14
14
        if (!ee) {
15
15
                if (x) {
16
 
                        x = frexpl(x*0x1p64, e);
17
 
                        *e -= 64;
 
16
                        x = frexpl(x*0x1p120, e);
 
17
                        *e -= 120;
18
18
                } else *e = 0;
19
19
                return x;
20
20
        } else if (ee == 0x7fff) {
22
22
        }
23
23
 
24
24
        *e = ee - 0x3ffe;
25
 
        y.hw[4] &= 0x8000;
26
 
        y.hw[4] |= 0x3ffe;
27
 
        return y.ld;
28
 
}
29
 
 
30
 
#else
31
 
 
32
 
long double frexpl(long double x, int *e)
33
 
{
34
 
        return frexp(x, e);
35
 
}
36
 
 
 
25
        u.i.se &= 0x8000;
 
26
        u.i.se |= 0x3ffe;
 
27
        return u.f;
 
28
}
37
29
#endif