@zigc/lib 0.16.0-test.1 → 0.16.0

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.
Files changed (241) hide show
  1. package/LICENSE +19 -0
  2. package/c/math.zig +135 -35
  3. package/c/stropts.zig +17 -0
  4. package/c.zig +1 -0
  5. package/compiler/aro/aro/Attribute/names.zig +604 -589
  6. package/compiler/aro/aro/Attribute.zig +202 -116
  7. package/compiler/aro/aro/Builtins/common.zig +874 -863
  8. package/compiler/aro/aro/Builtins/eval.zig +15 -7
  9. package/compiler/aro/aro/Builtins.zig +0 -1
  10. package/compiler/aro/aro/CodeGen.zig +3 -1
  11. package/compiler/aro/aro/Compilation.zig +120 -97
  12. package/compiler/aro/aro/Diagnostics.zig +21 -17
  13. package/compiler/aro/aro/Driver/GCCDetector.zig +635 -0
  14. package/compiler/aro/aro/Driver.zig +124 -50
  15. package/compiler/aro/aro/LangOpts.zig +12 -2
  16. package/compiler/aro/aro/Parser/Diagnostic.zig +79 -19
  17. package/compiler/aro/aro/Parser.zig +336 -142
  18. package/compiler/aro/aro/Preprocessor/Diagnostic.zig +21 -0
  19. package/compiler/aro/aro/Preprocessor.zig +127 -56
  20. package/compiler/aro/aro/Target.zig +17 -12
  21. package/compiler/aro/aro/Tokenizer.zig +31 -14
  22. package/compiler/aro/aro/Toolchain.zig +4 -7
  23. package/compiler/aro/aro/Tree.zig +178 -148
  24. package/compiler/aro/aro/TypeStore.zig +82 -24
  25. package/compiler/aro/aro/Value.zig +13 -17
  26. package/compiler/aro/aro/features.zig +1 -0
  27. package/compiler/aro/aro/pragmas/once.zig +0 -1
  28. package/compiler/aro/aro/record_layout.zig +3 -3
  29. package/compiler/aro/assembly_backend/x86_64.zig +3 -4
  30. package/compiler/aro/backend/Assembly.zig +1 -2
  31. package/compiler/aro/backend/Interner.zig +2 -2
  32. package/compiler/aro/backend/Ir.zig +100 -92
  33. package/compiler/aro/include/ptrcheck.h +49 -0
  34. package/compiler/aro/main.zig +26 -10
  35. package/compiler/build_runner.zig +1 -0
  36. package/compiler/objdump.zig +93 -0
  37. package/compiler/reduce.zig +5 -1
  38. package/compiler/resinator/compile.zig +2 -2
  39. package/compiler/resinator/main.zig +7 -1
  40. package/compiler/resinator/preprocess.zig +1 -3
  41. package/compiler/std-docs.zig +8 -1
  42. package/compiler/test_runner.zig +193 -61
  43. package/compiler/translate-c/MacroTranslator.zig +80 -11
  44. package/compiler/translate-c/PatternList.zig +1 -9
  45. package/compiler/translate-c/Scope.zig +43 -6
  46. package/compiler/translate-c/Translator.zig +364 -126
  47. package/compiler/translate-c/ast.zig +19 -11
  48. package/compiler/translate-c/main.zig +75 -16
  49. package/compiler_rt/cos.zig +141 -52
  50. package/compiler_rt/limb64.zig +266 -0
  51. package/compiler_rt/long_double.zig +37 -0
  52. package/compiler_rt/mulo.zig +6 -1
  53. package/compiler_rt/rem_pio2l.zig +173 -0
  54. package/compiler_rt/sin.zig +140 -55
  55. package/compiler_rt/sincos.zig +279 -72
  56. package/compiler_rt/tan.zig +118 -47
  57. package/compiler_rt/trig.zig +256 -6
  58. package/compiler_rt.zig +2 -0
  59. package/fuzzer.zig +855 -307
  60. package/libc/musl/src/math/pow.c +343 -0
  61. package/package.json +1 -1
  62. package/std/Build/Fuzz.zig +6 -19
  63. package/std/Build/Module.zig +1 -1
  64. package/std/Build/Step/CheckObject.zig +3 -3
  65. package/std/Build/Step/Compile.zig +18 -0
  66. package/std/Build/Step/ConfigHeader.zig +49 -33
  67. package/std/Build/Step/InstallArtifact.zig +18 -0
  68. package/std/Build/Step/Run.zig +536 -87
  69. package/std/Build/Step/TranslateC.zig +0 -6
  70. package/std/Build/Step.zig +8 -15
  71. package/std/Build/WebServer.zig +29 -17
  72. package/std/Build/abi.zig +47 -11
  73. package/std/Build.zig +17 -14
  74. package/std/Io/Dispatch.zig +2 -0
  75. package/std/Io/File/Reader.zig +3 -1
  76. package/std/Io/File.zig +1 -0
  77. package/std/Io/Kqueue.zig +2 -2
  78. package/std/Io/Threaded.zig +181 -143
  79. package/std/Io/Uring.zig +2 -1
  80. package/std/Io.zig +970 -2
  81. package/std/Target.zig +3 -2
  82. package/std/Thread.zig +8 -3
  83. package/std/array_hash_map.zig +96 -555
  84. package/std/array_list.zig +22 -31
  85. package/std/bit_set.zig +22 -6
  86. package/std/builtin/assembly.zig +68 -0
  87. package/std/c.zig +17 -17
  88. package/std/compress/flate/Compress.zig +3 -3
  89. package/std/crypto/Certificate/Bundle.zig +15 -1
  90. package/std/crypto/codecs/asn1.zig +33 -18
  91. package/std/crypto/codecs/base64_hex_ct.zig +14 -4
  92. package/std/debug/Dwarf.zig +29 -9
  93. package/std/debug/Info.zig +4 -0
  94. package/std/debug/MachOFile.zig +46 -8
  95. package/std/debug/Pdb.zig +539 -36
  96. package/std/debug/SelfInfo/Elf.zig +19 -18
  97. package/std/debug/SelfInfo/MachO.zig +18 -7
  98. package/std/debug/SelfInfo/Windows.zig +138 -36
  99. package/std/debug.zig +179 -65
  100. package/std/enums.zig +25 -19
  101. package/std/heap/ArenaAllocator.zig +145 -154
  102. package/std/heap/debug_allocator.zig +7 -7
  103. package/std/http/Client.zig +10 -6
  104. package/std/http.zig +11 -9
  105. package/std/json/Stringify.zig +3 -3
  106. package/std/json/dynamic.zig +4 -4
  107. package/std/math/big/int.zig +16 -17
  108. package/std/mem/Allocator.zig +4 -5
  109. package/std/mem.zig +48 -0
  110. package/std/os/emscripten.zig +1 -17
  111. package/std/os/linux.zig +7 -2
  112. package/std/os/windows.zig +2 -2
  113. package/std/pdb.zig +143 -4
  114. package/std/posix.zig +6 -12
  115. package/std/priority_dequeue.zig +13 -12
  116. package/std/priority_queue.zig +5 -4
  117. package/std/process/Child.zig +1 -1
  118. package/std/process/Environ.zig +1 -1
  119. package/std/start.zig +17 -4
  120. package/std/std.zig +19 -6
  121. package/std/testing/FailingAllocator.zig +4 -4
  122. package/std/testing/Smith.zig +37 -2
  123. package/std/zig/Ast/Render.zig +186 -458
  124. package/std/zig/Ast.zig +0 -4
  125. package/std/zig/AstGen.zig +44 -7
  126. package/std/zig/AstSmith.zig +2602 -0
  127. package/std/zig/Client.zig +8 -3
  128. package/std/zig/Parse.zig +83 -74
  129. package/std/zig/Server.zig +26 -0
  130. package/std/zig/Zir.zig +17 -0
  131. package/std/zig/c_translation/helpers.zig +14 -9
  132. package/std/zig/llvm/Builder.zig +107 -48
  133. package/std/zig/system.zig +20 -4
  134. package/std/zig/tokenizer.zig +2 -1
  135. package/std/zig.zig +6 -0
  136. package/compiler/aro/aro/Driver/Filesystem.zig +0 -241
  137. package/libc/mingw/complex/cabs.c +0 -48
  138. package/libc/mingw/complex/cabsf.c +0 -48
  139. package/libc/mingw/complex/cacos.c +0 -50
  140. package/libc/mingw/complex/cacosf.c +0 -50
  141. package/libc/mingw/complex/carg.c +0 -48
  142. package/libc/mingw/complex/cargf.c +0 -48
  143. package/libc/mingw/complex/casin.c +0 -50
  144. package/libc/mingw/complex/casinf.c +0 -50
  145. package/libc/mingw/complex/catan.c +0 -50
  146. package/libc/mingw/complex/catanf.c +0 -50
  147. package/libc/mingw/complex/ccos.c +0 -50
  148. package/libc/mingw/complex/ccosf.c +0 -50
  149. package/libc/mingw/complex/cexp.c +0 -48
  150. package/libc/mingw/complex/cexpf.c +0 -48
  151. package/libc/mingw/complex/cimag.c +0 -48
  152. package/libc/mingw/complex/cimagf.c +0 -48
  153. package/libc/mingw/complex/clog.c +0 -48
  154. package/libc/mingw/complex/clog10.c +0 -49
  155. package/libc/mingw/complex/clog10f.c +0 -49
  156. package/libc/mingw/complex/clogf.c +0 -48
  157. package/libc/mingw/complex/conj.c +0 -48
  158. package/libc/mingw/complex/conjf.c +0 -48
  159. package/libc/mingw/complex/cpow.c +0 -48
  160. package/libc/mingw/complex/cpowf.c +0 -48
  161. package/libc/mingw/complex/cproj.c +0 -48
  162. package/libc/mingw/complex/cprojf.c +0 -48
  163. package/libc/mingw/complex/creal.c +0 -48
  164. package/libc/mingw/complex/crealf.c +0 -48
  165. package/libc/mingw/complex/csin.c +0 -50
  166. package/libc/mingw/complex/csinf.c +0 -50
  167. package/libc/mingw/complex/csqrt.c +0 -48
  168. package/libc/mingw/complex/csqrtf.c +0 -48
  169. package/libc/mingw/complex/ctan.c +0 -50
  170. package/libc/mingw/complex/ctanf.c +0 -50
  171. package/libc/mingw/math/arm/s_rint.c +0 -86
  172. package/libc/mingw/math/arm/s_rintf.c +0 -51
  173. package/libc/mingw/math/arm/sincos.S +0 -30
  174. package/libc/mingw/math/arm-common/sincosl.c +0 -13
  175. package/libc/mingw/math/arm64/rint.c +0 -12
  176. package/libc/mingw/math/arm64/rintf.c +0 -12
  177. package/libc/mingw/math/arm64/sincos.S +0 -32
  178. package/libc/mingw/math/bsd_private_base.h +0 -148
  179. package/libc/mingw/math/frexpf.c +0 -13
  180. package/libc/mingw/math/frexpl.c +0 -71
  181. package/libc/mingw/math/x86/acosf.c +0 -29
  182. package/libc/mingw/math/x86/atanf.c +0 -23
  183. package/libc/mingw/math/x86/atanl.c +0 -18
  184. package/libc/mingw/math/x86/cos.def.h +0 -65
  185. package/libc/mingw/math/x86/cosl.c +0 -46
  186. package/libc/mingw/math/x86/cosl_internal.S +0 -55
  187. package/libc/mingw/math/x86/ldexp.c +0 -23
  188. package/libc/mingw/math/x86/scalbn.S +0 -41
  189. package/libc/mingw/math/x86/scalbnf.S +0 -40
  190. package/libc/mingw/math/x86/sin.def.h +0 -65
  191. package/libc/mingw/math/x86/sinl.c +0 -46
  192. package/libc/mingw/math/x86/sinl_internal.S +0 -58
  193. package/libc/mingw/math/x86/tanl.S +0 -62
  194. package/libc/mingw/misc/btowc.c +0 -28
  195. package/libc/mingw/misc/wcstof.c +0 -66
  196. package/libc/mingw/misc/wcstoimax.c +0 -132
  197. package/libc/mingw/misc/wcstoumax.c +0 -126
  198. package/libc/mingw/misc/wctob.c +0 -29
  199. package/libc/mingw/misc/winbs_uint64.c +0 -6
  200. package/libc/mingw/misc/winbs_ulong.c +0 -6
  201. package/libc/mingw/misc/winbs_ushort.c +0 -6
  202. package/libc/mingw/stdio/_Exit.c +0 -10
  203. package/libc/mingw/stdio/_findfirst64i32.c +0 -21
  204. package/libc/mingw/stdio/_findnext64i32.c +0 -21
  205. package/libc/mingw/stdio/_fstat64i32.c +0 -37
  206. package/libc/mingw/stdio/_stat64i32.c +0 -37
  207. package/libc/mingw/stdio/_wfindfirst64i32.c +0 -21
  208. package/libc/mingw/stdio/_wfindnext64i32.c +0 -21
  209. package/libc/mingw/stdio/_wstat64i32.c +0 -37
  210. package/libc/musl/src/legacy/isastream.c +0 -7
  211. package/libc/musl/src/legacy/valloc.c +0 -8
  212. package/libc/musl/src/math/__cosl.c +0 -96
  213. package/libc/musl/src/math/__sinl.c +0 -78
  214. package/libc/musl/src/math/__tanl.c +0 -143
  215. package/libc/musl/src/math/aarch64/lrint.c +0 -10
  216. package/libc/musl/src/math/aarch64/lrintf.c +0 -10
  217. package/libc/musl/src/math/aarch64/rintf.c +0 -7
  218. package/libc/musl/src/math/cosl.c +0 -39
  219. package/libc/musl/src/math/fdim.c +0 -10
  220. package/libc/musl/src/math/finite.c +0 -7
  221. package/libc/musl/src/math/finitef.c +0 -7
  222. package/libc/musl/src/math/frexp.c +0 -23
  223. package/libc/musl/src/math/frexpf.c +0 -23
  224. package/libc/musl/src/math/frexpl.c +0 -29
  225. package/libc/musl/src/math/i386/lrint.c +0 -8
  226. package/libc/musl/src/math/i386/lrintf.c +0 -8
  227. package/libc/musl/src/math/i386/rintf.c +0 -7
  228. package/libc/musl/src/math/lrint.c +0 -72
  229. package/libc/musl/src/math/lrintf.c +0 -8
  230. package/libc/musl/src/math/powerpc64/lrint.c +0 -16
  231. package/libc/musl/src/math/powerpc64/lrintf.c +0 -16
  232. package/libc/musl/src/math/rintf.c +0 -30
  233. package/libc/musl/src/math/s390x/rintf.c +0 -15
  234. package/libc/musl/src/math/sincosl.c +0 -60
  235. package/libc/musl/src/math/sinl.c +0 -41
  236. package/libc/musl/src/math/tanl.c +0 -29
  237. package/libc/musl/src/math/x32/lrint.s +0 -5
  238. package/libc/musl/src/math/x32/lrintf.s +0 -5
  239. package/libc/musl/src/math/x86_64/lrint.c +0 -8
  240. package/libc/musl/src/math/x86_64/lrintf.c +0 -8
  241. package/libc/wasi/libc-bottom-half/sources/reallocarray.c +0 -14
@@ -1,21 +0,0 @@
1
- #define __CRT__NO_INLINE
2
- #include <io.h>
3
- #include <string.h>
4
-
5
- int __cdecl _wfindnext64i32(intptr_t _FindHandle,struct _wfinddata64i32_t *_FindData)
6
- {
7
- struct _wfinddata64_t fd;
8
- int ret = _wfindnext64(_FindHandle,&fd);
9
- if (ret == -1) {
10
- *_FindData = (struct _wfinddata64i32_t){0};
11
- return -1;
12
- }
13
- _FindData->attrib=fd.attrib;
14
- _FindData->time_create=fd.time_create;
15
- _FindData->time_access=fd.time_access;
16
- _FindData->time_write=fd.time_write;
17
- _FindData->size=(_fsize_t) fd.size;
18
- memcpy(_FindData->name,fd.name,260*sizeof(wchar_t));
19
- return ret;
20
- }
21
-
@@ -1,37 +0,0 @@
1
- /**
2
- * This file has no copyright assigned and is placed in the Public Domain.
3
- * This file is part of the mingw-w64 runtime package.
4
- * No warranty is given; refer to the file DISCLAIMER.PD within this package.
5
- */
6
-
7
- #include <sys/stat.h>
8
-
9
- /* When the file size does not fit into the st_size field:
10
- * crtdll-msvcr90 msvcr100 msvcr110+
11
- * st_size truncate 0 0
12
- * errno no change no change EOVERFLOW
13
- * returns 0 -1 -1
14
- *
15
- * This file is used only for pre-msvcr80 builds,
16
- * So use the pre-msvcr80 behavior - truncate without error.
17
- */
18
- int __cdecl _wstat64i32(const wchar_t *_Name,struct _stat64i32 *_Stat)
19
- {
20
- struct _stat64 st;
21
- int ret=_wstat64(_Name,&st);
22
- if (ret != 0)
23
- return ret;
24
- _Stat->st_dev=st.st_dev;
25
- _Stat->st_ino=st.st_ino;
26
- _Stat->st_mode=st.st_mode;
27
- _Stat->st_nlink=st.st_nlink;
28
- _Stat->st_uid=st.st_uid;
29
- _Stat->st_gid=st.st_gid;
30
- _Stat->st_rdev=st.st_rdev;
31
- _Stat->st_size=(_off_t) st.st_size; /* truncate 64-bit st_size to 32-bit */
32
- _Stat->st_atime=st.st_atime;
33
- _Stat->st_mtime=st.st_mtime;
34
- _Stat->st_ctime=st.st_ctime;
35
- return 0;
36
- }
37
- int (__cdecl *__MINGW_IMP_SYMBOL(_wstat64i32))(const wchar_t *, struct _stat64i32 *) = _wstat64i32;
@@ -1,7 +0,0 @@
1
- #include <stropts.h>
2
- #include <fcntl.h>
3
-
4
- int isastream(int fd)
5
- {
6
- return fcntl(fd, F_GETFD) < 0 ? -1 : 0;
7
- }
@@ -1,8 +0,0 @@
1
- #define _BSD_SOURCE
2
- #include <stdlib.h>
3
- #include "libc.h"
4
-
5
- void *valloc(size_t size)
6
- {
7
- return memalign(PAGE_SIZE, size);
8
- }
@@ -1,96 +0,0 @@
1
- /* origin: FreeBSD /usr/src/lib/msun/ld80/k_cosl.c */
2
- /* origin: FreeBSD /usr/src/lib/msun/ld128/k_cosl.c */
3
- /*
4
- * ====================================================
5
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
6
- * Copyright (c) 2008 Steven G. Kargl, David Schultz, Bruce D. Evans.
7
- *
8
- * Developed at SunSoft, a Sun Microsystems, Inc. business.
9
- * Permission to use, copy, modify, and distribute this
10
- * software is freely granted, provided that this notice
11
- * is preserved.
12
- * ====================================================
13
- */
14
-
15
-
16
- #include "libm.h"
17
-
18
- #if (LDBL_MANT_DIG == 64 || LDBL_MANT_DIG == 113) && LDBL_MAX_EXP == 16384
19
- #if LDBL_MANT_DIG == 64
20
- /*
21
- * ld80 version of __cos.c. See __cos.c for most comments.
22
- */
23
- /*
24
- * Domain [-0.7854, 0.7854], range ~[-2.43e-23, 2.425e-23]:
25
- * |cos(x) - c(x)| < 2**-75.1
26
- *
27
- * The coefficients of c(x) were generated by a pari-gp script using
28
- * a Remez algorithm that searches for the best higher coefficients
29
- * after rounding leading coefficients to a specified precision.
30
- *
31
- * Simpler methods like Chebyshev or basic Remez barely suffice for
32
- * cos() in 64-bit precision, because we want the coefficient of x^2
33
- * to be precisely -0.5 so that multiplying by it is exact, and plain
34
- * rounding of the coefficients of a good polynomial approximation only
35
- * gives this up to about 64-bit precision. Plain rounding also gives
36
- * a mediocre approximation for the coefficient of x^4, but a rounding
37
- * error of 0.5 ulps for this coefficient would only contribute ~0.01
38
- * ulps to the final error, so this is unimportant. Rounding errors in
39
- * higher coefficients are even less important.
40
- *
41
- * In fact, coefficients above the x^4 one only need to have 53-bit
42
- * precision, and this is more efficient. We get this optimization
43
- * almost for free from the complications needed to search for the best
44
- * higher coefficients.
45
- */
46
- static const long double
47
- C1 = 0.0416666666666666666136L; /* 0xaaaaaaaaaaaaaa9b.0p-68 */
48
- static const double
49
- C2 = -0.0013888888888888874, /* -0x16c16c16c16c10.0p-62 */
50
- C3 = 0.000024801587301571716, /* 0x1a01a01a018e22.0p-68 */
51
- C4 = -0.00000027557319215507120, /* -0x127e4fb7602f22.0p-74 */
52
- C5 = 0.0000000020876754400407278, /* 0x11eed8caaeccf1.0p-81 */
53
- C6 = -1.1470297442401303e-11, /* -0x19393412bd1529.0p-89 */
54
- C7 = 4.7383039476436467e-14; /* 0x1aac9d9af5c43e.0p-97 */
55
- #define POLY(z) (z*(C1+z*(C2+z*(C3+z*(C4+z*(C5+z*(C6+z*C7)))))))
56
- #elif LDBL_MANT_DIG == 113
57
- /*
58
- * ld128 version of __cos.c. See __cos.c for most comments.
59
- */
60
- /*
61
- * Domain [-0.7854, 0.7854], range ~[-1.80e-37, 1.79e-37]:
62
- * |cos(x) - c(x))| < 2**-122.0
63
- *
64
- * 113-bit precision requires more care than 64-bit precision, since
65
- * simple methods give a minimax polynomial with coefficient for x^2
66
- * that is 1 ulp below 0.5, but we want it to be precisely 0.5. See
67
- * above for more details.
68
- */
69
- static const long double
70
- C1 = 0.04166666666666666666666666666666658424671L,
71
- C2 = -0.001388888888888888888888888888863490893732L,
72
- C3 = 0.00002480158730158730158730158600795304914210L,
73
- C4 = -0.2755731922398589065255474947078934284324e-6L,
74
- C5 = 0.2087675698786809897659225313136400793948e-8L,
75
- C6 = -0.1147074559772972315817149986812031204775e-10L,
76
- C7 = 0.4779477332386808976875457937252120293400e-13L;
77
- static const double
78
- C8 = -0.1561920696721507929516718307820958119868e-15,
79
- C9 = 0.4110317413744594971475941557607804508039e-18,
80
- C10 = -0.8896592467191938803288521958313920156409e-21,
81
- C11 = 0.1601061435794535138244346256065192782581e-23;
82
- #define POLY(z) (z*(C1+z*(C2+z*(C3+z*(C4+z*(C5+z*(C6+z*(C7+ \
83
- z*(C8+z*(C9+z*(C10+z*C11)))))))))))
84
- #endif
85
-
86
- long double __cosl(long double x, long double y)
87
- {
88
- long double hz,z,r,w;
89
-
90
- z = x*x;
91
- r = POLY(z);
92
- hz = 0.5*z;
93
- w = 1.0-hz;
94
- return w + (((1.0-w)-hz) + (z*r-x*y));
95
- }
96
- #endif
@@ -1,78 +0,0 @@
1
- /* origin: FreeBSD /usr/src/lib/msun/ld80/k_sinl.c */
2
- /* origin: FreeBSD /usr/src/lib/msun/ld128/k_sinl.c */
3
- /*
4
- * ====================================================
5
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
6
- * Copyright (c) 2008 Steven G. Kargl, David Schultz, Bruce D. Evans.
7
- *
8
- * Developed at SunSoft, a Sun Microsystems, Inc. business.
9
- * Permission to use, copy, modify, and distribute this
10
- * software is freely granted, provided that this notice
11
- * is preserved.
12
- * ====================================================
13
- */
14
-
15
- #include "libm.h"
16
-
17
- #if (LDBL_MANT_DIG == 64 || LDBL_MANT_DIG == 113) && LDBL_MAX_EXP == 16384
18
- #if LDBL_MANT_DIG == 64
19
- /*
20
- * ld80 version of __sin.c. See __sin.c for most comments.
21
- */
22
- /*
23
- * Domain [-0.7854, 0.7854], range ~[-1.89e-22, 1.915e-22]
24
- * |sin(x)/x - s(x)| < 2**-72.1
25
- *
26
- * See __cosl.c for more details about the polynomial.
27
- */
28
- static const long double
29
- S1 = -0.166666666666666666671L; /* -0xaaaaaaaaaaaaaaab.0p-66 */
30
- static const double
31
- S2 = 0.0083333333333333332, /* 0x11111111111111.0p-59 */
32
- S3 = -0.00019841269841269427, /* -0x1a01a01a019f81.0p-65 */
33
- S4 = 0.0000027557319223597490, /* 0x171de3a55560f7.0p-71 */
34
- S5 = -0.000000025052108218074604, /* -0x1ae64564f16cad.0p-78 */
35
- S6 = 1.6059006598854211e-10, /* 0x161242b90243b5.0p-85 */
36
- S7 = -7.6429779983024564e-13, /* -0x1ae42ebd1b2e00.0p-93 */
37
- S8 = 2.6174587166648325e-15; /* 0x179372ea0b3f64.0p-101 */
38
- #define POLY(z) (S2+z*(S3+z*(S4+z*(S5+z*(S6+z*(S7+z*S8))))))
39
- #elif LDBL_MANT_DIG == 113
40
- /*
41
- * ld128 version of __sin.c. See __sin.c for most comments.
42
- */
43
- /*
44
- * Domain [-0.7854, 0.7854], range ~[-1.53e-37, 1.659e-37]
45
- * |sin(x)/x - s(x)| < 2**-122.1
46
- *
47
- * See __cosl.c for more details about the polynomial.
48
- */
49
- static const long double
50
- S1 = -0.16666666666666666666666666666666666606732416116558L,
51
- S2 = 0.0083333333333333333333333333333331135404851288270047L,
52
- S3 = -0.00019841269841269841269841269839935785325638310428717L,
53
- S4 = 0.27557319223985890652557316053039946268333231205686e-5L,
54
- S5 = -0.25052108385441718775048214826384312253862930064745e-7L,
55
- S6 = 0.16059043836821614596571832194524392581082444805729e-9L,
56
- S7 = -0.76471637318198151807063387954939213287488216303768e-12L,
57
- S8 = 0.28114572543451292625024967174638477283187397621303e-14L;
58
- static const double
59
- S9 = -0.82206352458348947812512122163446202498005154296863e-17,
60
- S10 = 0.19572940011906109418080609928334380560135358385256e-19,
61
- S11 = -0.38680813379701966970673724299207480965452616911420e-22,
62
- S12 = 0.64038150078671872796678569586315881020659912139412e-25;
63
- #define POLY(z) (S2+z*(S3+z*(S4+z*(S5+z*(S6+z*(S7+z*(S8+ \
64
- z*(S9+z*(S10+z*(S11+z*S12))))))))))
65
- #endif
66
-
67
- long double __sinl(long double x, long double y, int iy)
68
- {
69
- long double z,r,v;
70
-
71
- z = x*x;
72
- v = z*x;
73
- r = POLY(z);
74
- if (iy == 0)
75
- return x+v*(S1+z*r);
76
- return x-((z*(0.5*y-v*r)-y)-v*S1);
77
- }
78
- #endif
@@ -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,10 +0,0 @@
1
- #include <math.h>
2
-
3
- long lrint(double x)
4
- {
5
- long n;
6
- __asm__ (
7
- "frintx %d1, %d1\n"
8
- "fcvtzs %x0, %d1\n" : "=r"(n), "+w"(x));
9
- return n;
10
- }
@@ -1,10 +0,0 @@
1
- #include <math.h>
2
-
3
- long lrintf(float x)
4
- {
5
- long n;
6
- __asm__ (
7
- "frintx %s1, %s1\n"
8
- "fcvtzs %x0, %s1\n" : "=r"(n), "+w"(x));
9
- return n;
10
- }
@@ -1,7 +0,0 @@
1
- #include <math.h>
2
-
3
- float rintf(float x)
4
- {
5
- __asm__ ("frintx %s0, %s1" : "=w"(x) : "w"(x));
6
- return x;
7
- }
@@ -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,10 +0,0 @@
1
- #include <math.h>
2
-
3
- double fdim(double x, double y)
4
- {
5
- if (isnan(x))
6
- return x;
7
- if (isnan(y))
8
- return y;
9
- return x > y ? x - y : 0;
10
- }
@@ -1,7 +0,0 @@
1
- #define _GNU_SOURCE
2
- #include <math.h>
3
-
4
- int finite(double x)
5
- {
6
- return isfinite(x);
7
- }
@@ -1,7 +0,0 @@
1
- #define _GNU_SOURCE
2
- #include <math.h>
3
-
4
- int finitef(float x)
5
- {
6
- return isfinite(x);
7
- }
@@ -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,8 +0,0 @@
1
- #include <math.h>
2
-
3
- long lrint(double x)
4
- {
5
- long r;
6
- __asm__ ("fistpl %0" : "=m"(r) : "t"(x) : "st");
7
- return r;
8
- }
@@ -1,8 +0,0 @@
1
- #include <math.h>
2
-
3
- long lrintf(float x)
4
- {
5
- long r;
6
- __asm__ ("fistpl %0" : "=m"(r) : "t"(x) : "st");
7
- return r;
8
- }
@@ -1,7 +0,0 @@
1
- #include <math.h>
2
-
3
- float rintf(float x)
4
- {
5
- __asm__ ("frndint" : "+t"(x));
6
- return x;
7
- }
@@ -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,8 +0,0 @@
1
- #include <math.h>
2
-
3
- /* uses LONG_MAX > 2^24, see comments in lrint.c */
4
-
5
- long lrintf(float x)
6
- {
7
- return rintf(x);
8
- }