@zigc/lib 0.16.0-dev.3070 → 0.16.0-dev.3121
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/c/math.zig +125 -22
- package/c/stropts.zig +17 -0
- package/c.zig +1 -0
- package/compiler_rt/cos.zig +141 -52
- package/compiler_rt/limb64.zig +266 -0
- package/compiler_rt/long_double.zig +37 -0
- package/compiler_rt/rem_pio2l.zig +173 -0
- package/compiler_rt/sin.zig +140 -55
- package/compiler_rt/sincos.zig +279 -72
- package/compiler_rt/tan.zig +118 -47
- package/compiler_rt/trig.zig +256 -6
- package/compiler_rt.zig +2 -0
- package/package.json +1 -1
- package/std/Build/Module.zig +1 -1
- package/std/Build/abi.zig +8 -4
- package/std/Io/Dispatch.zig +2 -0
- package/std/Io/File.zig +1 -0
- package/std/Io/Threaded.zig +2 -0
- package/std/Io/Uring.zig +1 -0
- package/std/array_list.zig +22 -31
- package/std/debug/Info.zig +4 -0
- package/std/debug/SelfInfo/Windows.zig +1 -0
- package/std/heap/ArenaAllocator.zig +145 -154
- package/std/mem/Allocator.zig +4 -5
- package/std/mem.zig +48 -0
- package/std/testing/Smith.zig +37 -2
- package/std/zig/Ast/Render.zig +186 -458
- package/std/zig/Ast.zig +0 -4
- package/std/zig/AstSmith.zig +2602 -0
- package/std/zig/Parse.zig +83 -74
- package/std/zig/system.zig +2 -0
- package/std/zig/tokenizer.zig +2 -1
- package/std/zig.zig +2 -0
- package/libc/mingw/math/arm/sincos.S +0 -30
- package/libc/mingw/math/arm-common/sincosl.c +0 -13
- package/libc/mingw/math/arm64/rint.c +0 -12
- package/libc/mingw/math/arm64/rintf.c +0 -12
- package/libc/mingw/math/arm64/sincos.S +0 -32
- package/libc/mingw/math/frexpf.c +0 -13
- package/libc/mingw/math/frexpl.c +0 -71
- package/libc/mingw/math/x86/cos.def.h +0 -65
- package/libc/mingw/math/x86/cosl.c +0 -46
- package/libc/mingw/math/x86/cosl_internal.S +0 -55
- package/libc/mingw/math/x86/sin.def.h +0 -65
- package/libc/mingw/math/x86/sinl.c +0 -46
- package/libc/mingw/math/x86/sinl_internal.S +0 -58
- package/libc/mingw/math/x86/tanl.S +0 -62
- package/libc/musl/src/legacy/isastream.c +0 -7
- package/libc/musl/src/math/__cosl.c +0 -96
- package/libc/musl/src/math/__sinl.c +0 -78
- package/libc/musl/src/math/__tanl.c +0 -143
- package/libc/musl/src/math/aarch64/lrint.c +0 -10
- package/libc/musl/src/math/aarch64/lrintf.c +0 -10
- package/libc/musl/src/math/aarch64/rintf.c +0 -7
- package/libc/musl/src/math/cosl.c +0 -39
- package/libc/musl/src/math/fdim.c +0 -10
- package/libc/musl/src/math/finite.c +0 -7
- package/libc/musl/src/math/finitef.c +0 -7
- package/libc/musl/src/math/frexp.c +0 -23
- package/libc/musl/src/math/frexpf.c +0 -23
- package/libc/musl/src/math/frexpl.c +0 -29
- package/libc/musl/src/math/i386/lrint.c +0 -8
- package/libc/musl/src/math/i386/lrintf.c +0 -8
- package/libc/musl/src/math/i386/rintf.c +0 -7
- package/libc/musl/src/math/lrint.c +0 -72
- package/libc/musl/src/math/lrintf.c +0 -8
- package/libc/musl/src/math/powerpc64/lrint.c +0 -16
- package/libc/musl/src/math/powerpc64/lrintf.c +0 -16
- package/libc/musl/src/math/rintf.c +0 -30
- package/libc/musl/src/math/s390x/rintf.c +0 -15
- package/libc/musl/src/math/sincosl.c +0 -60
- package/libc/musl/src/math/sinl.c +0 -41
- package/libc/musl/src/math/tanl.c +0 -29
- package/libc/musl/src/math/x32/lrint.s +0 -5
- package/libc/musl/src/math/x32/lrintf.s +0 -5
- package/libc/musl/src/math/x86_64/lrint.c +0 -8
- package/libc/musl/src/math/x86_64/lrintf.c +0 -8
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
/* origin: FreeBSD /usr/src/lib/msun/ld80/k_tanl.c */
|
|
2
|
-
/* origin: FreeBSD /usr/src/lib/msun/ld128/k_tanl.c */
|
|
3
|
-
/*
|
|
4
|
-
* ====================================================
|
|
5
|
-
* Copyright 2004 Sun Microsystems, Inc. All Rights Reserved.
|
|
6
|
-
* Copyright (c) 2008 Steven G. Kargl, David Schultz, Bruce D. Evans.
|
|
7
|
-
*
|
|
8
|
-
* Permission to use, copy, modify, and distribute this
|
|
9
|
-
* software is freely granted, provided that this notice
|
|
10
|
-
* is preserved.
|
|
11
|
-
* ====================================================
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
#include "libm.h"
|
|
15
|
-
|
|
16
|
-
#if (LDBL_MANT_DIG == 64 || LDBL_MANT_DIG == 113) && LDBL_MAX_EXP == 16384
|
|
17
|
-
#if LDBL_MANT_DIG == 64
|
|
18
|
-
/*
|
|
19
|
-
* ld80 version of __tan.c. See __tan.c for most comments.
|
|
20
|
-
*/
|
|
21
|
-
/*
|
|
22
|
-
* Domain [-0.67434, 0.67434], range ~[-2.25e-22, 1.921e-22]
|
|
23
|
-
* |tan(x)/x - t(x)| < 2**-71.9
|
|
24
|
-
*
|
|
25
|
-
* See __cosl.c for more details about the polynomial.
|
|
26
|
-
*/
|
|
27
|
-
static const long double
|
|
28
|
-
T3 = 0.333333333333333333180L, /* 0xaaaaaaaaaaaaaaa5.0p-65 */
|
|
29
|
-
T5 = 0.133333333333333372290L, /* 0x88888888888893c3.0p-66 */
|
|
30
|
-
T7 = 0.0539682539682504975744L, /* 0xdd0dd0dd0dc13ba2.0p-68 */
|
|
31
|
-
pio4 = 0.785398163397448309628L, /* 0xc90fdaa22168c235.0p-64 */
|
|
32
|
-
pio4lo = -1.25413940316708300586e-20L; /* -0xece675d1fc8f8cbb.0p-130 */
|
|
33
|
-
static const double
|
|
34
|
-
T9 = 0.021869488536312216, /* 0x1664f4882cc1c2.0p-58 */
|
|
35
|
-
T11 = 0.0088632355256619590, /* 0x1226e355c17612.0p-59 */
|
|
36
|
-
T13 = 0.0035921281113786528, /* 0x1d6d3d185d7ff8.0p-61 */
|
|
37
|
-
T15 = 0.0014558334756312418, /* 0x17da354aa3f96b.0p-62 */
|
|
38
|
-
T17 = 0.00059003538700862256, /* 0x13559358685b83.0p-63 */
|
|
39
|
-
T19 = 0.00023907843576635544, /* 0x1f56242026b5be.0p-65 */
|
|
40
|
-
T21 = 0.000097154625656538905, /* 0x1977efc26806f4.0p-66 */
|
|
41
|
-
T23 = 0.000038440165747303162, /* 0x14275a09b3ceac.0p-67 */
|
|
42
|
-
T25 = 0.000018082171885432524, /* 0x12f5e563e5487e.0p-68 */
|
|
43
|
-
T27 = 0.0000024196006108814377, /* 0x144c0d80cc6896.0p-71 */
|
|
44
|
-
T29 = 0.0000078293456938132840, /* 0x106b59141a6cb3.0p-69 */
|
|
45
|
-
T31 = -0.0000032609076735050182, /* -0x1b5abef3ba4b59.0p-71 */
|
|
46
|
-
T33 = 0.0000023261313142559411; /* 0x13835436c0c87f.0p-71 */
|
|
47
|
-
#define RPOLY(w) (T5 + w * (T9 + w * (T13 + w * (T17 + w * (T21 + \
|
|
48
|
-
w * (T25 + w * (T29 + w * T33)))))))
|
|
49
|
-
#define VPOLY(w) (T7 + w * (T11 + w * (T15 + w * (T19 + w * (T23 + \
|
|
50
|
-
w * (T27 + w * T31))))))
|
|
51
|
-
#elif LDBL_MANT_DIG == 113
|
|
52
|
-
/*
|
|
53
|
-
* ld128 version of __tan.c. See __tan.c for most comments.
|
|
54
|
-
*/
|
|
55
|
-
/*
|
|
56
|
-
* Domain [-0.67434, 0.67434], range ~[-3.37e-36, 1.982e-37]
|
|
57
|
-
* |tan(x)/x - t(x)| < 2**-117.8 (XXX should be ~1e-37)
|
|
58
|
-
*
|
|
59
|
-
* See __cosl.c for more details about the polynomial.
|
|
60
|
-
*/
|
|
61
|
-
static const long double
|
|
62
|
-
T3 = 0x1.5555555555555555555555555553p-2L,
|
|
63
|
-
T5 = 0x1.1111111111111111111111111eb5p-3L,
|
|
64
|
-
T7 = 0x1.ba1ba1ba1ba1ba1ba1ba1b694cd6p-5L,
|
|
65
|
-
T9 = 0x1.664f4882c10f9f32d6bbe09d8bcdp-6L,
|
|
66
|
-
T11 = 0x1.226e355e6c23c8f5b4f5762322eep-7L,
|
|
67
|
-
T13 = 0x1.d6d3d0e157ddfb5fed8e84e27b37p-9L,
|
|
68
|
-
T15 = 0x1.7da36452b75e2b5fce9ee7c2c92ep-10L,
|
|
69
|
-
T17 = 0x1.355824803674477dfcf726649efep-11L,
|
|
70
|
-
T19 = 0x1.f57d7734d1656e0aceb716f614c2p-13L,
|
|
71
|
-
T21 = 0x1.967e18afcb180ed942dfdc518d6cp-14L,
|
|
72
|
-
T23 = 0x1.497d8eea21e95bc7e2aa79b9f2cdp-15L,
|
|
73
|
-
T25 = 0x1.0b132d39f055c81be49eff7afd50p-16L,
|
|
74
|
-
T27 = 0x1.b0f72d33eff7bfa2fbc1059d90b6p-18L,
|
|
75
|
-
T29 = 0x1.5ef2daf21d1113df38d0fbc00267p-19L,
|
|
76
|
-
T31 = 0x1.1c77d6eac0234988cdaa04c96626p-20L,
|
|
77
|
-
T33 = 0x1.cd2a5a292b180e0bdd701057dfe3p-22L,
|
|
78
|
-
T35 = 0x1.75c7357d0298c01a31d0a6f7d518p-23L,
|
|
79
|
-
T37 = 0x1.2f3190f4718a9a520f98f50081fcp-24L,
|
|
80
|
-
pio4 = 0x1.921fb54442d18469898cc51701b8p-1L,
|
|
81
|
-
pio4lo = 0x1.cd129024e088a67cc74020bbea60p-116L;
|
|
82
|
-
static const double
|
|
83
|
-
T39 = 0.000000028443389121318352, /* 0x1e8a7592977938.0p-78 */
|
|
84
|
-
T41 = 0.000000011981013102001973, /* 0x19baa1b1223219.0p-79 */
|
|
85
|
-
T43 = 0.0000000038303578044958070, /* 0x107385dfb24529.0p-80 */
|
|
86
|
-
T45 = 0.0000000034664378216909893, /* 0x1dc6c702a05262.0p-81 */
|
|
87
|
-
T47 = -0.0000000015090641701997785, /* -0x19ecef3569ebb6.0p-82 */
|
|
88
|
-
T49 = 0.0000000029449552300483952, /* 0x194c0668da786a.0p-81 */
|
|
89
|
-
T51 = -0.0000000022006995706097711, /* -0x12e763b8845268.0p-81 */
|
|
90
|
-
T53 = 0.0000000015468200913196612, /* 0x1a92fc98c29554.0p-82 */
|
|
91
|
-
T55 = -0.00000000061311613386849674, /* -0x151106cbc779a9.0p-83 */
|
|
92
|
-
T57 = 1.4912469681508012e-10; /* 0x147edbdba6f43a.0p-85 */
|
|
93
|
-
#define RPOLY(w) (T5 + w * (T9 + w * (T13 + w * (T17 + w * (T21 + \
|
|
94
|
-
w * (T25 + w * (T29 + w * (T33 + w * (T37 + w * (T41 + \
|
|
95
|
-
w * (T45 + w * (T49 + w * (T53 + w * T57)))))))))))))
|
|
96
|
-
#define VPOLY(w) (T7 + w * (T11 + w * (T15 + w * (T19 + w * (T23 + \
|
|
97
|
-
w * (T27 + w * (T31 + w * (T35 + w * (T39 + w * (T43 + \
|
|
98
|
-
w * (T47 + w * (T51 + w * T55))))))))))))
|
|
99
|
-
#endif
|
|
100
|
-
|
|
101
|
-
long double __tanl(long double x, long double y, int odd) {
|
|
102
|
-
long double z, r, v, w, s, a, t;
|
|
103
|
-
int big, sign;
|
|
104
|
-
|
|
105
|
-
big = fabsl(x) >= 0.67434;
|
|
106
|
-
if (big) {
|
|
107
|
-
sign = 0;
|
|
108
|
-
if (x < 0) {
|
|
109
|
-
sign = 1;
|
|
110
|
-
x = -x;
|
|
111
|
-
y = -y;
|
|
112
|
-
}
|
|
113
|
-
x = (pio4 - x) + (pio4lo - y);
|
|
114
|
-
y = 0.0;
|
|
115
|
-
}
|
|
116
|
-
z = x * x;
|
|
117
|
-
w = z * z;
|
|
118
|
-
r = RPOLY(w);
|
|
119
|
-
v = z * VPOLY(w);
|
|
120
|
-
s = z * x;
|
|
121
|
-
r = y + z * (s * (r + v) + y) + T3 * s;
|
|
122
|
-
w = x + r;
|
|
123
|
-
if (big) {
|
|
124
|
-
s = 1 - 2*odd;
|
|
125
|
-
v = s - 2.0 * (x + (r - w * w / (w + s)));
|
|
126
|
-
return sign ? -v : v;
|
|
127
|
-
}
|
|
128
|
-
if (!odd)
|
|
129
|
-
return w;
|
|
130
|
-
/*
|
|
131
|
-
* if allow error up to 2 ulp, simply return
|
|
132
|
-
* -1.0 / (x+r) here
|
|
133
|
-
*/
|
|
134
|
-
/* compute -1.0 / (x+r) accurately */
|
|
135
|
-
z = w;
|
|
136
|
-
z = z + 0x1p32 - 0x1p32;
|
|
137
|
-
v = r - (z - x); /* z+v = r+x */
|
|
138
|
-
t = a = -1.0 / w; /* a = -1.0/w */
|
|
139
|
-
t = t + 0x1p32 - 0x1p32;
|
|
140
|
-
s = 1.0 + t * z;
|
|
141
|
-
return t + a * (s + t * v);
|
|
142
|
-
}
|
|
143
|
-
#endif
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
#include "libm.h"
|
|
2
|
-
|
|
3
|
-
#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
|
|
4
|
-
long double cosl(long double x) {
|
|
5
|
-
return cos(x);
|
|
6
|
-
}
|
|
7
|
-
#elif (LDBL_MANT_DIG == 64 || LDBL_MANT_DIG == 113) && LDBL_MAX_EXP == 16384
|
|
8
|
-
long double cosl(long double x)
|
|
9
|
-
{
|
|
10
|
-
union ldshape u = {x};
|
|
11
|
-
unsigned n;
|
|
12
|
-
long double y[2], hi, lo;
|
|
13
|
-
|
|
14
|
-
u.i.se &= 0x7fff;
|
|
15
|
-
if (u.i.se == 0x7fff)
|
|
16
|
-
return x - x;
|
|
17
|
-
x = u.f;
|
|
18
|
-
if (x < M_PI_4) {
|
|
19
|
-
if (u.i.se < 0x3fff - LDBL_MANT_DIG)
|
|
20
|
-
/* raise inexact if x!=0 */
|
|
21
|
-
return 1.0 + x;
|
|
22
|
-
return __cosl(x, 0);
|
|
23
|
-
}
|
|
24
|
-
n = __rem_pio2l(x, y);
|
|
25
|
-
hi = y[0];
|
|
26
|
-
lo = y[1];
|
|
27
|
-
switch (n & 3) {
|
|
28
|
-
case 0:
|
|
29
|
-
return __cosl(hi, lo);
|
|
30
|
-
case 1:
|
|
31
|
-
return -__sinl(hi, lo, 1);
|
|
32
|
-
case 2:
|
|
33
|
-
return -__cosl(hi, lo);
|
|
34
|
-
case 3:
|
|
35
|
-
default:
|
|
36
|
-
return __sinl(hi, lo, 1);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
#endif
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
#include <math.h>
|
|
2
|
-
#include <stdint.h>
|
|
3
|
-
|
|
4
|
-
double frexp(double x, int *e)
|
|
5
|
-
{
|
|
6
|
-
union { double d; uint64_t i; } y = { x };
|
|
7
|
-
int ee = y.i>>52 & 0x7ff;
|
|
8
|
-
|
|
9
|
-
if (!ee) {
|
|
10
|
-
if (x) {
|
|
11
|
-
x = frexp(x*0x1p64, e);
|
|
12
|
-
*e -= 64;
|
|
13
|
-
} else *e = 0;
|
|
14
|
-
return x;
|
|
15
|
-
} else if (ee == 0x7ff) {
|
|
16
|
-
return x;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
*e = ee - 0x3fe;
|
|
20
|
-
y.i &= 0x800fffffffffffffull;
|
|
21
|
-
y.i |= 0x3fe0000000000000ull;
|
|
22
|
-
return y.d;
|
|
23
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
#include <math.h>
|
|
2
|
-
#include <stdint.h>
|
|
3
|
-
|
|
4
|
-
float frexpf(float x, int *e)
|
|
5
|
-
{
|
|
6
|
-
union { float f; uint32_t i; } y = { x };
|
|
7
|
-
int ee = y.i>>23 & 0xff;
|
|
8
|
-
|
|
9
|
-
if (!ee) {
|
|
10
|
-
if (x) {
|
|
11
|
-
x = frexpf(x*0x1p64, e);
|
|
12
|
-
*e -= 64;
|
|
13
|
-
} else *e = 0;
|
|
14
|
-
return x;
|
|
15
|
-
} else if (ee == 0xff) {
|
|
16
|
-
return x;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
*e = ee - 0x7e;
|
|
20
|
-
y.i &= 0x807ffffful;
|
|
21
|
-
y.i |= 0x3f000000ul;
|
|
22
|
-
return y.f;
|
|
23
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
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
|
-
|
|
14
|
-
if (!ee) {
|
|
15
|
-
if (x) {
|
|
16
|
-
x = frexpl(x*0x1p120, e);
|
|
17
|
-
*e -= 120;
|
|
18
|
-
} else *e = 0;
|
|
19
|
-
return x;
|
|
20
|
-
} else if (ee == 0x7fff) {
|
|
21
|
-
return x;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
*e = ee - 0x3ffe;
|
|
25
|
-
u.i.se &= 0x8000;
|
|
26
|
-
u.i.se |= 0x3ffe;
|
|
27
|
-
return u.f;
|
|
28
|
-
}
|
|
29
|
-
#endif
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
#include <limits.h>
|
|
2
|
-
#include <fenv.h>
|
|
3
|
-
#include <math.h>
|
|
4
|
-
#include "libm.h"
|
|
5
|
-
|
|
6
|
-
/*
|
|
7
|
-
If the result cannot be represented (overflow, nan), then
|
|
8
|
-
lrint raises the invalid exception.
|
|
9
|
-
|
|
10
|
-
Otherwise if the input was not an integer then the inexact
|
|
11
|
-
exception is raised.
|
|
12
|
-
|
|
13
|
-
C99 is a bit vague about whether inexact exception is
|
|
14
|
-
allowed to be raised when invalid is raised.
|
|
15
|
-
(F.9 explicitly allows spurious inexact exceptions, F.9.6.5
|
|
16
|
-
does not make it clear if that rule applies to lrint, but
|
|
17
|
-
IEEE 754r 7.8 seems to forbid spurious inexact exception in
|
|
18
|
-
the ineger conversion functions)
|
|
19
|
-
|
|
20
|
-
So we try to make sure that no spurious inexact exception is
|
|
21
|
-
raised in case of an overflow.
|
|
22
|
-
|
|
23
|
-
If the bit size of long > precision of double, then there
|
|
24
|
-
cannot be inexact rounding in case the result overflows,
|
|
25
|
-
otherwise LONG_MAX and LONG_MIN can be represented exactly
|
|
26
|
-
as a double.
|
|
27
|
-
*/
|
|
28
|
-
|
|
29
|
-
#if LONG_MAX < 1U<<53 && defined(FE_INEXACT)
|
|
30
|
-
#include <float.h>
|
|
31
|
-
#include <stdint.h>
|
|
32
|
-
#if FLT_EVAL_METHOD==0 || FLT_EVAL_METHOD==1
|
|
33
|
-
#define EPS DBL_EPSILON
|
|
34
|
-
#elif FLT_EVAL_METHOD==2
|
|
35
|
-
#define EPS LDBL_EPSILON
|
|
36
|
-
#endif
|
|
37
|
-
#ifdef __GNUC__
|
|
38
|
-
/* avoid stack frame in lrint */
|
|
39
|
-
__attribute__((noinline))
|
|
40
|
-
#endif
|
|
41
|
-
static long lrint_slow(double x)
|
|
42
|
-
{
|
|
43
|
-
#pragma STDC FENV_ACCESS ON
|
|
44
|
-
int e;
|
|
45
|
-
|
|
46
|
-
e = fetestexcept(FE_INEXACT);
|
|
47
|
-
x = rint(x);
|
|
48
|
-
if (!e && (x > LONG_MAX || x < LONG_MIN))
|
|
49
|
-
feclearexcept(FE_INEXACT);
|
|
50
|
-
/* conversion */
|
|
51
|
-
return x;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
long lrint(double x)
|
|
55
|
-
{
|
|
56
|
-
uint32_t abstop = asuint64(x)>>32 & 0x7fffffff;
|
|
57
|
-
uint64_t sign = asuint64(x) & (1ULL << 63);
|
|
58
|
-
|
|
59
|
-
if (abstop < 0x41dfffff) {
|
|
60
|
-
/* |x| < 0x7ffffc00, no overflow */
|
|
61
|
-
double_t toint = asdouble(asuint64(1/EPS) | sign);
|
|
62
|
-
double_t y = x + toint - toint;
|
|
63
|
-
return (long)y;
|
|
64
|
-
}
|
|
65
|
-
return lrint_slow(x);
|
|
66
|
-
}
|
|
67
|
-
#else
|
|
68
|
-
long lrint(double x)
|
|
69
|
-
{
|
|
70
|
-
return rint(x);
|
|
71
|
-
}
|
|
72
|
-
#endif
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
#include <float.h>
|
|
2
|
-
#include <math.h>
|
|
3
|
-
#include <stdint.h>
|
|
4
|
-
|
|
5
|
-
#if FLT_EVAL_METHOD==0
|
|
6
|
-
#define EPS FLT_EPSILON
|
|
7
|
-
#elif FLT_EVAL_METHOD==1
|
|
8
|
-
#define EPS DBL_EPSILON
|
|
9
|
-
#elif FLT_EVAL_METHOD==2
|
|
10
|
-
#define EPS LDBL_EPSILON
|
|
11
|
-
#endif
|
|
12
|
-
static const float_t toint = 1/EPS;
|
|
13
|
-
|
|
14
|
-
float rintf(float x)
|
|
15
|
-
{
|
|
16
|
-
union {float f; uint32_t i;} u = {x};
|
|
17
|
-
int e = u.i>>23 & 0xff;
|
|
18
|
-
int s = u.i>>31;
|
|
19
|
-
float_t y;
|
|
20
|
-
|
|
21
|
-
if (e >= 0x7f+23)
|
|
22
|
-
return x;
|
|
23
|
-
if (s)
|
|
24
|
-
y = x - toint + toint;
|
|
25
|
-
else
|
|
26
|
-
y = x + toint - toint;
|
|
27
|
-
if (y == 0)
|
|
28
|
-
return s ? -0.0f : 0.0f;
|
|
29
|
-
return y;
|
|
30
|
-
}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
#define _GNU_SOURCE
|
|
2
|
-
#include "libm.h"
|
|
3
|
-
|
|
4
|
-
#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
|
|
5
|
-
void sincosl(long double x, long double *sin, long double *cos)
|
|
6
|
-
{
|
|
7
|
-
double sind, cosd;
|
|
8
|
-
sincos(x, &sind, &cosd);
|
|
9
|
-
*sin = sind;
|
|
10
|
-
*cos = cosd;
|
|
11
|
-
}
|
|
12
|
-
#elif (LDBL_MANT_DIG == 64 || LDBL_MANT_DIG == 113) && LDBL_MAX_EXP == 16384
|
|
13
|
-
void sincosl(long double x, long double *sin, long double *cos)
|
|
14
|
-
{
|
|
15
|
-
union ldshape u = {x};
|
|
16
|
-
unsigned n;
|
|
17
|
-
long double y[2], s, c;
|
|
18
|
-
|
|
19
|
-
u.i.se &= 0x7fff;
|
|
20
|
-
if (u.i.se == 0x7fff) {
|
|
21
|
-
*sin = *cos = x - x;
|
|
22
|
-
return;
|
|
23
|
-
}
|
|
24
|
-
if (u.f < M_PI_4) {
|
|
25
|
-
if (u.i.se < 0x3fff - LDBL_MANT_DIG) {
|
|
26
|
-
/* raise underflow if subnormal */
|
|
27
|
-
if (u.i.se == 0) FORCE_EVAL(x*0x1p-120f);
|
|
28
|
-
*sin = x;
|
|
29
|
-
/* raise inexact if x!=0 */
|
|
30
|
-
*cos = 1.0 + x;
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
*sin = __sinl(x, 0, 0);
|
|
34
|
-
*cos = __cosl(x, 0);
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
n = __rem_pio2l(x, y);
|
|
38
|
-
s = __sinl(y[0], y[1], 1);
|
|
39
|
-
c = __cosl(y[0], y[1]);
|
|
40
|
-
switch (n & 3) {
|
|
41
|
-
case 0:
|
|
42
|
-
*sin = s;
|
|
43
|
-
*cos = c;
|
|
44
|
-
break;
|
|
45
|
-
case 1:
|
|
46
|
-
*sin = c;
|
|
47
|
-
*cos = -s;
|
|
48
|
-
break;
|
|
49
|
-
case 2:
|
|
50
|
-
*sin = -s;
|
|
51
|
-
*cos = -c;
|
|
52
|
-
break;
|
|
53
|
-
case 3:
|
|
54
|
-
default:
|
|
55
|
-
*sin = -c;
|
|
56
|
-
*cos = s;
|
|
57
|
-
break;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
#endif
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
#include "libm.h"
|
|
2
|
-
|
|
3
|
-
#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
|
|
4
|
-
long double sinl(long double x)
|
|
5
|
-
{
|
|
6
|
-
return sin(x);
|
|
7
|
-
}
|
|
8
|
-
#elif (LDBL_MANT_DIG == 64 || LDBL_MANT_DIG == 113) && LDBL_MAX_EXP == 16384
|
|
9
|
-
long double sinl(long double x)
|
|
10
|
-
{
|
|
11
|
-
union ldshape u = {x};
|
|
12
|
-
unsigned n;
|
|
13
|
-
long double y[2], hi, lo;
|
|
14
|
-
|
|
15
|
-
u.i.se &= 0x7fff;
|
|
16
|
-
if (u.i.se == 0x7fff)
|
|
17
|
-
return x - x;
|
|
18
|
-
if (u.f < M_PI_4) {
|
|
19
|
-
if (u.i.se < 0x3fff - LDBL_MANT_DIG/2) {
|
|
20
|
-
/* raise inexact if x!=0 and underflow if subnormal */
|
|
21
|
-
FORCE_EVAL(u.i.se == 0 ? x*0x1p-120f : x+0x1p120f);
|
|
22
|
-
return x;
|
|
23
|
-
}
|
|
24
|
-
return __sinl(x, 0.0, 0);
|
|
25
|
-
}
|
|
26
|
-
n = __rem_pio2l(x, y);
|
|
27
|
-
hi = y[0];
|
|
28
|
-
lo = y[1];
|
|
29
|
-
switch (n & 3) {
|
|
30
|
-
case 0:
|
|
31
|
-
return __sinl(hi, lo, 1);
|
|
32
|
-
case 1:
|
|
33
|
-
return __cosl(hi, lo);
|
|
34
|
-
case 2:
|
|
35
|
-
return -__sinl(hi, lo, 1);
|
|
36
|
-
case 3:
|
|
37
|
-
default:
|
|
38
|
-
return -__cosl(hi, lo);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
#endif
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
#include "libm.h"
|
|
2
|
-
|
|
3
|
-
#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
|
|
4
|
-
long double tanl(long double x)
|
|
5
|
-
{
|
|
6
|
-
return tan(x);
|
|
7
|
-
}
|
|
8
|
-
#elif (LDBL_MANT_DIG == 64 || LDBL_MANT_DIG == 113) && LDBL_MAX_EXP == 16384
|
|
9
|
-
long double tanl(long double x)
|
|
10
|
-
{
|
|
11
|
-
union ldshape u = {x};
|
|
12
|
-
long double y[2];
|
|
13
|
-
unsigned n;
|
|
14
|
-
|
|
15
|
-
u.i.se &= 0x7fff;
|
|
16
|
-
if (u.i.se == 0x7fff)
|
|
17
|
-
return x - x;
|
|
18
|
-
if (u.f < M_PI_4) {
|
|
19
|
-
if (u.i.se < 0x3fff - LDBL_MANT_DIG/2) {
|
|
20
|
-
/* raise inexact if x!=0 and underflow if subnormal */
|
|
21
|
-
FORCE_EVAL(u.i.se == 0 ? x*0x1p-120f : x+0x1p120f);
|
|
22
|
-
return x;
|
|
23
|
-
}
|
|
24
|
-
return __tanl(x, 0, 0);
|
|
25
|
-
}
|
|
26
|
-
n = __rem_pio2l(x, y);
|
|
27
|
-
return __tanl(y[0], y[1], n&1);
|
|
28
|
-
}
|
|
29
|
-
#endif
|