| author | |
| committer | |
| log | 5082e85de95d491b52fbff2c64cfd5b7190ddc10 |
| tree | 592c0654a8398d1c8b7b0eba764cacf94c72d3ab |
| parent | 9a7f14354e30c3f66135f07ba721c232e79f3740 |
| parent | 08d37d6e14886ad6fe1f5680226f92e9c2634388 |
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/30767
Reviewed-by: Andrew Kelley <andrew@ziglang.org>101 files changed, 268 insertions(+), 2695 deletions(-)
lib/c/math.zig+18| ... | ... | @@ -32,6 +32,12 @@ comptime { |
| 32 | 32 | @export(&nanf, .{ .name = "nanf", .linkage = common.linkage, .visibility = common.visibility }); |
| 33 | 33 | @export(&nanl, .{ .name = "nanl", .linkage = common.linkage, .visibility = common.visibility }); |
| 34 | 34 | } |
| 35 | ||
| 36 | if (builtin.target.isMuslLibC()) { | |
| 37 | @export(&copysignf, .{ .name = "copysignf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 38 | @export(&copysign, .{ .name = "copysign", .linkage = common.linkage, .visibility = common.visibility }); | |
| 39 | } | |
| 40 | @export(&copysignl, .{ .name = "copysignl", .linkage = common.linkage, .visibility = common.visibility }); | |
| 35 | 41 | } |
| 36 | 42 | |
| 37 | 43 | fn isnan(x: f64) callconv(.c) c_int { |
| ... | ... | @@ -57,3 +63,15 @@ fn nanf(_: [*:0]const c_char) callconv(.c) f32 { |
| 57 | 63 | fn nanl(_: [*:0]const c_char) callconv(.c) c_longdouble { |
| 58 | 64 | return std.math.nan(c_longdouble); |
| 59 | 65 | } |
| 66 | ||
| 67 | fn copysignf(x: f32, y: f32) callconv(.c) f32 { | |
| 68 | return std.math.copysign(x, y); | |
| 69 | } | |
| 70 | ||
| 71 | fn copysign(x: f64, y: f64) callconv(.c) f64 { | |
| 72 | return std.math.copysign(x, y); | |
| 73 | } | |
| 74 | ||
| 75 | fn copysignl(x: c_longdouble, y: c_longdouble) callconv(.c) c_longdouble { | |
| 76 | return std.math.copysign(x, y); | |
| 77 | } |
lib/compiler_rt/sqrt.zig+42-60| ... | ... | @@ -54,7 +54,7 @@ pub fn __sqrth(x: f16) callconv(.c) f16 { |
| 54 | 54 | // m: 2.14 r: 0.16, s: 2.14, d: 2.14, u: 2.14, three: 2.14 |
| 55 | 55 | const three: u16 = 0xC000; |
| 56 | 56 | const i: usize = @intCast((ix >> 4) & 0x7F); |
| 57 | const r = __rsqrt_tab[i]; | |
| 57 | const r = rsqrt_tab[i]; | |
| 58 | 58 | // |r*sqrt(m) - 1| < 0x1p-8 |
| 59 | 59 | var s = mul16(m, r); |
| 60 | 60 | // |s/sqrt(m) - 1| < 0x1p-8 |
| ... | ... | @@ -92,74 +92,56 @@ pub fn __sqrth(x: f16) callconv(.c) f16 { |
| 92 | 92 | |
| 93 | 93 | pub fn sqrtf(x: f32) callconv(.c) f32 { |
| 94 | 94 | var ix: u32 = @bitCast(x); |
| 95 | var top = ix >> 23; | |
| 96 | 95 | |
| 97 | // special case handling. | |
| 98 | if (top -% 0x01 >= 0xFF - 0x01) { | |
| 96 | if (ix < @as(u32, @bitCast(@as(f32, 0x1p-126))) or @as(u32, @bitCast(std.math.inf(f32))) <= ix) { | |
| 99 | 97 | @branchHint(.unlikely); |
| 100 | // x < 0x1p-126 or inf or nan. | |
| 101 | if (ix & 0x7FFF_FFFF == 0) return x; | |
| 102 | if (ix == 0x7F80_0000) return x; | |
| 103 | if (ix > 0x7F80_0000) return math.nan(f32); | |
| 104 | // x is subnormal, normalize it. | |
| 105 | ix = @bitCast(x * 0x1p23); | |
| 106 | top = (ix >> 23) -% 23; | |
| 98 | ||
| 99 | if (ix & 0x7fffffff == 0) | |
| 100 | return x; | |
| 101 | ||
| 102 | if (ix == @as(u32, @bitCast(std.math.inf(f32)))) | |
| 103 | return x; | |
| 104 | ||
| 105 | if (ix > @as(u32, @bitCast(std.math.inf(f32)))) | |
| 106 | return if (common.want_float_exceptions) (x - x) / 0.0 else math.nan(f32); | |
| 107 | ||
| 108 | ix = @as(u32, @bitCast(@as(i32, @bitCast(x * 0x1p23)) - (23 << 23))); | |
| 107 | 109 | } |
| 108 | 110 | |
| 109 | // argument reduction: | |
| 110 | // x = 4^e m; with integer e, and m in [1, 4) | |
| 111 | // m: fixed point representation [2.30] | |
| 112 | // 2^e is the exponent part of the result. | |
| 113 | const even = (top & 1) != 0; | |
| 114 | const m = if (even) (ix << 7) & 0x7FFF_FFFF else (ix << 8) | 0x8000_0000; | |
| 115 | top = (top +% 0x7F) >> 1; | |
| 111 | const m: u32 = if (ix & 0x00800000 != 0) | |
| 112 | (ix << 7) & 0x7fffffff | |
| 113 | else | |
| 114 | (ix << 8) | 0x80000000; | |
| 115 | ||
| 116 | const ey = ((ix >> 1) + (0x3f800000 >> 1)) & 0x7f800000; | |
| 117 | // const ey = ((ix + 0x3f800000) & 0xff000000) >> 1; | |
| 118 | ||
| 119 | const three = 0xc0000000; | |
| 120 | const i = (ix >> 17) & 0x7f; | |
| 121 | var r = @as(u32, rsqrt_tab[i]) << 16; | |
| 116 | 122 | |
| 117 | // approximate r ~ 1/sqrt(m) and s ~ sqrt(m) when m in [1,4) | |
| 118 | // the fixed point representations are | |
| 119 | // m: 2.30 r: 0.32, s: 2.30, d: 2.30, u: 2.30, three: 2.30 | |
| 120 | const three: u32 = 0xC000_0000; | |
| 121 | var i: usize = @intCast((ix >> 17) & 0x3F); | |
| 122 | if (even) i += 64; | |
| 123 | var r = @as(u32, @intCast(__rsqrt_tab[i])) << 16; | |
| 124 | // |r*sqrt(m) - 1| < 0x1p-8 | |
| 125 | 123 | var s = mul32(m, r); |
| 126 | // |s/sqrt(m) - 1| < 0x1p-8 | |
| 127 | 124 | var d = mul32(s, r); |
| 128 | 125 | var u = three - d; |
| 129 | 126 | r = mul32(r, u) << 1; |
| 130 | // |r*sqrt(m) - 1| < 0x1.7bp-16 | |
| 131 | 127 | s = mul32(s, u) << 1; |
| 132 | // |s/sqrt(m) - 1| < 0x1.7bp-16 | |
| 133 | 128 | d = mul32(s, r); |
| 134 | 129 | u = three - d; |
| 135 | s = mul32(s, u); // repr: 3.29 | |
| 136 | // -0x1.03p-28 < s/sqrt(m) - 1 < 0x1.fp-31 | |
| 137 | s = (s - 1) >> 6; // repr: 9.23 | |
| 138 | // s < sqrt(m) < s + 0x1.08p-23 | |
| 130 | s = mul32(s, u); | |
| 131 | s = (s - 1) >> 6; | |
| 139 | 132 | |
| 140 | // compute nearest rounded result: | |
| 141 | // the nearest result to 23 bits is either s or s+0x1p-23, | |
| 142 | // we can decide by comparing (2^23 s + 0.5)^2 to 2^46 m. | |
| 143 | 133 | const d0 = (m << 16) -% s *% s; |
| 144 | 134 | const d1 = s -% d0; |
| 145 | 135 | const d2 = d1 +% s +% 1; |
| 146 | s += d1 >> 31; | |
| 147 | s &= 0x007F_FFFF; | |
| 148 | s |= top << 23; | |
| 149 | const y: f32 = @bitCast(s); | |
| 136 | const y: f32 = @bitCast(((s + (d1 >> 31)) & 0x007fffff) | ey); | |
| 150 | 137 | |
| 151 | // handle rounding modes and inexact exception: | |
| 152 | // only (s+1)^2 == 2^16 m case is exact otherwise | |
| 153 | // add a tiny value to cause the fenv effects. | |
| 154 | if (d2 != 0) { | |
| 155 | @branchHint(.likely); | |
| 156 | var tiny: u32 = 0x0100_0000; | |
| 157 | tiny |= (d1 ^ d2) & 0x8000_0000; | |
| 158 | const t: f32 = @bitCast(tiny); | |
| 159 | return y + t; | |
| 160 | } | |
| 138 | const tiny: u32 = if (d2 == 0) blk: { | |
| 139 | @branchHint(.unlikely); | |
| 140 | break :blk 0; | |
| 141 | } else 0x01000000; | |
| 142 | const t: f32 = @bitCast(tiny | ((d1 ^ d2) & 0x80000000)); | |
| 161 | 143 | |
| 162 | return y; | |
| 144 | return y + t; | |
| 163 | 145 | } |
| 164 | 146 | |
| 165 | 147 | pub fn sqrt(x: f64) callconv(.c) f64 { |
| ... | ... | @@ -172,7 +154,7 @@ pub fn sqrt(x: f64) callconv(.c) f64 { |
| 172 | 154 | // x < 0x1p-1022 or inf or nan. |
| 173 | 155 | if (ix & 0x7FFF_FFFF_FFFF_FFFF == 0) return x; |
| 174 | 156 | if (ix == 0x7FF0_0000_0000_0000) return x; |
| 175 | if (ix > 0x7FF0_0000_0000_0000) return math.nan(f64); | |
| 157 | if (ix > 0x7FF0_0000_0000_0000) return if (common.want_float_exceptions) (x - x) / 0.0 else math.nan(f64); | |
| 176 | 158 | // x is subnormal, normalize it. |
| 177 | 159 | ix = @bitCast(x * 0x1p52); |
| 178 | 160 | top = (ix >> 52) -% 52; |
| ... | ... | @@ -248,7 +230,7 @@ pub fn sqrt(x: f64) callconv(.c) f64 { |
| 248 | 230 | var d: struct { u32, u64 } = undefined; |
| 249 | 231 | var u: struct { u32, u64 } = undefined; |
| 250 | 232 | const i: usize = @intCast((ix >> 46) & 0x7F); |
| 251 | r[0] = @intCast(__rsqrt_tab[i]); | |
| 233 | r[0] = @intCast(rsqrt_tab[i]); | |
| 252 | 234 | r[0] <<= 16; |
| 253 | 235 | // |r sqrt(m) - 1| < 0x1.fdp-9 |
| 254 | 236 | s[0] = mul32(@intCast(m >> 32), r[0]); |
| ... | ... | @@ -309,7 +291,7 @@ pub fn __sqrtx(x: f80) callconv(.c) f80 { |
| 309 | 291 | // x < 0x1p-16382 or inf or nan. |
| 310 | 292 | if (ix & 0x7FFF_FFFF_FFFF_FFFF_FFFF == 0) return x; |
| 311 | 293 | if (ix == 0x7FFF_8000_0000_0000_0000) return x; |
| 312 | if (ix > 0x7FFF_8000_0000_0000_0000) return math.nan(f80); | |
| 294 | if (ix > 0x7FFF_8000_0000_0000_0000) return if (common.want_float_exceptions) (x - x) / 0.0 else math.nan(f80); | |
| 313 | 295 | // x is subnormal, normalize it. |
| 314 | 296 | ix = @bitCast(x * 0x1p63); |
| 315 | 297 | top = (ix >> 64) -% 63; |
| ... | ... | @@ -341,7 +323,7 @@ pub fn __sqrtx(x: f80) callconv(.c) f80 { |
| 341 | 323 | var u: struct { u32, u64, u80 } = undefined; |
| 342 | 324 | var i: usize = @intCast((ix >> 57) & 0x3F); |
| 343 | 325 | if (even) i += 64; |
| 344 | r[0] = @intCast(__rsqrt_tab[i]); | |
| 326 | r[0] = @intCast(rsqrt_tab[i]); | |
| 345 | 327 | r[0] <<= 16; |
| 346 | 328 | // |r sqrt(m) - 1| < 0x1p-8 |
| 347 | 329 | s[0] = mul32(@intCast(m >> 48), r[0]); |
| ... | ... | @@ -437,7 +419,7 @@ pub fn sqrtq(x: f128) callconv(.c) f128 { |
| 437 | 419 | var d: struct { u32, u64, u128 } = undefined; |
| 438 | 420 | var u: struct { u32, u64, u128 } = undefined; |
| 439 | 421 | const i: usize = @intCast((ix >> 106) & 0x7F); |
| 440 | r[0] = @intCast(__rsqrt_tab[i]); | |
| 422 | r[0] = @intCast(rsqrt_tab[i]); | |
| 441 | 423 | r[0] <<= 16; |
| 442 | 424 | // |r sqrt(m) - 1| < 0x1p-8 |
| 443 | 425 | s[0] = mul32(@intCast(m >> 96), r[0]); |
| ... | ... | @@ -507,7 +489,7 @@ pub fn sqrtl(x: c_longdouble) callconv(.c) c_longdouble { |
| 507 | 489 | } |
| 508 | 490 | } |
| 509 | 491 | |
| 510 | const __rsqrt_tab: [128]u16 = .{ | |
| 492 | const rsqrt_tab: [128]u16 = .{ | |
| 511 | 493 | 0xB451, 0xB2F0, 0xB196, 0xB044, 0xAEF9, 0xADB6, 0xAC79, 0xAB43, |
| 512 | 494 | 0xAA14, 0xA8EB, 0xA7C8, 0xA6AA, 0xA592, 0xA480, 0xA373, 0xA26B, |
| 513 | 495 | 0xA168, 0xA06A, 0x9F70, 0x9E7B, 0x9D8A, 0x9C9D, 0x9BB5, 0x9AD1, |
| ... | ... | @@ -527,15 +509,15 @@ const __rsqrt_tab: [128]u16 = .{ |
| 527 | 509 | }; |
| 528 | 510 | |
| 529 | 511 | inline fn mul16(a: u16, b: u16) u16 { |
| 530 | return @intCast(@as(u32, @intCast(a)) * @as(u32, @intCast(b)) >> 16); | |
| 512 | return @intCast(@as(u32, a) * b >> 16); | |
| 531 | 513 | } |
| 532 | 514 | |
| 533 | 515 | inline fn mul32(a: u32, b: u32) u32 { |
| 534 | return @intCast(@as(u64, @intCast(a)) * @as(u64, @intCast(b)) >> 32); | |
| 516 | return @intCast(@as(u64, a) * b >> 32); | |
| 535 | 517 | } |
| 536 | 518 | |
| 537 | 519 | inline fn mul64(a: u64, b: u64) u64 { |
| 538 | return @intCast(@as(u128, @intCast(a)) * @as(u128, @intCast(b)) >> 64); | |
| 520 | return @intCast(@as(u128, a) * b >> 64); | |
| 539 | 521 | } |
| 540 | 522 | |
| 541 | 523 | inline fn mul80(a: u80, b: u80) u80 { |
lib/libc/mingw/math/copysign.c deleted-21| ... | ... | @@ -1,21 +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 | #include <math.h> | |
| 7 | ||
| 8 | typedef union U | |
| 9 | { | |
| 10 | unsigned int u[2]; | |
| 11 | double d; | |
| 12 | } U; | |
| 13 | ||
| 14 | double copysign(double x, double y) | |
| 15 | { | |
| 16 | U h,j; | |
| 17 | h.d = x; | |
| 18 | j.d = y; | |
| 19 | h.u[1] = (h.u[1] & 0x7fffffff) | (j.u[1] & 0x80000000); | |
| 20 | return h.d; | |
| 21 | } |
lib/libc/mingw/math/copysignf.c deleted-19| ... | ... | @@ -1,19 +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 | #include <math.h> | |
| 7 | ||
| 8 | typedef union ui_f { | |
| 9 | 	float f; | |
| 10 | 	unsigned int ui; | |
| 11 | } ui_f; | |
| 12 | ||
| 13 | float copysignf(float aX, float aY) | |
| 14 | { | |
| 15 | ui_f x,y; | |
| 16 | x.f=aX; y.f=aY; | |
| 17 | x.ui= (x.ui & 0x7fffffff) | (y.ui & 0x80000000); | |
| 18 | return x.f; | |
| 19 | } |
lib/libc/mingw/math/fmaxl.c deleted-12| ... | ... | @@ -1,12 +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 | #include <math.h> | |
| 7 | ||
| 8 | long double | |
| 9 | fmaxl (long double _x, long double _y) | |
| 10 | { | |
| 11 | return (( isgreaterequal(_x, _y) || __isnanl (_y)) ? _x : _y ); | |
| 12 | } |
lib/libc/mingw/math/fminl.c deleted-12| ... | ... | @@ -1,12 +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 | #include <math.h> | |
| 7 | ||
| 8 | long double | |
| 9 | fminl (long double _x, long double _y) | |
| 10 | { | |
| 11 | return ((islessequal(_x, _y) || __isnanl (_y)) ? _x : _y ); | |
| 12 | } |
lib/libc/mingw/math/sqrt.def.h deleted-92| ... | ... | @@ -1,92 +0,0 @@ |
| 1 | /* | |
| 2 | This Software is provided under the Zope Public License (ZPL) Version 2.1. | |
| 3 | ||
| 4 | Copyright (c) 2009, 2010 by the mingw-w64 project | |
| 5 | ||
| 6 | See the AUTHORS file for the list of contributors to the mingw-w64 project. | |
| 7 | ||
| 8 | This license has been certified as open source. It has also been designated | |
| 9 | as GPL compatible by the Free Software Foundation (FSF). | |
| 10 | ||
| 11 | Redistribution and use in source and binary forms, with or without | |
| 12 | modification, are permitted provided that the following conditions are met: | |
| 13 | ||
| 14 | 1. Redistributions in source code must retain the accompanying copyright | |
| 15 | notice, this list of conditions, and the following disclaimer. | |
| 16 | 2. Redistributions in binary form must reproduce the accompanying | |
| 17 | copyright notice, this list of conditions, and the following disclaimer | |
| 18 | in the documentation and/or other materials provided with the | |
| 19 | distribution. | |
| 20 | 3. Names of the copyright holders must not be used to endorse or promote | |
| 21 | products derived from this software without prior written permission | |
| 22 | from the copyright holders. | |
| 23 | 4. The right to distribute this software or to use it for any purpose does | |
| 24 | not give you the right to use Servicemarks (sm) or Trademarks (tm) of | |
| 25 | the copyright holders. Use of them is covered by separate agreement | |
| 26 | with the copyright holders. | |
| 27 | 5. If any files are modified, you must cause the modified files to carry | |
| 28 | prominent notices stating that you changed the files and the date of | |
| 29 | any change. | |
| 30 | ||
| 31 | Disclaimer | |
| 32 | ||
| 33 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY EXPRESSED | |
| 34 | OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
| 35 | OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO | |
| 36 | EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY DIRECT, INDIRECT, | |
| 37 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |
| 38 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, | |
| 39 | OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | |
| 40 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | |
| 41 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, | |
| 42 | EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 43 | */ | |
| 44 | ||
| 45 | #include "../complex/complex_internal.h" | |
| 46 | #include <errno.h> | |
| 47 | ||
| 48 | __FLT_TYPE | |
| 49 | __FLT_ABI (sqrt) (__FLT_TYPE x) | |
| 50 | { | |
| 51 | __FLT_TYPE res = __FLT_CST (0.0); | |
| 52 | int x_class = fpclassify (x); | |
| 53 | if (x_class == FP_NAN || signbit (x)) | |
| 54 | { | |
| 55 | if (x_class == FP_ZERO) | |
| 56 | 	return __FLT_CST (-0.0); | |
| 57 | ||
| 58 | if (x_class == FP_NAN) | |
| 59 | { | |
| 60 | __FLT_RPT_DOMAIN ("sqrt", x, 0.0, x); | |
| 61 | return x; | |
| 62 | } | |
| 63 | ||
| 64 | res = -__FLT_NAN; | |
| 65 | __FLT_RPT_DOMAIN ("sqrt", x, 0.0, res); | |
| 66 | return res; | |
| 67 | } | |
| 68 | else if (x_class == FP_ZERO) | |
| 69 | return __FLT_CST (0.0); | |
| 70 | else if (x_class == FP_INFINITE) | |
| 71 | return __FLT_HUGE_VAL; | |
| 72 | else if (x == __FLT_CST (1.0)) | |
| 73 | return __FLT_CST (1.0); | |
| 74 | #if defined(__arm__) || defined(_ARM_) | |
| 75 | #if _NEW_COMPLEX_FLOAT | |
| 76 | asm volatile ("fsqrts %[dst], %[src];\n" : [dst] "=t" (res) : [src] "t" (x)); | |
| 77 | #else | |
| 78 | asm volatile ("fsqrtd %[dst], %[src];\n" : [dst] "=w" (res) : [src] "w" (x)); | |
| 79 | #endif | |
| 80 | #elif defined(__aarch64__) || defined(_ARM64_) || defined(__arm64ec__) || defined(_ARM64EC_) | |
| 81 | #if _NEW_COMPLEX_FLOAT | |
| 82 | asm volatile ("fsqrt %s[dst], %s[src]\n" : [dst] "=w" (res) : [src] "w" (x)); | |
| 83 | #else | |
| 84 | asm volatile ("fsqrt %d[dst], %d[src]\n" : [dst] "=w" (res) : [src] "w" (x)); | |
| 85 | #endif | |
| 86 | #elif defined(_X86_) || defined(__i386__) || defined(_AMD64_) || defined(__x86_64__) | |
| 87 | asm volatile ("fsqrt" : "=t" (res) : "0" (x)); | |
| 88 | #else | |
| 89 | #error Not supported on your platform yet | |
| 90 | #endif | |
| 91 | return res; | |
| 92 | } |
lib/libc/mingw/math/sqrtf.c deleted-46| ... | ... | @@ -1,46 +0,0 @@ |
| 1 | /* | |
| 2 | This Software is provided under the Zope Public License (ZPL) Version 2.1. | |
| 3 | ||
| 4 | Copyright (c) 2009, 2010 by the mingw-w64 project | |
| 5 | ||
| 6 | See the AUTHORS file for the list of contributors to the mingw-w64 project. | |
| 7 | ||
| 8 | This license has been certified as open source. It has also been designated | |
| 9 | as GPL compatible by the Free Software Foundation (FSF). | |
| 10 | ||
| 11 | Redistribution and use in source and binary forms, with or without | |
| 12 | modification, are permitted provided that the following conditions are met: | |
| 13 | ||
| 14 | 1. Redistributions in source code must retain the accompanying copyright | |
| 15 | notice, this list of conditions, and the following disclaimer. | |
| 16 | 2. Redistributions in binary form must reproduce the accompanying | |
| 17 | copyright notice, this list of conditions, and the following disclaimer | |
| 18 | in the documentation and/or other materials provided with the | |
| 19 | distribution. | |
| 20 | 3. Names of the copyright holders must not be used to endorse or promote | |
| 21 | products derived from this software without prior written permission | |
| 22 | from the copyright holders. | |
| 23 | 4. The right to distribute this software or to use it for any purpose does | |
| 24 | not give you the right to use Servicemarks (sm) or Trademarks (tm) of | |
| 25 | the copyright holders. Use of them is covered by separate agreement | |
| 26 | with the copyright holders. | |
| 27 | 5. If any files are modified, you must cause the modified files to carry | |
| 28 | prominent notices stating that you changed the files and the date of | |
| 29 | any change. | |
| 30 | ||
| 31 | Disclaimer | |
| 32 | ||
| 33 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY EXPRESSED | |
| 34 | OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
| 35 | OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO | |
| 36 | EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY DIRECT, INDIRECT, | |
| 37 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |
| 38 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, | |
| 39 | OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | |
| 40 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | |
| 41 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, | |
| 42 | EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 43 | */ | |
| 44 | ||
| 45 | #define _NEW_COMPLEX_FLOAT 1 | |
| 46 | #include "sqrt.def.h" |
lib/libc/mingw/math/sqrtl.c deleted-46| ... | ... | @@ -1,46 +0,0 @@ |
| 1 | /* | |
| 2 | This Software is provided under the Zope Public License (ZPL) Version 2.1. | |
| 3 | ||
| 4 | Copyright (c) 2009, 2010 by the mingw-w64 project | |
| 5 | ||
| 6 | See the AUTHORS file for the list of contributors to the mingw-w64 project. | |
| 7 | ||
| 8 | This license has been certified as open source. It has also been designated | |
| 9 | as GPL compatible by the Free Software Foundation (FSF). | |
| 10 | ||
| 11 | Redistribution and use in source and binary forms, with or without | |
| 12 | modification, are permitted provided that the following conditions are met: | |
| 13 | ||
| 14 | 1. Redistributions in source code must retain the accompanying copyright | |
| 15 | notice, this list of conditions, and the following disclaimer. | |
| 16 | 2. Redistributions in binary form must reproduce the accompanying | |
| 17 | copyright notice, this list of conditions, and the following disclaimer | |
| 18 | in the documentation and/or other materials provided with the | |
| 19 | distribution. | |
| 20 | 3. Names of the copyright holders must not be used to endorse or promote | |
| 21 | products derived from this software without prior written permission | |
| 22 | from the copyright holders. | |
| 23 | 4. The right to distribute this software or to use it for any purpose does | |
| 24 | not give you the right to use Servicemarks (sm) or Trademarks (tm) of | |
| 25 | the copyright holders. Use of them is covered by separate agreement | |
| 26 | with the copyright holders. | |
| 27 | 5. If any files are modified, you must cause the modified files to carry | |
| 28 | prominent notices stating that you changed the files and the date of | |
| 29 | any change. | |
| 30 | ||
| 31 | Disclaimer | |
| 32 | ||
| 33 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY EXPRESSED | |
| 34 | OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
| 35 | OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO | |
| 36 | EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY DIRECT, INDIRECT, | |
| 37 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |
| 38 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, | |
| 39 | OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | |
| 40 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | |
| 41 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, | |
| 42 | EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 43 | */ | |
| 44 | ||
| 45 | #define _NEW_COMPLEX_LDOUBLE 1 | |
| 46 | #include "sqrt.def.h" |
lib/libc/mingw/math/x86/copysignl.S deleted-44| ... | ... | @@ -1,44 +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 | * Written by J.T. Conklin <jtc@netbsd.org>. | |
| 8 | * Changes for long double by Ulrich Drepper <drepper@cygnus.com> | |
| 9 | * Public domain. | |
| 10 | */ | |
| 11 | #include <_mingw_mac.h> | |
| 12 | ||
| 13 | 	.file	"copysignl.S" | |
| 14 | 	.text | |
| 15 | #ifdef __x86_64__ | |
| 16 | 	.align 8 | |
| 17 | #else | |
| 18 | 	.align 4 | |
| 19 | #endif | |
| 20 | ||
| 21 | 	.globl __MINGW_USYMBOL(copysignl) | |
| 22 | 	.def	__MINGW_USYMBOL(copysignl);	.scl	2;	.type	32;	.endef | |
| 23 | __MINGW_USYMBOL(copysignl): | |
| 24 | #if defined(_AMD64_) || defined(__x86_64__) | |
| 25 | 	movq	(%rdx), %rax | |
| 26 | 	movq	%rax, (%rcx) | |
| 27 | 	movq	8(%rdx), %rax | |
| 28 | 	movq	8(%r8), %rdx | |
| 29 | 	andq	$0x7fff, %rax | |
| 30 | 	andq	$0x8000, %rdx | |
| 31 | 	orq	%rdx, %rax | |
| 32 | 	movq	%rax, 8(%rcx) | |
| 33 | 	movq	%rcx, %rax | |
| 34 | 	ret | |
| 35 | #elif defined(_X86_) || defined(__i386__) | |
| 36 | 	movl	24(%esp),%edx | |
| 37 | 	movl	12(%esp),%eax | |
| 38 | 	andl	$0x8000,%edx | |
| 39 | 	andl	$0x7fff,%eax | |
| 40 | 	orl	%edx,%eax | |
| 41 | 	movl	%eax,12(%esp) | |
| 42 | 	fldt	4(%esp) | |
| 43 | 	ret | |
| 44 | #endif |
lib/libc/mingw/math/x86/fmodf.c deleted-29| ... | ... | @@ -1,29 +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 | * Written by J.T. Conklin <jtc@netbsd.org>. | |
| 8 | * Public domain. | |
| 9 | * | |
| 10 | * Adapted for float type by Danny Smith | |
| 11 | * <dannysmith@users.sourceforge.net>. | |
| 12 | */ | |
| 13 | ||
| 14 | #include <math.h> | |
| 15 | ||
| 16 | float | |
| 17 | fmodf (float x, float y) | |
| 18 | { | |
| 19 | float res = 0.0F; | |
| 20 | ||
| 21 | asm volatile ( | |
| 22 | "1:\tfprem\n\t" | |
| 23 | "fstsw %%ax\n\t" | |
| 24 | "sahf\n\t" | |
| 25 | "jp 1b\n\t" | |
| 26 | "fstp %%st(1)" | |
| 27 | : "=t" (res) : "0" (x), "u" (y) : "ax", "st(1)"); | |
| 28 | return res; | |
| 29 | } |
lib/libc/mingw/math/x86/fmodl.c deleted-21| ... | ... | @@ -1,21 +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 | long double fmodl (long double x, long double y); | |
| 7 | ||
| 8 | long double | |
| 9 | fmodl (long double x, long double y) | |
| 10 | { | |
| 11 | long double res = 0.0L; | |
| 12 | ||
| 13 | asm volatile ( | |
| 14 | "1:\tfprem\n\t" | |
| 15 | "fstsw %%ax\n\t" | |
| 16 | "sahf\n\t" | |
| 17 | "jp 1b\n\t" | |
| 18 | "fstp %%st(1)" | |
| 19 | : "=t" (res) : "0" (x), "u" (y) : "ax", "st(1)"); | |
| 20 | return res; | |
| 21 | } |
lib/libc/mingw/math/x86/log.c deleted-46| ... | ... | @@ -1,46 +0,0 @@ |
| 1 | /* | |
| 2 | This Software is provided under the Zope Public License (ZPL) Version 2.1. | |
| 3 | ||
| 4 | Copyright (c) 2009, 2010 by the mingw-w64 project | |
| 5 | ||
| 6 | See the AUTHORS file for the list of contributors to the mingw-w64 project. | |
| 7 | ||
| 8 | This license has been certified as open source. It has also been designated | |
| 9 | as GPL compatible by the Free Software Foundation (FSF). | |
| 10 | ||
| 11 | Redistribution and use in source and binary forms, with or without | |
| 12 | modification, are permitted provided that the following conditions are met: | |
| 13 | ||
| 14 | 1. Redistributions in source code must retain the accompanying copyright | |
| 15 | notice, this list of conditions, and the following disclaimer. | |
| 16 | 2. Redistributions in binary form must reproduce the accompanying | |
| 17 | copyright notice, this list of conditions, and the following disclaimer | |
| 18 | in the documentation and/or other materials provided with the | |
| 19 | distribution. | |
| 20 | 3. Names of the copyright holders must not be used to endorse or promote | |
| 21 | products derived from this software without prior written permission | |
| 22 | from the copyright holders. | |
| 23 | 4. The right to distribute this software or to use it for any purpose does | |
| 24 | not give you the right to use Servicemarks (sm) or Trademarks (tm) of | |
| 25 | the copyright holders. Use of them is covered by separate agreement | |
| 26 | with the copyright holders. | |
| 27 | 5. If any files are modified, you must cause the modified files to carry | |
| 28 | prominent notices stating that you changed the files and the date of | |
| 29 | any change. | |
| 30 | ||
| 31 | Disclaimer | |
| 32 | ||
| 33 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY EXPRESSED | |
| 34 | OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
| 35 | OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO | |
| 36 | EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY DIRECT, INDIRECT, | |
| 37 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |
| 38 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, | |
| 39 | OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | |
| 40 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | |
| 41 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, | |
| 42 | EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 43 | */ | |
| 44 | ||
| 45 | #define _NEW_COMPLEX_DOUBLE 1 | |
| 46 | #include "log.def.h" |
lib/libc/mingw/math/x86/log2f.S deleted-85| ... | ... | @@ -1,85 +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 | #include <_mingw_mac.h> | |
| 7 | ||
| 8 | 	.file	"log2f.S" | |
| 9 | 	.text | |
| 10 | #ifdef __x86_64__ | |
| 11 | 	.align 8 | |
| 12 | #else | |
| 13 | 	.align 4 | |
| 14 | #endif | |
| 15 | one:	.double 1.0 | |
| 16 | 	/* It is not important that this constant is precise. It is only | |
| 17 | 	 a value which is known to be on the safe side for using the | |
| 18 | 	 fyl2xp1 instruction. */ | |
| 19 | limit:	.double 0.29 | |
| 20 | ||
| 21 | .globl __MINGW_USYMBOL(log2f) | |
| 22 | 	.def	__MINGW_USYMBOL(log2f);	.scl	2;	.type	32;	.endef | |
| 23 | __MINGW_USYMBOL(log2f): | |
| 24 | #ifdef __x86_64__ | |
| 25 | 	movss	%xmm0,-12(%rsp) | |
| 26 | 	fldl	one(%rip) | |
| 27 | 	flds	-12(%rsp)		// x : 1 | |
| 28 | 	fxam | |
| 29 | 	fnstsw | |
| 30 | 	fld	%st		// x : x : 1 | |
| 31 | 	sahf | |
| 32 | 	jc	3f		// in case x is NaN or �Inf | |
| 33 | 4:	fsub	%st(2), %st	// x-1 : x : 1 | |
| 34 | 	fld	%st		// x-1 : x-1 : x : 1 | |
| 35 | 	fabs			// |x-1| : x-1 : x : 1 | |
| 36 | 	fcompl	limit(%rip)	// x-1 : x : 1 | |
| 37 | 	fnstsw			// x-1 : x : 1 | |
| 38 | 	andb	$0x45, %ah | |
| 39 | 	jz	2f | |
| 40 | 	fstp	%st(1)		// x-1 : 1 | |
| 41 | 	fyl2xp1			// log(x) | |
| 42 | 	fstps	-12(%rsp) | |
| 43 | 	movss	-12(%rsp),%xmm0 | |
| 44 | 	ret | |
| 45 | ||
| 46 | 2:	fstp	%st(0)		// x : 1 | |
| 47 | 	fyl2x			// log(x) | |
| 48 | 	fstps	-12(%rsp) | |
| 49 | 	movss	-12(%rsp),%xmm0 | |
| 50 | 	ret | |
| 51 | ||
| 52 | 3:	jp	4b		// in case x is �Inf | |
| 53 | 	fstp	%st(1) | |
| 54 | 	fstp	%st(1) | |
| 55 | 	fstps	-12(%rsp) | |
| 56 | 	movss	-12(%rsp),%xmm0 | |
| 57 | 	ret | |
| 58 | #else | |
| 59 | 	fldl	one | |
| 60 | 	flds	4(%esp)		// x : 1 | |
| 61 | 	fxam | |
| 62 | 	fnstsw | |
| 63 | 	fld	%st		// x : x : 1 | |
| 64 | 	sahf | |
| 65 | 	jc	3f		// in case x is NaN or �Inf | |
| 66 | 4:	fsub	%st(2), %st	// x-1 : x : 1 | |
| 67 | 	fld	%st		// x-1 : x-1 : x : 1 | |
| 68 | 	fabs			// |x-1| : x-1 : x : 1 | |
| 69 | 	fcompl	limit		// x-1 : x : 1 | |
| 70 | 	fnstsw			// x-1 : x : 1 | |
| 71 | 	andb	$0x45, %ah | |
| 72 | 	jz	2f | |
| 73 | 	fstp	%st(1)		// x-1 : 1 | |
| 74 | 	fyl2xp1			// log(x) | |
| 75 | 	ret | |
| 76 | ||
| 77 | 2:	fstp	%st(0)		// x : 1 | |
| 78 | 	fyl2x			// log(x) | |
| 79 | 	ret | |
| 80 | ||
| 81 | 3:	jp	4b		// in case x is �Inf | |
| 82 | 	fstp	%st(1) | |
| 83 | 	fstp	%st(1) | |
| 84 | 	ret | |
| 85 | #endif |
lib/libc/musl/src/math/aarch64/fmax.c deleted-7| ... | ... | @@ -1,7 +0,0 @@ |
| 1 | #include <math.h> | |
| 2 | ||
| 3 | double fmax(double x, double y) | |
| 4 | { | |
| 5 | 	__asm__ ("fmaxnm %d0, %d1, %d2" : "=w"(x) : "w"(x), "w"(y)); | |
| 6 | 	return x; | |
| 7 | } |
lib/libc/musl/src/math/aarch64/fmaxf.c deleted-7| ... | ... | @@ -1,7 +0,0 @@ |
| 1 | #include <math.h> | |
| 2 | ||
| 3 | float fmaxf(float x, float y) | |
| 4 | { | |
| 5 | 	__asm__ ("fmaxnm %s0, %s1, %s2" : "=w"(x) : "w"(x), "w"(y)); | |
| 6 | 	return x; | |
| 7 | } |
lib/libc/musl/src/math/aarch64/fmin.c deleted-7| ... | ... | @@ -1,7 +0,0 @@ |
| 1 | #include <math.h> | |
| 2 | ||
| 3 | double fmin(double x, double y) | |
| 4 | { | |
| 5 | 	__asm__ ("fminnm %d0, %d1, %d2" : "=w"(x) : "w"(x), "w"(y)); | |
| 6 | 	return x; | |
| 7 | } |
lib/libc/musl/src/math/aarch64/fminf.c deleted-7| ... | ... | @@ -1,7 +0,0 @@ |
| 1 | #include <math.h> | |
| 2 | ||
| 3 | float fminf(float x, float y) | |
| 4 | { | |
| 5 | 	__asm__ ("fminnm %s0, %s1, %s2" : "=w"(x) : "w"(x), "w"(y)); | |
| 6 | 	return x; | |
| 7 | } |
lib/libc/musl/src/math/aarch64/sqrt.c deleted-7| ... | ... | @@ -1,7 +0,0 @@ |
| 1 | #include <math.h> | |
| 2 | ||
| 3 | double sqrt(double x) | |
| 4 | { | |
| 5 | 	__asm__ ("fsqrt %d0, %d1" : "=w"(x) : "w"(x)); | |
| 6 | 	return x; | |
| 7 | } |
lib/libc/musl/src/math/aarch64/sqrtf.c deleted-7| ... | ... | @@ -1,7 +0,0 @@ |
| 1 | #include <math.h> | |
| 2 | ||
| 3 | float sqrtf(float x) | |
| 4 | { | |
| 5 | 	__asm__ ("fsqrt %s0, %s1" : "=w"(x) : "w"(x)); | |
| 6 | 	return x; | |
| 7 | } |
lib/libc/musl/src/math/arm/sqrt.c deleted-15| ... | ... | @@ -1,15 +0,0 @@ |
| 1 | #include <math.h> | |
| 2 | ||
| 3 | #if (__ARM_PCS_VFP || (__VFP_FP__ && !__SOFTFP__)) && (__ARM_FP&8) | |
| 4 | ||
| 5 | double sqrt(double x) | |
| 6 | { | |
| 7 | 	__asm__ ("vsqrt.f64 %P0, %P1" : "=w"(x) : "w"(x)); | |
| 8 | 	return x; | |
| 9 | } | |
| 10 | ||
| 11 | #else | |
| 12 | ||
| 13 | #include "../sqrt.c" | |
| 14 | ||
| 15 | #endif |
lib/libc/musl/src/math/arm/sqrtf.c deleted-15| ... | ... | @@ -1,15 +0,0 @@ |
| 1 | #include <math.h> | |
| 2 | ||
| 3 | #if (__ARM_PCS_VFP || (__VFP_FP__ && !__SOFTFP__)) && !BROKEN_VFP_ASM | |
| 4 | ||
| 5 | float sqrtf(float x) | |
| 6 | { | |
| 7 | 	__asm__ ("vsqrt.f32 %0, %1" : "=t"(x) : "t"(x)); | |
| 8 | 	return x; | |
| 9 | } | |
| 10 | ||
| 11 | #else | |
| 12 | ||
| 13 | #include "../sqrtf.c" | |
| 14 | ||
| 15 | #endif |
lib/libc/musl/src/math/copysign.c deleted-8| ... | ... | @@ -1,8 +0,0 @@ |
| 1 | #include "libm.h" | |
| 2 | ||
| 3 | double copysign(double x, double y) { | |
| 4 | 	union {double f; uint64_t i;} ux={x}, uy={y}; | |
| 5 | 	ux.i &= -1ULL/2; | |
| 6 | 	ux.i |= uy.i & 1ULL<<63; | |
| 7 | 	return ux.f; | |
| 8 | } |
lib/libc/musl/src/math/copysignf.c deleted-10| ... | ... | @@ -1,10 +0,0 @@ |
| 1 | #include <math.h> | |
| 2 | #include <stdint.h> | |
| 3 | ||
| 4 | float copysignf(float x, float y) | |
| 5 | { | |
| 6 | 	union {float f; uint32_t i;} ux={x}, uy={y}; | |
| 7 | 	ux.i &= 0x7fffffff; | |
| 8 | 	ux.i |= uy.i & 0x80000000; | |
| 9 | 	return ux.f; | |
| 10 | } |
lib/libc/musl/src/math/copysignl.c deleted-16| ... | ... | @@ -1,16 +0,0 @@ |
| 1 | #include "libm.h" | |
| 2 | ||
| 3 | #if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 | |
| 4 | long double copysignl(long double x, long double y) | |
| 5 | { | |
| 6 | 	return copysign(x, y); | |
| 7 | } | |
| 8 | #elif (LDBL_MANT_DIG == 64 || LDBL_MANT_DIG == 113) && LDBL_MAX_EXP == 16384 | |
| 9 | long double copysignl(long double x, long double y) | |
| 10 | { | |
| 11 | 	union ldshape ux = {x}, uy = {y}; | |
| 12 | 	ux.i.se &= 0x7fff; | |
| 13 | 	ux.i.se |= uy.i.se & 0x8000; | |
| 14 | 	return ux.f; | |
| 15 | } | |
| 16 | #endif |
lib/libc/musl/src/math/fmax.c deleted-13| ... | ... | @@ -1,13 +0,0 @@ |
| 1 | #include <math.h> | |
| 2 | ||
| 3 | double fmax(double x, double y) | |
| 4 | { | |
| 5 | 	if (isnan(x)) | |
| 6 | 		return y; | |
| 7 | 	if (isnan(y)) | |
| 8 | 		return x; | |
| 9 | 	/* handle signed zeros, see C99 Annex F.9.9.2 */ | |
| 10 | 	if (signbit(x) != signbit(y)) | |
| 11 | 		return signbit(x) ? y : x; | |
| 12 | 	return x < y ? y : x; | |
| 13 | } |
lib/libc/musl/src/math/fmaxf.c deleted-13| ... | ... | @@ -1,13 +0,0 @@ |
| 1 | #include <math.h> | |
| 2 | ||
| 3 | float fmaxf(float x, float y) | |
| 4 | { | |
| 5 | 	if (isnan(x)) | |
| 6 | 		return y; | |
| 7 | 	if (isnan(y)) | |
| 8 | 		return x; | |
| 9 | 	/* handle signed zeroes, see C99 Annex F.9.9.2 */ | |
| 10 | 	if (signbit(x) != signbit(y)) | |
| 11 | 		return signbit(x) ? y : x; | |
| 12 | 	return x < y ? y : x; | |
| 13 | } |
lib/libc/musl/src/math/fmaxl.c deleted-21| ... | ... | @@ -1,21 +0,0 @@ |
| 1 | #include <math.h> | |
| 2 | #include <float.h> | |
| 3 | ||
| 4 | #if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 | |
| 5 | long double fmaxl(long double x, long double y) | |
| 6 | { | |
| 7 | 	return fmax(x, y); | |
| 8 | } | |
| 9 | #else | |
| 10 | long double fmaxl(long double x, long double y) | |
| 11 | { | |
| 12 | 	if (isnan(x)) | |
| 13 | 		return y; | |
| 14 | 	if (isnan(y)) | |
| 15 | 		return x; | |
| 16 | 	/* handle signed zeros, see C99 Annex F.9.9.2 */ | |
| 17 | 	if (signbit(x) != signbit(y)) | |
| 18 | 		return signbit(x) ? y : x; | |
| 19 | 	return x < y ? y : x; | |
| 20 | } | |
| 21 | #endif |
lib/libc/musl/src/math/fmin.c deleted-13| ... | ... | @@ -1,13 +0,0 @@ |
| 1 | #include <math.h> | |
| 2 | ||
| 3 | double fmin(double x, double y) | |
| 4 | { | |
| 5 | 	if (isnan(x)) | |
| 6 | 		return y; | |
| 7 | 	if (isnan(y)) | |
| 8 | 		return x; | |
| 9 | 	/* handle signed zeros, see C99 Annex F.9.9.2 */ | |
| 10 | 	if (signbit(x) != signbit(y)) | |
| 11 | 		return signbit(x) ? x : y; | |
| 12 | 	return x < y ? x : y; | |
| 13 | } |
lib/libc/musl/src/math/fminf.c deleted-13| ... | ... | @@ -1,13 +0,0 @@ |
| 1 | #include <math.h> | |
| 2 | ||
| 3 | float fminf(float x, float y) | |
| 4 | { | |
| 5 | 	if (isnan(x)) | |
| 6 | 		return y; | |
| 7 | 	if (isnan(y)) | |
| 8 | 		return x; | |
| 9 | 	/* handle signed zeros, see C99 Annex F.9.9.2 */ | |
| 10 | 	if (signbit(x) != signbit(y)) | |
| 11 | 		return signbit(x) ? x : y; | |
| 12 | 	return x < y ? x : y; | |
| 13 | } |
lib/libc/musl/src/math/fminl.c deleted-21| ... | ... | @@ -1,21 +0,0 @@ |
| 1 | #include <math.h> | |
| 2 | #include <float.h> | |
| 3 | ||
| 4 | #if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 | |
| 5 | long double fminl(long double x, long double y) | |
| 6 | { | |
| 7 | 	return fmin(x, y); | |
| 8 | } | |
| 9 | #else | |
| 10 | long double fminl(long double x, long double y) | |
| 11 | { | |
| 12 | 	if (isnan(x)) | |
| 13 | 		return y; | |
| 14 | 	if (isnan(y)) | |
| 15 | 		return x; | |
| 16 | 	/* handle signed zeros, see C99 Annex F.9.9.2 */ | |
| 17 | 	if (signbit(x) != signbit(y)) | |
| 18 | 		return signbit(x) ? x : y; | |
| 19 | 	return x < y ? x : y; | |
| 20 | } | |
| 21 | #endif |
lib/libc/musl/src/math/i386/fmod.c deleted-10| ... | ... | @@ -1,10 +0,0 @@ |
| 1 | #include <math.h> | |
| 2 | ||
| 3 | double fmod(double x, double y) | |
| 4 | { | |
| 5 | 	unsigned short fpsr; | |
| 6 | 	// fprem does not introduce excess precision into x | |
| 7 | 	do __asm__ ("fprem; fnstsw %%ax" : "+t"(x), "=a"(fpsr) : "u"(y)); | |
| 8 | 	while (fpsr & 0x400); | |
| 9 | 	return x; | |
| 10 | } |
lib/libc/musl/src/math/i386/fmodf.c deleted-10| ... | ... | @@ -1,10 +0,0 @@ |
| 1 | #include <math.h> | |
| 2 | ||
| 3 | float fmodf(float x, float y) | |
| 4 | { | |
| 5 | 	unsigned short fpsr; | |
| 6 | 	// fprem does not introduce excess precision into x | |
| 7 | 	do __asm__ ("fprem; fnstsw %%ax" : "+t"(x), "=a"(fpsr) : "u"(y)); | |
| 8 | 	while (fpsr & 0x400); | |
| 9 | 	return x; | |
| 10 | } |
lib/libc/musl/src/math/i386/fmodl.c deleted-9| ... | ... | @@ -1,9 +0,0 @@ |
| 1 | #include <math.h> | |
| 2 | ||
| 3 | long double fmodl(long double x, long double y) | |
| 4 | { | |
| 5 | 	unsigned short fpsr; | |
| 6 | 	do __asm__ ("fprem; fnstsw %%ax" : "+t"(x), "=a"(fpsr) : "u"(y)); | |
| 7 | 	while (fpsr & 0x400); | |
| 8 | 	return x; | |
| 9 | } |
lib/libc/musl/src/math/i386/log.s deleted-9| ... | ... | @@ -1,9 +0,0 @@ |
| 1 | .global log | |
| 2 | .type log,@function | |
| 3 | log: | |
| 4 | 	fldln2 | |
| 5 | 	fldl 4(%esp) | |
| 6 | 	fyl2x | |
| 7 | 	fstpl 4(%esp) | |
| 8 | 	fldl 4(%esp) | |
| 9 | 	ret |
lib/libc/musl/src/math/i386/log10.s deleted-9| ... | ... | @@ -1,9 +0,0 @@ |
| 1 | .global log10 | |
| 2 | .type log10,@function | |
| 3 | log10: | |
| 4 | 	fldlg2 | |
| 5 | 	fldl 4(%esp) | |
| 6 | 	fyl2x | |
| 7 | 	fstpl 4(%esp) | |
| 8 | 	fldl 4(%esp) | |
| 9 | 	ret |
lib/libc/musl/src/math/i386/log10f.s deleted-9| ... | ... | @@ -1,9 +0,0 @@ |
| 1 | .global log10f | |
| 2 | .type log10f,@function | |
| 3 | log10f: | |
| 4 | 	fldlg2 | |
| 5 | 	flds 4(%esp) | |
| 6 | 	fyl2x | |
| 7 | 	fstps 4(%esp) | |
| 8 | 	flds 4(%esp) | |
| 9 | 	ret |
lib/libc/musl/src/math/i386/log2.s deleted-9| ... | ... | @@ -1,9 +0,0 @@ |
| 1 | .global log2 | |
| 2 | .type log2,@function | |
| 3 | log2: | |
| 4 | 	fld1 | |
| 5 | 	fldl 4(%esp) | |
| 6 | 	fyl2x | |
| 7 | 	fstpl 4(%esp) | |
| 8 | 	fldl 4(%esp) | |
| 9 | 	ret |
lib/libc/musl/src/math/i386/log2f.s deleted-9| ... | ... | @@ -1,9 +0,0 @@ |
| 1 | .global log2f | |
| 2 | .type log2f,@function | |
| 3 | log2f: | |
| 4 | 	fld1 | |
| 5 | 	flds 4(%esp) | |
| 6 | 	fyl2x | |
| 7 | 	fstps 4(%esp) | |
| 8 | 	flds 4(%esp) | |
| 9 | 	ret |
lib/libc/musl/src/math/i386/logf.s deleted-9| ... | ... | @@ -1,9 +0,0 @@ |
| 1 | .global logf | |
| 2 | .type logf,@function | |
| 3 | logf: | |
| 4 | 	fldln2 | |
| 5 | 	flds 4(%esp) | |
| 6 | 	fyl2x | |
| 7 | 	fstps 4(%esp) | |
| 8 | 	flds 4(%esp) | |
| 9 | 	ret |
lib/libc/musl/src/math/i386/sqrt.c deleted-15| ... | ... | @@ -1,15 +0,0 @@ |
| 1 | #include "libm.h" | |
| 2 | ||
| 3 | double sqrt(double x) | |
| 4 | { | |
| 5 | 	union ldshape ux; | |
| 6 | 	unsigned fpsr; | |
| 7 | 	__asm__ ("fsqrt; fnstsw %%ax": "=t"(ux.f), "=a"(fpsr) : "0"(x)); | |
| 8 | 	if ((ux.i.m & 0x7ff) != 0x400) | |
| 9 | 		return (double)ux.f; | |
| 10 | 	/* Rounding to double would have encountered an exact halfway case. | |
| 11 | 	 Adjust mantissa downwards if fsqrt rounded up, else upwards. | |
| 12 | 	 (result of fsqrt could not have been exact) */ | |
| 13 | 	ux.i.m ^= (fpsr & 0x200) + 0x300; | |
| 14 | 	return (double)ux.f; | |
| 15 | } |
lib/libc/musl/src/math/i386/sqrtf.c deleted-12| ... | ... | @@ -1,12 +0,0 @@ |
| 1 | #include <math.h> | |
| 2 | ||
| 3 | float sqrtf(float x) | |
| 4 | { | |
| 5 | 	long double t; | |
| 6 | 	/* The long double result has sufficient precision so that | |
| 7 | 	 * second rounding to float still keeps the returned value | |
| 8 | 	 * correctly rounded, see Pierre Roux, "Innocuous Double | |
| 9 | 	 * Rounding of Basic Arithmetic Operations". */ | |
| 10 | 	__asm__ ("fsqrt" : "=t"(t) : "0"(x)); | |
| 11 | 	return (float)t; | |
| 12 | } |
lib/libc/musl/src/math/i386/sqrtl.c deleted-7| ... | ... | @@ -1,7 +0,0 @@ |
| 1 | #include <math.h> | |
| 2 | ||
| 3 | long double sqrtl(long double x) | |
| 4 | { | |
| 5 | 	__asm__ ("fsqrt" : "+t"(x)); | |
| 6 | 	return x; | |
| 7 | } |
lib/libc/musl/src/math/log2_data.c deleted-201| ... | ... | @@ -1,201 +0,0 @@ |
| 1 | /* | |
| 2 | * Data for log2. | |
| 3 | * | |
| 4 | * Copyright (c) 2018, Arm Limited. | |
| 5 | * SPDX-License-Identifier: MIT | |
| 6 | */ | |
| 7 | ||
| 8 | #include "log2_data.h" | |
| 9 | ||
| 10 | #define N (1 << LOG2_TABLE_BITS) | |
| 11 | ||
| 12 | const struct log2_data __log2_data = { | |
| 13 | // First coefficient: 0x1.71547652b82fe1777d0ffda0d24p0 | |
| 14 | .invln2hi = 0x1.7154765200000p+0, | |
| 15 | .invln2lo = 0x1.705fc2eefa200p-33, | |
| 16 | .poly1 = { | |
| 17 | // relative error: 0x1.2fad8188p-63 | |
| 18 | // in -0x1.5b51p-5 0x1.6ab2p-5 | |
| 19 | -0x1.71547652b82fep-1, | |
| 20 | 0x1.ec709dc3a03f7p-2, | |
| 21 | -0x1.71547652b7c3fp-2, | |
| 22 | 0x1.2776c50f05be4p-2, | |
| 23 | -0x1.ec709dd768fe5p-3, | |
| 24 | 0x1.a61761ec4e736p-3, | |
| 25 | -0x1.7153fbc64a79bp-3, | |
| 26 | 0x1.484d154f01b4ap-3, | |
| 27 | -0x1.289e4a72c383cp-3, | |
| 28 | 0x1.0b32f285aee66p-3, | |
| 29 | }, | |
| 30 | .poly = { | |
| 31 | // relative error: 0x1.a72c2bf8p-58 | |
| 32 | // abs error: 0x1.67a552c8p-66 | |
| 33 | // in -0x1.f45p-8 0x1.f45p-8 | |
| 34 | -0x1.71547652b8339p-1, | |
| 35 | 0x1.ec709dc3a04bep-2, | |
| 36 | -0x1.7154764702ffbp-2, | |
| 37 | 0x1.2776c50034c48p-2, | |
| 38 | -0x1.ec7b328ea92bcp-3, | |
| 39 | 0x1.a6225e117f92ep-3, | |
| 40 | }, | |
| 41 | /* Algorithm: | |
| 42 | ||
| 43 | 	x = 2^k z | |
| 44 | 	log2(x) = k + log2(c) + log2(z/c) | |
| 45 | 	log2(z/c) = poly(z/c - 1) | |
| 46 | ||
| 47 | where z is in [1.6p-1; 1.6p0] which is split into N subintervals and z falls | |
| 48 | into the ith one, then table entries are computed as | |
| 49 | ||
| 50 | 	tab[i].invc = 1/c | |
| 51 | 	tab[i].logc = (double)log2(c) | |
| 52 | 	tab2[i].chi = (double)c | |
| 53 | 	tab2[i].clo = (double)(c - (double)c) | |
| 54 | ||
| 55 | where c is near the center of the subinterval and is chosen by trying +-2^29 | |
| 56 | floating point invc candidates around 1/center and selecting one for which | |
| 57 | ||
| 58 | 	1) the rounding error in 0x1.8p10 + logc is 0, | |
| 59 | 	2) the rounding error in z - chi - clo is < 0x1p-64 and | |
| 60 | 	3) the rounding error in (double)log2(c) is minimized (< 0x1p-68). | |
| 61 | ||
| 62 | Note: 1) ensures that k + logc can be computed without rounding error, 2) | |
| 63 | ensures that z/c - 1 can be computed as (z - chi - clo)*invc with close to a | |
| 64 | single rounding error when there is no fast fma for z*invc - 1, 3) ensures | |
| 65 | that logc + poly(z/c - 1) has small error, however near x == 1 when | |
| 66 | |log2(x)| < 0x1p-4, this is not enough so that is special cased. */ | |
| 67 | .tab = { | |
| 68 | {0x1.724286bb1acf8p+0, -0x1.1095feecdb000p-1}, | |
| 69 | {0x1.6e1f766d2cca1p+0, -0x1.08494bd76d000p-1}, | |
| 70 | {0x1.6a13d0e30d48ap+0, -0x1.00143aee8f800p-1}, | |
| 71 | {0x1.661ec32d06c85p+0, -0x1.efec5360b4000p-2}, | |
| 72 | {0x1.623fa951198f8p+0, -0x1.dfdd91ab7e000p-2}, | |
| 73 | {0x1.5e75ba4cf026cp+0, -0x1.cffae0cc79000p-2}, | |
| 74 | {0x1.5ac055a214fb8p+0, -0x1.c043811fda000p-2}, | |
| 75 | {0x1.571ed0f166e1ep+0, -0x1.b0b67323ae000p-2}, | |
| 76 | {0x1.53909590bf835p+0, -0x1.a152f5a2db000p-2}, | |
| 77 | {0x1.5014fed61adddp+0, -0x1.9217f5af86000p-2}, | |
| 78 | {0x1.4cab88e487bd0p+0, -0x1.8304db0719000p-2}, | |
| 79 | {0x1.49539b4334feep+0, -0x1.74189f9a9e000p-2}, | |
| 80 | {0x1.460cbdfafd569p+0, -0x1.6552bb5199000p-2}, | |
| 81 | {0x1.42d664ee4b953p+0, -0x1.56b23a29b1000p-2}, | |
| 82 | {0x1.3fb01111dd8a6p+0, -0x1.483650f5fa000p-2}, | |
| 83 | {0x1.3c995b70c5836p+0, -0x1.39de937f6a000p-2}, | |
| 84 | {0x1.3991c4ab6fd4ap+0, -0x1.2baa1538d6000p-2}, | |
| 85 | {0x1.3698e0ce099b5p+0, -0x1.1d98340ca4000p-2}, | |
| 86 | {0x1.33ae48213e7b2p+0, -0x1.0fa853a40e000p-2}, | |
| 87 | {0x1.30d191985bdb1p+0, -0x1.01d9c32e73000p-2}, | |
| 88 | {0x1.2e025cab271d7p+0, -0x1.e857da2fa6000p-3}, | |
| 89 | {0x1.2b404cf13cd82p+0, -0x1.cd3c8633d8000p-3}, | |
| 90 | {0x1.288b02c7ccb50p+0, -0x1.b26034c14a000p-3}, | |
| 91 | {0x1.25e2263944de5p+0, -0x1.97c1c2f4fe000p-3}, | |
| 92 | {0x1.234563d8615b1p+0, -0x1.7d6023f800000p-3}, | |
| 93 | {0x1.20b46e33eaf38p+0, -0x1.633a71a05e000p-3}, | |
| 94 | {0x1.1e2eefdcda3ddp+0, -0x1.494f5e9570000p-3}, | |
| 95 | {0x1.1bb4a580b3930p+0, -0x1.2f9e424e0a000p-3}, | |
| 96 | {0x1.19453847f2200p+0, -0x1.162595afdc000p-3}, | |
| 97 | {0x1.16e06c0d5d73cp+0, -0x1.f9c9a75bd8000p-4}, | |
| 98 | {0x1.1485f47b7e4c2p+0, -0x1.c7b575bf9c000p-4}, | |
| 99 | {0x1.12358ad0085d1p+0, -0x1.960c60ff48000p-4}, | |
| 100 | {0x1.0fef00f532227p+0, -0x1.64ce247b60000p-4}, | |
| 101 | {0x1.0db2077d03a8fp+0, -0x1.33f78b2014000p-4}, | |
| 102 | {0x1.0b7e6d65980d9p+0, -0x1.0387d1a42c000p-4}, | |
| 103 | {0x1.0953efe7b408dp+0, -0x1.a6f9208b50000p-5}, | |
| 104 | {0x1.07325cac53b83p+0, -0x1.47a954f770000p-5}, | |
| 105 | {0x1.05197e40d1b5cp+0, -0x1.d23a8c50c0000p-6}, | |
| 106 | {0x1.03091c1208ea2p+0, -0x1.16a2629780000p-6}, | |
| 107 | {0x1.0101025b37e21p+0, -0x1.720f8d8e80000p-8}, | |
| 108 | {0x1.fc07ef9caa76bp-1, 0x1.6fe53b1500000p-7}, | |
| 109 | {0x1.f4465d3f6f184p-1, 0x1.11ccce10f8000p-5}, | |
| 110 | {0x1.ecc079f84107fp-1, 0x1.c4dfc8c8b8000p-5}, | |
| 111 | {0x1.e573a99975ae8p-1, 0x1.3aa321e574000p-4}, | |
| 112 | {0x1.de5d6f0bd3de6p-1, 0x1.918a0d08b8000p-4}, | |
| 113 | {0x1.d77b681ff38b3p-1, 0x1.e72e9da044000p-4}, | |
| 114 | {0x1.d0cb5724de943p-1, 0x1.1dcd2507f6000p-3}, | |
| 115 | {0x1.ca4b2dc0e7563p-1, 0x1.476ab03dea000p-3}, | |
| 116 | {0x1.c3f8ee8d6cb51p-1, 0x1.7074377e22000p-3}, | |
| 117 | {0x1.bdd2b4f020c4cp-1, 0x1.98ede8ba94000p-3}, | |
| 118 | {0x1.b7d6c006015cap-1, 0x1.c0db86ad2e000p-3}, | |
| 119 | {0x1.b20366e2e338fp-1, 0x1.e840aafcee000p-3}, | |
| 120 | {0x1.ac57026295039p-1, 0x1.0790ab4678000p-2}, | |
| 121 | {0x1.a6d01bc2731ddp-1, 0x1.1ac056801c000p-2}, | |
| 122 | {0x1.a16d3bc3ff18bp-1, 0x1.2db11d4fee000p-2}, | |
| 123 | {0x1.9c2d14967feadp-1, 0x1.406464ec58000p-2}, | |
| 124 | {0x1.970e4f47c9902p-1, 0x1.52dbe093af000p-2}, | |
| 125 | {0x1.920fb3982bcf2p-1, 0x1.651902050d000p-2}, | |
| 126 | {0x1.8d30187f759f1p-1, 0x1.771d2cdeaf000p-2}, | |
| 127 | {0x1.886e5ebb9f66dp-1, 0x1.88e9c857d9000p-2}, | |
| 128 | {0x1.83c97b658b994p-1, 0x1.9a80155e16000p-2}, | |
| 129 | {0x1.7f405ffc61022p-1, 0x1.abe186ed3d000p-2}, | |
| 130 | {0x1.7ad22181415cap-1, 0x1.bd0f2aea0e000p-2}, | |
| 131 | {0x1.767dcf99eff8cp-1, 0x1.ce0a43dbf4000p-2}, | |
| 132 | }, | |
| 133 | #if !__FP_FAST_FMA | |
| 134 | .tab2 = { | |
| 135 | {0x1.6200012b90a8ep-1, 0x1.904ab0644b605p-55}, | |
| 136 | {0x1.66000045734a6p-1, 0x1.1ff9bea62f7a9p-57}, | |
| 137 | {0x1.69fffc325f2c5p-1, 0x1.27ecfcb3c90bap-55}, | |
| 138 | {0x1.6e00038b95a04p-1, 0x1.8ff8856739326p-55}, | |
| 139 | {0x1.71fffe09994e3p-1, 0x1.afd40275f82b1p-55}, | |
| 140 | {0x1.7600015590e1p-1, -0x1.2fd75b4238341p-56}, | |
| 141 | {0x1.7a00012655bd5p-1, 0x1.808e67c242b76p-56}, | |
| 142 | {0x1.7e0003259e9a6p-1, -0x1.208e426f622b7p-57}, | |
| 143 | {0x1.81fffedb4b2d2p-1, -0x1.402461ea5c92fp-55}, | |
| 144 | {0x1.860002dfafcc3p-1, 0x1.df7f4a2f29a1fp-57}, | |
| 145 | {0x1.89ffff78c6b5p-1, -0x1.e0453094995fdp-55}, | |
| 146 | {0x1.8e00039671566p-1, -0x1.a04f3bec77b45p-55}, | |
| 147 | {0x1.91fffe2bf1745p-1, -0x1.7fa34400e203cp-56}, | |
| 148 | {0x1.95fffcc5c9fd1p-1, -0x1.6ff8005a0695dp-56}, | |
| 149 | {0x1.9a0003bba4767p-1, 0x1.0f8c4c4ec7e03p-56}, | |
| 150 | {0x1.9dfffe7b92da5p-1, 0x1.e7fd9478c4602p-55}, | |
| 151 | {0x1.a1fffd72efdafp-1, -0x1.a0c554dcdae7ep-57}, | |
| 152 | {0x1.a5fffde04ff95p-1, 0x1.67da98ce9b26bp-55}, | |
| 153 | {0x1.a9fffca5e8d2bp-1, -0x1.284c9b54c13dep-55}, | |
| 154 | {0x1.adfffddad03eap-1, 0x1.812c8ea602e3cp-58}, | |
| 155 | {0x1.b1ffff10d3d4dp-1, -0x1.efaddad27789cp-55}, | |
| 156 | {0x1.b5fffce21165ap-1, 0x1.3cb1719c61237p-58}, | |
| 157 | {0x1.b9fffd950e674p-1, 0x1.3f7d94194cep-56}, | |
| 158 | {0x1.be000139ca8afp-1, 0x1.50ac4215d9bcp-56}, | |
| 159 | {0x1.c20005b46df99p-1, 0x1.beea653e9c1c9p-57}, | |
| 160 | {0x1.c600040b9f7aep-1, -0x1.c079f274a70d6p-56}, | |
| 161 | {0x1.ca0006255fd8ap-1, -0x1.a0b4076e84c1fp-56}, | |
| 162 | {0x1.cdfffd94c095dp-1, 0x1.8f933f99ab5d7p-55}, | |
| 163 | {0x1.d1ffff975d6cfp-1, -0x1.82c08665fe1bep-58}, | |
| 164 | {0x1.d5fffa2561c93p-1, -0x1.b04289bd295f3p-56}, | |
| 165 | {0x1.d9fff9d228b0cp-1, 0x1.70251340fa236p-55}, | |
| 166 | {0x1.de00065bc7e16p-1, -0x1.5011e16a4d80cp-56}, | |
| 167 | {0x1.e200002f64791p-1, 0x1.9802f09ef62ep-55}, | |
| 168 | {0x1.e600057d7a6d8p-1, -0x1.e0b75580cf7fap-56}, | |
| 169 | {0x1.ea00027edc00cp-1, -0x1.c848309459811p-55}, | |
| 170 | {0x1.ee0006cf5cb7cp-1, -0x1.f8027951576f4p-55}, | |
| 171 | {0x1.f2000782b7dccp-1, -0x1.f81d97274538fp-55}, | |
| 172 | {0x1.f6000260c450ap-1, -0x1.071002727ffdcp-59}, | |
| 173 | {0x1.f9fffe88cd533p-1, -0x1.81bdce1fda8bp-58}, | |
| 174 | {0x1.fdfffd50f8689p-1, 0x1.7f91acb918e6ep-55}, | |
| 175 | {0x1.0200004292367p+0, 0x1.b7ff365324681p-54}, | |
| 176 | {0x1.05fffe3e3d668p+0, 0x1.6fa08ddae957bp-55}, | |
| 177 | {0x1.0a0000a85a757p+0, -0x1.7e2de80d3fb91p-58}, | |
| 178 | {0x1.0e0001a5f3fccp+0, -0x1.1823305c5f014p-54}, | |
| 179 | {0x1.11ffff8afbaf5p+0, -0x1.bfabb6680bac2p-55}, | |
| 180 | {0x1.15fffe54d91adp+0, -0x1.d7f121737e7efp-54}, | |
| 181 | {0x1.1a00011ac36e1p+0, 0x1.c000a0516f5ffp-54}, | |
| 182 | {0x1.1e00019c84248p+0, -0x1.082fbe4da5dap-54}, | |
| 183 | {0x1.220000ffe5e6ep+0, -0x1.8fdd04c9cfb43p-55}, | |
| 184 | {0x1.26000269fd891p+0, 0x1.cfe2a7994d182p-55}, | |
| 185 | {0x1.2a00029a6e6dap+0, -0x1.00273715e8bc5p-56}, | |
| 186 | {0x1.2dfffe0293e39p+0, 0x1.b7c39dab2a6f9p-54}, | |
| 187 | {0x1.31ffff7dcf082p+0, 0x1.df1336edc5254p-56}, | |
| 188 | {0x1.35ffff05a8b6p+0, -0x1.e03564ccd31ebp-54}, | |
| 189 | {0x1.3a0002e0eaeccp+0, 0x1.5f0e74bd3a477p-56}, | |
| 190 | {0x1.3e000043bb236p+0, 0x1.c7dcb149d8833p-54}, | |
| 191 | {0x1.4200002d187ffp+0, 0x1.e08afcf2d3d28p-56}, | |
| 192 | {0x1.460000d387cb1p+0, 0x1.20837856599a6p-55}, | |
| 193 | {0x1.4a00004569f89p+0, -0x1.9fa5c904fbcd2p-55}, | |
| 194 | {0x1.4e000043543f3p+0, -0x1.81125ed175329p-56}, | |
| 195 | {0x1.51fffcc027f0fp+0, 0x1.883d8847754dcp-54}, | |
| 196 | {0x1.55ffffd87b36fp+0, -0x1.709e731d02807p-55}, | |
| 197 | {0x1.59ffff21df7bap+0, 0x1.7f79f68727b02p-55}, | |
| 198 | {0x1.5dfffebfc3481p+0, -0x1.180902e30e93ep-54}, | |
| 199 | }, | |
| 200 | #endif | |
| 201 | }; |
lib/libc/musl/src/math/log2_data.h deleted-28| ... | ... | @@ -1,28 +0,0 @@ |
| 1 | /* | |
| 2 | * Copyright (c) 2018, Arm Limited. | |
| 3 | * SPDX-License-Identifier: MIT | |
| 4 | */ | |
| 5 | #ifndef _LOG2_DATA_H | |
| 6 | #define _LOG2_DATA_H | |
| 7 | ||
| 8 | #include <features.h> | |
| 9 | ||
| 10 | #define LOG2_TABLE_BITS 6 | |
| 11 | #define LOG2_POLY_ORDER 7 | |
| 12 | #define LOG2_POLY1_ORDER 11 | |
| 13 | extern hidden const struct log2_data { | |
| 14 | 	double invln2hi; | |
| 15 | 	double invln2lo; | |
| 16 | 	double poly[LOG2_POLY_ORDER - 1]; | |
| 17 | 	double poly1[LOG2_POLY1_ORDER - 1]; | |
| 18 | 	struct { | |
| 19 | 		double invc, logc; | |
| 20 | 	} tab[1 << LOG2_TABLE_BITS]; | |
| 21 | #if !__FP_FAST_FMA | |
| 22 | 	struct { | |
| 23 | 		double chi, clo; | |
| 24 | 	} tab2[1 << LOG2_TABLE_BITS]; | |
| 25 | #endif | |
| 26 | } __log2_data; | |
| 27 | ||
| 28 | #endif |
lib/libc/musl/src/math/log2f_data.c deleted-33| ... | ... | @@ -1,33 +0,0 @@ |
| 1 | /* | |
| 2 | * Data definition for log2f. | |
| 3 | * | |
| 4 | * Copyright (c) 2017-2018, Arm Limited. | |
| 5 | * SPDX-License-Identifier: MIT | |
| 6 | */ | |
| 7 | ||
| 8 | #include "log2f_data.h" | |
| 9 | ||
| 10 | const struct log2f_data __log2f_data = { | |
| 11 | .tab = { | |
| 12 | { 0x1.661ec79f8f3bep+0, -0x1.efec65b963019p-2 }, | |
| 13 | { 0x1.571ed4aaf883dp+0, -0x1.b0b6832d4fca4p-2 }, | |
| 14 | { 0x1.49539f0f010bp+0, -0x1.7418b0a1fb77bp-2 }, | |
| 15 | { 0x1.3c995b0b80385p+0, -0x1.39de91a6dcf7bp-2 }, | |
| 16 | { 0x1.30d190c8864a5p+0, -0x1.01d9bf3f2b631p-2 }, | |
| 17 | { 0x1.25e227b0b8eap+0, -0x1.97c1d1b3b7afp-3 }, | |
| 18 | { 0x1.1bb4a4a1a343fp+0, -0x1.2f9e393af3c9fp-3 }, | |
| 19 | { 0x1.12358f08ae5bap+0, -0x1.960cbbf788d5cp-4 }, | |
| 20 | { 0x1.0953f419900a7p+0, -0x1.a6f9db6475fcep-5 }, | |
| 21 | { 0x1p+0, 0x0p+0 }, | |
| 22 | { 0x1.e608cfd9a47acp-1, 0x1.338ca9f24f53dp-4 }, | |
| 23 | { 0x1.ca4b31f026aap-1, 0x1.476a9543891bap-3 }, | |
| 24 | { 0x1.b2036576afce6p-1, 0x1.e840b4ac4e4d2p-3 }, | |
| 25 | { 0x1.9c2d163a1aa2dp-1, 0x1.40645f0c6651cp-2 }, | |
| 26 | { 0x1.886e6037841edp-1, 0x1.88e9c2c1b9ff8p-2 }, | |
| 27 | { 0x1.767dcf5534862p-1, 0x1.ce0a44eb17bccp-2 }, | |
| 28 | }, | |
| 29 | .poly = { | |
| 30 | -0x1.712b6f70a7e4dp-2, 0x1.ecabf496832ep-2, -0x1.715479ffae3dep-1, | |
| 31 | 0x1.715475f35c8b8p0, | |
| 32 | } | |
| 33 | }; |
lib/libc/musl/src/math/log2f_data.h deleted-19| ... | ... | @@ -1,19 +0,0 @@ |
| 1 | /* | |
| 2 | * Copyright (c) 2017-2018, Arm Limited. | |
| 3 | * SPDX-License-Identifier: MIT | |
| 4 | */ | |
| 5 | #ifndef _LOG2F_DATA_H | |
| 6 | #define _LOG2F_DATA_H | |
| 7 | ||
| 8 | #include <features.h> | |
| 9 | ||
| 10 | #define LOG2F_TABLE_BITS 4 | |
| 11 | #define LOG2F_POLY_ORDER 4 | |
| 12 | extern hidden const struct log2f_data { | |
| 13 | 	struct { | |
| 14 | 		double invc, logc; | |
| 15 | 	} tab[1 << LOG2F_TABLE_BITS]; | |
| 16 | 	double poly[LOG2F_POLY_ORDER]; | |
| 17 | } __log2f_data; | |
| 18 | ||
| 19 | #endif |
lib/libc/musl/src/math/log_data.c deleted-328| ... | ... | @@ -1,328 +0,0 @@ |
| 1 | /* | |
| 2 | * Data for log. | |
| 3 | * | |
| 4 | * Copyright (c) 2018, Arm Limited. | |
| 5 | * SPDX-License-Identifier: MIT | |
| 6 | */ | |
| 7 | ||
| 8 | #include "log_data.h" | |
| 9 | ||
| 10 | #define N (1 << LOG_TABLE_BITS) | |
| 11 | ||
| 12 | const struct log_data __log_data = { | |
| 13 | .ln2hi = 0x1.62e42fefa3800p-1, | |
| 14 | .ln2lo = 0x1.ef35793c76730p-45, | |
| 15 | .poly1 = { | |
| 16 | // relative error: 0x1.c04d76cp-63 | |
| 17 | // in -0x1p-4 0x1.09p-4 (|log(1+x)| > 0x1p-4 outside the interval) | |
| 18 | -0x1p-1, | |
| 19 | 0x1.5555555555577p-2, | |
| 20 | -0x1.ffffffffffdcbp-3, | |
| 21 | 0x1.999999995dd0cp-3, | |
| 22 | -0x1.55555556745a7p-3, | |
| 23 | 0x1.24924a344de3p-3, | |
| 24 | -0x1.fffffa4423d65p-4, | |
| 25 | 0x1.c7184282ad6cap-4, | |
| 26 | -0x1.999eb43b068ffp-4, | |
| 27 | 0x1.78182f7afd085p-4, | |
| 28 | -0x1.5521375d145cdp-4, | |
| 29 | }, | |
| 30 | .poly = { | |
| 31 | // relative error: 0x1.926199e8p-56 | |
| 32 | // abs error: 0x1.882ff33p-65 | |
| 33 | // in -0x1.fp-9 0x1.fp-9 | |
| 34 | -0x1.0000000000001p-1, | |
| 35 | 0x1.555555551305bp-2, | |
| 36 | -0x1.fffffffeb459p-3, | |
| 37 | 0x1.999b324f10111p-3, | |
| 38 | -0x1.55575e506c89fp-3, | |
| 39 | }, | |
| 40 | /* Algorithm: | |
| 41 | ||
| 42 | 	x = 2^k z | |
| 43 | 	log(x) = k ln2 + log(c) + log(z/c) | |
| 44 | 	log(z/c) = poly(z/c - 1) | |
| 45 | ||
| 46 | where z is in [1.6p-1; 1.6p0] which is split into N subintervals and z falls | |
| 47 | into the ith one, then table entries are computed as | |
| 48 | ||
| 49 | 	tab[i].invc = 1/c | |
| 50 | 	tab[i].logc = (double)log(c) | |
| 51 | 	tab2[i].chi = (double)c | |
| 52 | 	tab2[i].clo = (double)(c - (double)c) | |
| 53 | ||
| 54 | where c is near the center of the subinterval and is chosen by trying +-2^29 | |
| 55 | floating point invc candidates around 1/center and selecting one for which | |
| 56 | ||
| 57 | 	1) the rounding error in 0x1.8p9 + logc is 0, | |
| 58 | 	2) the rounding error in z - chi - clo is < 0x1p-66 and | |
| 59 | 	3) the rounding error in (double)log(c) is minimized (< 0x1p-66). | |
| 60 | ||
| 61 | Note: 1) ensures that k*ln2hi + logc can be computed without rounding error, | |
| 62 | 2) ensures that z/c - 1 can be computed as (z - chi - clo)*invc with close to | |
| 63 | a single rounding error when there is no fast fma for z*invc - 1, 3) ensures | |
| 64 | that logc + poly(z/c - 1) has small error, however near x == 1 when | |
| 65 | |log(x)| < 0x1p-4, this is not enough so that is special cased. */ | |
| 66 | .tab = { | |
| 67 | {0x1.734f0c3e0de9fp+0, -0x1.7cc7f79e69000p-2}, | |
| 68 | {0x1.713786a2ce91fp+0, -0x1.76feec20d0000p-2}, | |
| 69 | {0x1.6f26008fab5a0p+0, -0x1.713e31351e000p-2}, | |
| 70 | {0x1.6d1a61f138c7dp+0, -0x1.6b85b38287800p-2}, | |
| 71 | {0x1.6b1490bc5b4d1p+0, -0x1.65d5590807800p-2}, | |
| 72 | {0x1.69147332f0cbap+0, -0x1.602d076180000p-2}, | |
| 73 | {0x1.6719f18224223p+0, -0x1.5a8ca86909000p-2}, | |
| 74 | {0x1.6524f99a51ed9p+0, -0x1.54f4356035000p-2}, | |
| 75 | {0x1.63356aa8f24c4p+0, -0x1.4f637c36b4000p-2}, | |
| 76 | {0x1.614b36b9ddc14p+0, -0x1.49da7fda85000p-2}, | |
| 77 | {0x1.5f66452c65c4cp+0, -0x1.445923989a800p-2}, | |
| 78 | {0x1.5d867b5912c4fp+0, -0x1.3edf439b0b800p-2}, | |
| 79 | {0x1.5babccb5b90dep+0, -0x1.396ce448f7000p-2}, | |
| 80 | {0x1.59d61f2d91a78p+0, -0x1.3401e17bda000p-2}, | |
| 81 | {0x1.5805612465687p+0, -0x1.2e9e2ef468000p-2}, | |
| 82 | {0x1.56397cee76bd3p+0, -0x1.2941b3830e000p-2}, | |
| 83 | {0x1.54725e2a77f93p+0, -0x1.23ec58cda8800p-2}, | |
| 84 | {0x1.52aff42064583p+0, -0x1.1e9e129279000p-2}, | |
| 85 | {0x1.50f22dbb2bddfp+0, -0x1.1956d2b48f800p-2}, | |
| 86 | {0x1.4f38f4734ded7p+0, -0x1.141679ab9f800p-2}, | |
| 87 | {0x1.4d843cfde2840p+0, -0x1.0edd094ef9800p-2}, | |
| 88 | {0x1.4bd3ec078a3c8p+0, -0x1.09aa518db1000p-2}, | |
| 89 | {0x1.4a27fc3e0258ap+0, -0x1.047e65263b800p-2}, | |
| 90 | {0x1.4880524d48434p+0, -0x1.feb224586f000p-3}, | |
| 91 | {0x1.46dce1b192d0bp+0, -0x1.f474a7517b000p-3}, | |
| 92 | {0x1.453d9d3391854p+0, -0x1.ea4443d103000p-3}, | |
| 93 | {0x1.43a2744b4845ap+0, -0x1.e020d44e9b000p-3}, | |
| 94 | {0x1.420b54115f8fbp+0, -0x1.d60a22977f000p-3}, | |
| 95 | {0x1.40782da3ef4b1p+0, -0x1.cc00104959000p-3}, | |
| 96 | {0x1.3ee8f5d57fe8fp+0, -0x1.c202956891000p-3}, | |
| 97 | {0x1.3d5d9a00b4ce9p+0, -0x1.b81178d811000p-3}, | |
| 98 | {0x1.3bd60c010c12bp+0, -0x1.ae2c9ccd3d000p-3}, | |
| 99 | {0x1.3a5242b75dab8p+0, -0x1.a45402e129000p-3}, | |
| 100 | {0x1.38d22cd9fd002p+0, -0x1.9a877681df000p-3}, | |
| 101 | {0x1.3755bc5847a1cp+0, -0x1.90c6d69483000p-3}, | |
| 102 | {0x1.35dce49ad36e2p+0, -0x1.87120a645c000p-3}, | |
| 103 | {0x1.34679984dd440p+0, -0x1.7d68fb4143000p-3}, | |
| 104 | {0x1.32f5cceffcb24p+0, -0x1.73cb83c627000p-3}, | |
| 105 | {0x1.3187775a10d49p+0, -0x1.6a39a9b376000p-3}, | |
| 106 | {0x1.301c8373e3990p+0, -0x1.60b3154b7a000p-3}, | |
| 107 | {0x1.2eb4ebb95f841p+0, -0x1.5737d76243000p-3}, | |
| 108 | {0x1.2d50a0219a9d1p+0, -0x1.4dc7b8fc23000p-3}, | |
| 109 | {0x1.2bef9a8b7fd2ap+0, -0x1.4462c51d20000p-3}, | |
| 110 | {0x1.2a91c7a0c1babp+0, -0x1.3b08abc830000p-3}, | |
| 111 | {0x1.293726014b530p+0, -0x1.31b996b490000p-3}, | |
| 112 | {0x1.27dfa5757a1f5p+0, -0x1.2875490a44000p-3}, | |
| 113 | {0x1.268b39b1d3bbfp+0, -0x1.1f3b9f879a000p-3}, | |
| 114 | {0x1.2539d838ff5bdp+0, -0x1.160c8252ca000p-3}, | |
| 115 | {0x1.23eb7aac9083bp+0, -0x1.0ce7f57f72000p-3}, | |
| 116 | {0x1.22a012ba940b6p+0, -0x1.03cdc49fea000p-3}, | |
| 117 | {0x1.2157996cc4132p+0, -0x1.f57bdbc4b8000p-4}, | |
| 118 | {0x1.201201dd2fc9bp+0, -0x1.e370896404000p-4}, | |
| 119 | {0x1.1ecf4494d480bp+0, -0x1.d17983ef94000p-4}, | |
| 120 | {0x1.1d8f5528f6569p+0, -0x1.bf9674ed8a000p-4}, | |
| 121 | {0x1.1c52311577e7cp+0, -0x1.adc79202f6000p-4}, | |
| 122 | {0x1.1b17c74cb26e9p+0, -0x1.9c0c3e7288000p-4}, | |
| 123 | {0x1.19e010c2c1ab6p+0, -0x1.8a646b372c000p-4}, | |
| 124 | {0x1.18ab07bb670bdp+0, -0x1.78d01b3ac0000p-4}, | |
| 125 | {0x1.1778a25efbcb6p+0, -0x1.674f145380000p-4}, | |
| 126 | {0x1.1648d354c31dap+0, -0x1.55e0e6d878000p-4}, | |
| 127 | {0x1.151b990275fddp+0, -0x1.4485cdea1e000p-4}, | |
| 128 | {0x1.13f0ea432d24cp+0, -0x1.333d94d6aa000p-4}, | |
| 129 | {0x1.12c8b7210f9dap+0, -0x1.22079f8c56000p-4}, | |
| 130 | {0x1.11a3028ecb531p+0, -0x1.10e4698622000p-4}, | |
| 131 | {0x1.107fbda8434afp+0, -0x1.ffa6c6ad20000p-5}, | |
| 132 | {0x1.0f5ee0f4e6bb3p+0, -0x1.dda8d4a774000p-5}, | |
| 133 | {0x1.0e4065d2a9fcep+0, -0x1.bbcece4850000p-5}, | |
| 134 | {0x1.0d244632ca521p+0, -0x1.9a1894012c000p-5}, | |
| 135 | {0x1.0c0a77ce2981ap+0, -0x1.788583302c000p-5}, | |
| 136 | {0x1.0af2f83c636d1p+0, -0x1.5715e67d68000p-5}, | |
| 137 | {0x1.09ddb98a01339p+0, -0x1.35c8a49658000p-5}, | |
| 138 | {0x1.08cabaf52e7dfp+0, -0x1.149e364154000p-5}, | |
| 139 | {0x1.07b9f2f4e28fbp+0, -0x1.e72c082eb8000p-6}, | |
| 140 | {0x1.06ab58c358f19p+0, -0x1.a55f152528000p-6}, | |
| 141 | {0x1.059eea5ecf92cp+0, -0x1.63d62cf818000p-6}, | |
| 142 | {0x1.04949cdd12c90p+0, -0x1.228fb8caa0000p-6}, | |
| 143 | {0x1.038c6c6f0ada9p+0, -0x1.c317b20f90000p-7}, | |
| 144 | {0x1.02865137932a9p+0, -0x1.419355daa0000p-7}, | |
| 145 | {0x1.0182427ea7348p+0, -0x1.81203c2ec0000p-8}, | |
| 146 | {0x1.008040614b195p+0, -0x1.0040979240000p-9}, | |
| 147 | {0x1.fe01ff726fa1ap-1, 0x1.feff384900000p-9}, | |
| 148 | {0x1.fa11cc261ea74p-1, 0x1.7dc41353d0000p-7}, | |
| 149 | {0x1.f6310b081992ep-1, 0x1.3cea3c4c28000p-6}, | |
| 150 | {0x1.f25f63ceeadcdp-1, 0x1.b9fc114890000p-6}, | |
| 151 | {0x1.ee9c8039113e7p-1, 0x1.1b0d8ce110000p-5}, | |
| 152 | {0x1.eae8078cbb1abp-1, 0x1.58a5bd001c000p-5}, | |
| 153 | {0x1.e741aa29d0c9bp-1, 0x1.95c8340d88000p-5}, | |
| 154 | {0x1.e3a91830a99b5p-1, 0x1.d276aef578000p-5}, | |
| 155 | {0x1.e01e009609a56p-1, 0x1.07598e598c000p-4}, | |
| 156 | {0x1.dca01e577bb98p-1, 0x1.253f5e30d2000p-4}, | |
| 157 | {0x1.d92f20b7c9103p-1, 0x1.42edd8b380000p-4}, | |
| 158 | {0x1.d5cac66fb5ccep-1, 0x1.606598757c000p-4}, | |
| 159 | {0x1.d272caa5ede9dp-1, 0x1.7da76356a0000p-4}, | |
| 160 | {0x1.cf26e3e6b2ccdp-1, 0x1.9ab434e1c6000p-4}, | |
| 161 | {0x1.cbe6da2a77902p-1, 0x1.b78c7bb0d6000p-4}, | |
| 162 | {0x1.c8b266d37086dp-1, 0x1.d431332e72000p-4}, | |
| 163 | {0x1.c5894bd5d5804p-1, 0x1.f0a3171de6000p-4}, | |
| 164 | {0x1.c26b533bb9f8cp-1, 0x1.067152b914000p-3}, | |
| 165 | {0x1.bf583eeece73fp-1, 0x1.147858292b000p-3}, | |
| 166 | {0x1.bc4fd75db96c1p-1, 0x1.2266ecdca3000p-3}, | |
| 167 | {0x1.b951e0c864a28p-1, 0x1.303d7a6c55000p-3}, | |
| 168 | {0x1.b65e2c5ef3e2cp-1, 0x1.3dfc33c331000p-3}, | |
| 169 | {0x1.b374867c9888bp-1, 0x1.4ba366b7a8000p-3}, | |
| 170 | {0x1.b094b211d304ap-1, 0x1.5933928d1f000p-3}, | |
| 171 | {0x1.adbe885f2ef7ep-1, 0x1.66acd2418f000p-3}, | |
| 172 | {0x1.aaf1d31603da2p-1, 0x1.740f8ec669000p-3}, | |
| 173 | {0x1.a82e63fd358a7p-1, 0x1.815c0f51af000p-3}, | |
| 174 | {0x1.a5740ef09738bp-1, 0x1.8e92954f68000p-3}, | |
| 175 | {0x1.a2c2a90ab4b27p-1, 0x1.9bb3602f84000p-3}, | |
| 176 | {0x1.a01a01393f2d1p-1, 0x1.a8bed1c2c0000p-3}, | |
| 177 | {0x1.9d79f24db3c1bp-1, 0x1.b5b515c01d000p-3}, | |
| 178 | {0x1.9ae2505c7b190p-1, 0x1.c2967ccbcc000p-3}, | |
| 179 | {0x1.9852ef297ce2fp-1, 0x1.cf635d5486000p-3}, | |
| 180 | {0x1.95cbaeea44b75p-1, 0x1.dc1bd3446c000p-3}, | |
| 181 | {0x1.934c69de74838p-1, 0x1.e8c01b8cfe000p-3}, | |
| 182 | {0x1.90d4f2f6752e6p-1, 0x1.f5509c0179000p-3}, | |
| 183 | {0x1.8e6528effd79dp-1, 0x1.00e6c121fb800p-2}, | |
| 184 | {0x1.8bfce9fcc007cp-1, 0x1.071b80e93d000p-2}, | |
| 185 | {0x1.899c0dabec30ep-1, 0x1.0d46b9e867000p-2}, | |
| 186 | {0x1.87427aa2317fbp-1, 0x1.13687334bd000p-2}, | |
| 187 | {0x1.84f00acb39a08p-1, 0x1.1980d67234800p-2}, | |
| 188 | {0x1.82a49e8653e55p-1, 0x1.1f8ffe0cc8000p-2}, | |
| 189 | {0x1.8060195f40260p-1, 0x1.2595fd7636800p-2}, | |
| 190 | {0x1.7e22563e0a329p-1, 0x1.2b9300914a800p-2}, | |
| 191 | {0x1.7beb377dcb5adp-1, 0x1.3187210436000p-2}, | |
| 192 | {0x1.79baa679725c2p-1, 0x1.377266dec1800p-2}, | |
| 193 | {0x1.77907f2170657p-1, 0x1.3d54ffbaf3000p-2}, | |
| 194 | {0x1.756cadbd6130cp-1, 0x1.432eee32fe000p-2}, | |
| 195 | }, | |
| 196 | #if !__FP_FAST_FMA | |
| 197 | .tab2 = { | |
| 198 | {0x1.61000014fb66bp-1, 0x1.e026c91425b3cp-56}, | |
| 199 | {0x1.63000034db495p-1, 0x1.dbfea48005d41p-55}, | |
| 200 | {0x1.650000d94d478p-1, 0x1.e7fa786d6a5b7p-55}, | |
| 201 | {0x1.67000074e6fadp-1, 0x1.1fcea6b54254cp-57}, | |
| 202 | {0x1.68ffffedf0faep-1, -0x1.c7e274c590efdp-56}, | |
| 203 | {0x1.6b0000763c5bcp-1, -0x1.ac16848dcda01p-55}, | |
| 204 | {0x1.6d0001e5cc1f6p-1, 0x1.33f1c9d499311p-55}, | |
| 205 | {0x1.6efffeb05f63ep-1, -0x1.e80041ae22d53p-56}, | |
| 206 | {0x1.710000e86978p-1, 0x1.bff6671097952p-56}, | |
| 207 | {0x1.72ffffc67e912p-1, 0x1.c00e226bd8724p-55}, | |
| 208 | {0x1.74fffdf81116ap-1, -0x1.e02916ef101d2p-57}, | |
| 209 | {0x1.770000f679c9p-1, -0x1.7fc71cd549c74p-57}, | |
| 210 | {0x1.78ffffa7ec835p-1, 0x1.1bec19ef50483p-55}, | |
| 211 | {0x1.7affffe20c2e6p-1, -0x1.07e1729cc6465p-56}, | |
| 212 | {0x1.7cfffed3fc9p-1, -0x1.08072087b8b1cp-55}, | |
| 213 | {0x1.7efffe9261a76p-1, 0x1.dc0286d9df9aep-55}, | |
| 214 | {0x1.81000049ca3e8p-1, 0x1.97fd251e54c33p-55}, | |
| 215 | {0x1.8300017932c8fp-1, -0x1.afee9b630f381p-55}, | |
| 216 | {0x1.850000633739cp-1, 0x1.9bfbf6b6535bcp-55}, | |
| 217 | {0x1.87000204289c6p-1, -0x1.bbf65f3117b75p-55}, | |
| 218 | {0x1.88fffebf57904p-1, -0x1.9006ea23dcb57p-55}, | |
| 219 | {0x1.8b00022bc04dfp-1, -0x1.d00df38e04b0ap-56}, | |
| 220 | {0x1.8cfffe50c1b8ap-1, -0x1.8007146ff9f05p-55}, | |
| 221 | {0x1.8effffc918e43p-1, 0x1.3817bd07a7038p-55}, | |
| 222 | {0x1.910001efa5fc7p-1, 0x1.93e9176dfb403p-55}, | |
| 223 | {0x1.9300013467bb9p-1, 0x1.f804e4b980276p-56}, | |
| 224 | {0x1.94fffe6ee076fp-1, -0x1.f7ef0d9ff622ep-55}, | |
| 225 | {0x1.96fffde3c12d1p-1, -0x1.082aa962638bap-56}, | |
| 226 | {0x1.98ffff4458a0dp-1, -0x1.7801b9164a8efp-55}, | |
| 227 | {0x1.9afffdd982e3ep-1, -0x1.740e08a5a9337p-55}, | |
| 228 | {0x1.9cfffed49fb66p-1, 0x1.fce08c19bep-60}, | |
| 229 | {0x1.9f00020f19c51p-1, -0x1.a3faa27885b0ap-55}, | |
| 230 | {0x1.a10001145b006p-1, 0x1.4ff489958da56p-56}, | |
| 231 | {0x1.a300007bbf6fap-1, 0x1.cbeab8a2b6d18p-55}, | |
| 232 | {0x1.a500010971d79p-1, 0x1.8fecadd78793p-55}, | |
| 233 | {0x1.a70001df52e48p-1, -0x1.f41763dd8abdbp-55}, | |
| 234 | {0x1.a90001c593352p-1, -0x1.ebf0284c27612p-55}, | |
| 235 | {0x1.ab0002a4f3e4bp-1, -0x1.9fd043cff3f5fp-57}, | |
| 236 | {0x1.acfffd7ae1ed1p-1, -0x1.23ee7129070b4p-55}, | |
| 237 | {0x1.aefffee510478p-1, 0x1.a063ee00edea3p-57}, | |
| 238 | {0x1.b0fffdb650d5bp-1, 0x1.a06c8381f0ab9p-58}, | |
| 239 | {0x1.b2ffffeaaca57p-1, -0x1.9011e74233c1dp-56}, | |
| 240 | {0x1.b4fffd995badcp-1, -0x1.9ff1068862a9fp-56}, | |
| 241 | {0x1.b7000249e659cp-1, 0x1.aff45d0864f3ep-55}, | |
| 242 | {0x1.b8ffff987164p-1, 0x1.cfe7796c2c3f9p-56}, | |
| 243 | {0x1.bafffd204cb4fp-1, -0x1.3ff27eef22bc4p-57}, | |
| 244 | {0x1.bcfffd2415c45p-1, -0x1.cffb7ee3bea21p-57}, | |
| 245 | {0x1.beffff86309dfp-1, -0x1.14103972e0b5cp-55}, | |
| 246 | {0x1.c0fffe1b57653p-1, 0x1.bc16494b76a19p-55}, | |
| 247 | {0x1.c2ffff1fa57e3p-1, -0x1.4feef8d30c6edp-57}, | |
| 248 | {0x1.c4fffdcbfe424p-1, -0x1.43f68bcec4775p-55}, | |
| 249 | {0x1.c6fffed54b9f7p-1, 0x1.47ea3f053e0ecp-55}, | |
| 250 | {0x1.c8fffeb998fd5p-1, 0x1.383068df992f1p-56}, | |
| 251 | {0x1.cb0002125219ap-1, -0x1.8fd8e64180e04p-57}, | |
| 252 | {0x1.ccfffdd94469cp-1, 0x1.e7ebe1cc7ea72p-55}, | |
| 253 | {0x1.cefffeafdc476p-1, 0x1.ebe39ad9f88fep-55}, | |
| 254 | {0x1.d1000169af82bp-1, 0x1.57d91a8b95a71p-56}, | |
| 255 | {0x1.d30000d0ff71dp-1, 0x1.9c1906970c7dap-55}, | |
| 256 | {0x1.d4fffea790fc4p-1, -0x1.80e37c558fe0cp-58}, | |
| 257 | {0x1.d70002edc87e5p-1, -0x1.f80d64dc10f44p-56}, | |
| 258 | {0x1.d900021dc82aap-1, -0x1.47c8f94fd5c5cp-56}, | |
| 259 | {0x1.dafffd86b0283p-1, 0x1.c7f1dc521617ep-55}, | |
| 260 | {0x1.dd000296c4739p-1, 0x1.8019eb2ffb153p-55}, | |
| 261 | {0x1.defffe54490f5p-1, 0x1.e00d2c652cc89p-57}, | |
| 262 | {0x1.e0fffcdabf694p-1, -0x1.f8340202d69d2p-56}, | |
| 263 | {0x1.e2fffdb52c8ddp-1, 0x1.b00c1ca1b0864p-56}, | |
| 264 | {0x1.e4ffff24216efp-1, 0x1.2ffa8b094ab51p-56}, | |
| 265 | {0x1.e6fffe88a5e11p-1, -0x1.7f673b1efbe59p-58}, | |
| 266 | {0x1.e9000119eff0dp-1, -0x1.4808d5e0bc801p-55}, | |
| 267 | {0x1.eafffdfa51744p-1, 0x1.80006d54320b5p-56}, | |
| 268 | {0x1.ed0001a127fa1p-1, -0x1.002f860565c92p-58}, | |
| 269 | {0x1.ef00007babcc4p-1, -0x1.540445d35e611p-55}, | |
| 270 | {0x1.f0ffff57a8d02p-1, -0x1.ffb3139ef9105p-59}, | |
| 271 | {0x1.f30001ee58ac7p-1, 0x1.a81acf2731155p-55}, | |
| 272 | {0x1.f4ffff5823494p-1, 0x1.a3f41d4d7c743p-55}, | |
| 273 | {0x1.f6ffffca94c6bp-1, -0x1.202f41c987875p-57}, | |
| 274 | {0x1.f8fffe1f9c441p-1, 0x1.77dd1f477e74bp-56}, | |
| 275 | {0x1.fafffd2e0e37ep-1, -0x1.f01199a7ca331p-57}, | |
| 276 | {0x1.fd0001c77e49ep-1, 0x1.181ee4bceacb1p-56}, | |
| 277 | {0x1.feffff7e0c331p-1, -0x1.e05370170875ap-57}, | |
| 278 | {0x1.00ffff465606ep+0, -0x1.a7ead491c0adap-55}, | |
| 279 | {0x1.02ffff3867a58p+0, -0x1.77f69c3fcb2ep-54}, | |
| 280 | {0x1.04ffffdfc0d17p+0, 0x1.7bffe34cb945bp-54}, | |
| 281 | {0x1.0700003cd4d82p+0, 0x1.20083c0e456cbp-55}, | |
| 282 | {0x1.08ffff9f2cbe8p+0, -0x1.dffdfbe37751ap-57}, | |
| 283 | {0x1.0b000010cda65p+0, -0x1.13f7faee626ebp-54}, | |
| 284 | {0x1.0d00001a4d338p+0, 0x1.07dfa79489ff7p-55}, | |
| 285 | {0x1.0effffadafdfdp+0, -0x1.7040570d66bcp-56}, | |
| 286 | {0x1.110000bbafd96p+0, 0x1.e80d4846d0b62p-55}, | |
| 287 | {0x1.12ffffae5f45dp+0, 0x1.dbffa64fd36efp-54}, | |
| 288 | {0x1.150000dd59ad9p+0, 0x1.a0077701250aep-54}, | |
| 289 | {0x1.170000f21559ap+0, 0x1.dfdf9e2e3deeep-55}, | |
| 290 | {0x1.18ffffc275426p+0, 0x1.10030dc3b7273p-54}, | |
| 291 | {0x1.1b000123d3c59p+0, 0x1.97f7980030188p-54}, | |
| 292 | {0x1.1cffff8299eb7p+0, -0x1.5f932ab9f8c67p-57}, | |
| 293 | {0x1.1effff48ad4p+0, 0x1.37fbf9da75bebp-54}, | |
| 294 | {0x1.210000c8b86a4p+0, 0x1.f806b91fd5b22p-54}, | |
| 295 | {0x1.2300003854303p+0, 0x1.3ffc2eb9fbf33p-54}, | |
| 296 | {0x1.24fffffbcf684p+0, 0x1.601e77e2e2e72p-56}, | |
| 297 | {0x1.26ffff52921d9p+0, 0x1.ffcbb767f0c61p-56}, | |
| 298 | {0x1.2900014933a3cp+0, -0x1.202ca3c02412bp-56}, | |
| 299 | {0x1.2b00014556313p+0, -0x1.2808233f21f02p-54}, | |
| 300 | {0x1.2cfffebfe523bp+0, -0x1.8ff7e384fdcf2p-55}, | |
| 301 | {0x1.2f0000bb8ad96p+0, -0x1.5ff51503041c5p-55}, | |
| 302 | {0x1.30ffffb7ae2afp+0, -0x1.10071885e289dp-55}, | |
| 303 | {0x1.32ffffeac5f7fp+0, -0x1.1ff5d3fb7b715p-54}, | |
| 304 | {0x1.350000ca66756p+0, 0x1.57f82228b82bdp-54}, | |
| 305 | {0x1.3700011fbf721p+0, 0x1.000bac40dd5ccp-55}, | |
| 306 | {0x1.38ffff9592fb9p+0, -0x1.43f9d2db2a751p-54}, | |
| 307 | {0x1.3b00004ddd242p+0, 0x1.57f6b707638e1p-55}, | |
| 308 | {0x1.3cffff5b2c957p+0, 0x1.a023a10bf1231p-56}, | |
| 309 | {0x1.3efffeab0b418p+0, 0x1.87f6d66b152bp-54}, | |
| 310 | {0x1.410001532aff4p+0, 0x1.7f8375f198524p-57}, | |
| 311 | {0x1.4300017478b29p+0, 0x1.301e672dc5143p-55}, | |
| 312 | {0x1.44fffe795b463p+0, 0x1.9ff69b8b2895ap-55}, | |
| 313 | {0x1.46fffe80475ep+0, -0x1.5c0b19bc2f254p-54}, | |
| 314 | {0x1.48fffef6fc1e7p+0, 0x1.b4009f23a2a72p-54}, | |
| 315 | {0x1.4afffe5bea704p+0, -0x1.4ffb7bf0d7d45p-54}, | |
| 316 | {0x1.4d000171027dep+0, -0x1.9c06471dc6a3dp-54}, | |
| 317 | {0x1.4f0000ff03ee2p+0, 0x1.77f890b85531cp-54}, | |
| 318 | {0x1.5100012dc4bd1p+0, 0x1.004657166a436p-57}, | |
| 319 | {0x1.530001605277ap+0, -0x1.6bfcece233209p-54}, | |
| 320 | {0x1.54fffecdb704cp+0, -0x1.902720505a1d7p-55}, | |
| 321 | {0x1.56fffef5f54a9p+0, 0x1.bbfe60ec96412p-54}, | |
| 322 | {0x1.5900017e61012p+0, 0x1.87ec581afef9p-55}, | |
| 323 | {0x1.5b00003c93e92p+0, -0x1.f41080abf0ccp-54}, | |
| 324 | {0x1.5d0001d4919bcp+0, -0x1.8812afb254729p-54}, | |
| 325 | {0x1.5efffe7b87a89p+0, -0x1.47eb780ed6904p-54}, | |
| 326 | }, | |
| 327 | #endif | |
| 328 | }; |
lib/libc/musl/src/math/log_data.h deleted-28| ... | ... | @@ -1,28 +0,0 @@ |
| 1 | /* | |
| 2 | * Copyright (c) 2018, Arm Limited. | |
| 3 | * SPDX-License-Identifier: MIT | |
| 4 | */ | |
| 5 | #ifndef _LOG_DATA_H | |
| 6 | #define _LOG_DATA_H | |
| 7 | ||
| 8 | #include <features.h> | |
| 9 | ||
| 10 | #define LOG_TABLE_BITS 7 | |
| 11 | #define LOG_POLY_ORDER 6 | |
| 12 | #define LOG_POLY1_ORDER 12 | |
| 13 | extern hidden const struct log_data { | |
| 14 | 	double ln2hi; | |
| 15 | 	double ln2lo; | |
| 16 | 	double poly[LOG_POLY_ORDER - 1]; /* First coefficient is 1. */ | |
| 17 | 	double poly1[LOG_POLY1_ORDER - 1]; | |
| 18 | 	struct { | |
| 19 | 		double invc, logc; | |
| 20 | 	} tab[1 << LOG_TABLE_BITS]; | |
| 21 | #if !__FP_FAST_FMA | |
| 22 | 	struct { | |
| 23 | 		double chi, clo; | |
| 24 | 	} tab2[1 << LOG_TABLE_BITS]; | |
| 25 | #endif | |
| 26 | } __log_data; | |
| 27 | ||
| 28 | #endif |
lib/libc/musl/src/math/logf_data.c deleted-33| ... | ... | @@ -1,33 +0,0 @@ |
| 1 | /* | |
| 2 | * Data definition for logf. | |
| 3 | * | |
| 4 | * Copyright (c) 2017-2018, Arm Limited. | |
| 5 | * SPDX-License-Identifier: MIT | |
| 6 | */ | |
| 7 | ||
| 8 | #include "logf_data.h" | |
| 9 | ||
| 10 | const struct logf_data __logf_data = { | |
| 11 | .tab = { | |
| 12 | { 0x1.661ec79f8f3bep+0, -0x1.57bf7808caadep-2 }, | |
| 13 | { 0x1.571ed4aaf883dp+0, -0x1.2bef0a7c06ddbp-2 }, | |
| 14 | { 0x1.49539f0f010bp+0, -0x1.01eae7f513a67p-2 }, | |
| 15 | { 0x1.3c995b0b80385p+0, -0x1.b31d8a68224e9p-3 }, | |
| 16 | { 0x1.30d190c8864a5p+0, -0x1.6574f0ac07758p-3 }, | |
| 17 | { 0x1.25e227b0b8eap+0, -0x1.1aa2bc79c81p-3 }, | |
| 18 | { 0x1.1bb4a4a1a343fp+0, -0x1.a4e76ce8c0e5ep-4 }, | |
| 19 | { 0x1.12358f08ae5bap+0, -0x1.1973c5a611cccp-4 }, | |
| 20 | { 0x1.0953f419900a7p+0, -0x1.252f438e10c1ep-5 }, | |
| 21 | { 0x1p+0, 0x0p+0 }, | |
| 22 | { 0x1.e608cfd9a47acp-1, 0x1.aa5aa5df25984p-5 }, | |
| 23 | { 0x1.ca4b31f026aap-1, 0x1.c5e53aa362eb4p-4 }, | |
| 24 | { 0x1.b2036576afce6p-1, 0x1.526e57720db08p-3 }, | |
| 25 | { 0x1.9c2d163a1aa2dp-1, 0x1.bc2860d22477p-3 }, | |
| 26 | { 0x1.886e6037841edp-1, 0x1.1058bc8a07ee1p-2 }, | |
| 27 | { 0x1.767dcf5534862p-1, 0x1.4043057b6ee09p-2 }, | |
| 28 | }, | |
| 29 | .ln2 = 0x1.62e42fefa39efp-1, | |
| 30 | .poly = { | |
| 31 | -0x1.00ea348b88334p-2, 0x1.5575b0be00b6ap-2, -0x1.ffffef20a4123p-2, | |
| 32 | } | |
| 33 | }; |
lib/libc/musl/src/math/logf_data.h deleted-20| ... | ... | @@ -1,20 +0,0 @@ |
| 1 | /* | |
| 2 | * Copyright (c) 2017-2018, Arm Limited. | |
| 3 | * SPDX-License-Identifier: MIT | |
| 4 | */ | |
| 5 | #ifndef _LOGF_DATA_H | |
| 6 | #define _LOGF_DATA_H | |
| 7 | ||
| 8 | #include <features.h> | |
| 9 | ||
| 10 | #define LOGF_TABLE_BITS 4 | |
| 11 | #define LOGF_POLY_ORDER 4 | |
| 12 | extern hidden const struct logf_data { | |
| 13 | 	struct { | |
| 14 | 		double invc, logc; | |
| 15 | 	} tab[1 << LOGF_TABLE_BITS]; | |
| 16 | 	double ln2; | |
| 17 | 	double poly[LOGF_POLY_ORDER - 1]; /* First order coefficient is 1. */ | |
| 18 | } __logf_data; | |
| 19 | ||
| 20 | #endif |
lib/libc/musl/src/math/m68k/sqrtl.c deleted-15| ... | ... | @@ -1,15 +0,0 @@ |
| 1 | #include <math.h> | |
| 2 | ||
| 3 | #if __HAVE_68881__ | |
| 4 | ||
| 5 | long double sqrtl(long double x) | |
| 6 | { | |
| 7 | 	__asm__ ("fsqrt.x %1,%0" : "=f"(x) : "fm"(x)); | |
| 8 | 	return x; | |
| 9 | } | |
| 10 | ||
| 11 | #else | |
| 12 | ||
| 13 | #include "../sqrtl.c" | |
| 14 | ||
| 15 | #endif |
lib/libc/musl/src/math/mips/sqrt.c deleted-16| ... | ... | @@ -1,16 +0,0 @@ |
| 1 | #if !defined(__mips_soft_float) && __mips >= 3 | |
| 2 | ||
| 3 | #include <math.h> | |
| 4 | ||
| 5 | double sqrt(double x) | |
| 6 | { | |
| 7 | 	double r; | |
| 8 | 	__asm__("sqrt.d %0,%1" : "=f"(r) : "f"(x)); | |
| 9 | 	return r; | |
| 10 | } | |
| 11 | ||
| 12 | #else | |
| 13 | ||
| 14 | #include "../sqrt.c" | |
| 15 | ||
| 16 | #endif |
lib/libc/musl/src/math/mips/sqrtf.c deleted-16| ... | ... | @@ -1,16 +0,0 @@ |
| 1 | #if !defined(__mips_soft_float) && __mips >= 2 | |
| 2 | ||
| 3 | #include <math.h> | |
| 4 | ||
| 5 | float sqrtf(float x) | |
| 6 | { | |
| 7 | 	float r; | |
| 8 | 	__asm__("sqrt.s %0,%1" : "=f"(r) : "f"(x)); | |
| 9 | 	return r; | |
| 10 | } | |
| 11 | ||
| 12 | #else | |
| 13 | ||
| 14 | #include "../sqrtf.c" | |
| 15 | ||
| 16 | #endif |
lib/libc/musl/src/math/powerpc/sqrt.c deleted-15| ... | ... | @@ -1,15 +0,0 @@ |
| 1 | #include <math.h> | |
| 2 | ||
| 3 | #if !defined _SOFT_FLOAT && defined _ARCH_PPCSQ | |
| 4 | ||
| 5 | double sqrt(double x) | |
| 6 | { | |
| 7 | 	__asm__ ("fsqrt %0, %1\n" : "=d" (x) : "d" (x)); | |
| 8 | 	return x; | |
| 9 | } | |
| 10 | ||
| 11 | #else | |
| 12 | ||
| 13 | #include "../sqrt.c" | |
| 14 | ||
| 15 | #endif |
lib/libc/musl/src/math/powerpc/sqrtf.c deleted-15| ... | ... | @@ -1,15 +0,0 @@ |
| 1 | #include <math.h> | |
| 2 | ||
| 3 | #if !defined _SOFT_FLOAT && defined _ARCH_PPCSQ | |
| 4 | ||
| 5 | float sqrtf(float x) | |
| 6 | { | |
| 7 | 	__asm__ ("fsqrts %0, %1\n" : "=f" (x) : "f" (x)); | |
| 8 | 	return x; | |
| 9 | } | |
| 10 | ||
| 11 | #else | |
| 12 | ||
| 13 | #include "../sqrtf.c" | |
| 14 | ||
| 15 | #endif |
lib/libc/musl/src/math/powerpc64/fmax.c deleted-15| ... | ... | @@ -1,15 +0,0 @@ |
| 1 | #include <math.h> | |
| 2 | ||
| 3 | #ifdef __VSX__ | |
| 4 | ||
| 5 | double fmax(double x, double y) | |
| 6 | { | |
| 7 | 	__asm__ ("xsmaxdp %x0, %x1, %x2" : "=ws"(x) : "ws"(x), "ws"(y)); | |
| 8 | 	return x; | |
| 9 | } | |
| 10 | ||
| 11 | #else | |
| 12 | ||
| 13 | #include "../fmax.c" | |
| 14 | ||
| 15 | #endif |
lib/libc/musl/src/math/powerpc64/fmaxf.c deleted-15| ... | ... | @@ -1,15 +0,0 @@ |
| 1 | #include <math.h> | |
| 2 | ||
| 3 | #ifdef __VSX__ | |
| 4 | ||
| 5 | float fmaxf(float x, float y) | |
| 6 | { | |
| 7 | 	__asm__ ("xsmaxdp %x0, %x1, %x2" : "=ww"(x) : "ww"(x), "ww"(y)); | |
| 8 | 	return x; | |
| 9 | } | |
| 10 | ||
| 11 | #else | |
| 12 | ||
| 13 | #include "../fmaxf.c" | |
| 14 | ||
| 15 | #endif |
lib/libc/musl/src/math/powerpc64/fmin.c deleted-15| ... | ... | @@ -1,15 +0,0 @@ |
| 1 | #include <math.h> | |
| 2 | ||
| 3 | #ifdef __VSX__ | |
| 4 | ||
| 5 | double fmin(double x, double y) | |
| 6 | { | |
| 7 | 	__asm__ ("xsmindp %x0, %x1, %x2" : "=ws"(x) : "ws"(x), "ws"(y)); | |
| 8 | 	return x; | |
| 9 | } | |
| 10 | ||
| 11 | #else | |
| 12 | ||
| 13 | #include "../fmin.c" | |
| 14 | ||
| 15 | #endif |
lib/libc/musl/src/math/powerpc64/fminf.c deleted-15| ... | ... | @@ -1,15 +0,0 @@ |
| 1 | #include <math.h> | |
| 2 | ||
| 3 | #ifdef __VSX__ | |
| 4 | ||
| 5 | float fminf(float x, float y) | |
| 6 | { | |
| 7 | 	__asm__ ("xsmindp %x0, %x1, %x2" : "=ww"(x) : "ww"(x), "ww"(y)); | |
| 8 | 	return x; | |
| 9 | } | |
| 10 | ||
| 11 | #else | |
| 12 | ||
| 13 | #include "../fminf.c" | |
| 14 | ||
| 15 | #endif |
lib/libc/musl/src/math/powerpc64/sqrt.c deleted-7| ... | ... | @@ -1,7 +0,0 @@ |
| 1 | #include <math.h> | |
| 2 | ||
| 3 | double sqrt(double x) | |
| 4 | { | |
| 5 | 	__asm__ ("fsqrt %0, %1" : "=d"(x) : "d"(x)); | |
| 6 | 	return x; | |
| 7 | } |
lib/libc/musl/src/math/powerpc64/sqrtf.c deleted-7| ... | ... | @@ -1,7 +0,0 @@ |
| 1 | #include <math.h> | |
| 2 | ||
| 3 | float sqrtf(float x) | |
| 4 | { | |
| 5 | 	__asm__ ("fsqrts %0, %1" : "=f"(x) : "f"(x)); | |
| 6 | 	return x; | |
| 7 | } |
lib/libc/musl/src/math/riscv32/copysign.c deleted-15| ... | ... | @@ -1,15 +0,0 @@ |
| 1 | #include <math.h> | |
| 2 | ||
| 3 | #if __riscv_flen >= 64 | |
| 4 | ||
| 5 | double copysign(double x, double y) | |
| 6 | { | |
| 7 | 	__asm__ ("fsgnj.d %0, %1, %2" : "=f"(x) : "f"(x), "f"(y)); | |
| 8 | 	return x; | |
| 9 | } | |
| 10 | ||
| 11 | #else | |
| 12 | ||
| 13 | #include "../copysign.c" | |
| 14 | ||
| 15 | #endif |
lib/libc/musl/src/math/riscv32/copysignf.c deleted-15| ... | ... | @@ -1,15 +0,0 @@ |
| 1 | #include <math.h> | |
| 2 | ||
| 3 | #if __riscv_flen >= 32 | |
| 4 | ||
| 5 | float copysignf(float x, float y) | |
| 6 | { | |
| 7 | 	__asm__ ("fsgnj.s %0, %1, %2" : "=f"(x) : "f"(x), "f"(y)); | |
| 8 | 	return x; | |
| 9 | } | |
| 10 | ||
| 11 | #else | |
| 12 | ||
| 13 | #include "../copysignf.c" | |
| 14 | ||
| 15 | #endif |
lib/libc/musl/src/math/riscv32/fmax.c deleted-15| ... | ... | @@ -1,15 +0,0 @@ |
| 1 | #include <math.h> | |
| 2 | ||
| 3 | #if __riscv_flen >= 64 | |
| 4 | ||
| 5 | double fmax(double x, double y) | |
| 6 | { | |
| 7 | 	__asm__ ("fmax.d %0, %1, %2" : "=f"(x) : "f"(x), "f"(y)); | |
| 8 | 	return x; | |
| 9 | } | |
| 10 | ||
| 11 | #else | |
| 12 | ||
| 13 | #include "../fmax.c" | |
| 14 | ||
| 15 | #endif |
lib/libc/musl/src/math/riscv32/fmaxf.c deleted-15| ... | ... | @@ -1,15 +0,0 @@ |
| 1 | #include <math.h> | |
| 2 | ||
| 3 | #if __riscv_flen >= 32 | |
| 4 | ||
| 5 | float fmaxf(float x, float y) | |
| 6 | { | |
| 7 | 	__asm__ ("fmax.s %0, %1, %2" : "=f"(x) : "f"(x), "f"(y)); | |
| 8 | 	return x; | |
| 9 | } | |
| 10 | ||
| 11 | #else | |
| 12 | ||
| 13 | #include "../fmaxf.c" | |
| 14 | ||
| 15 | #endif |
lib/libc/musl/src/math/riscv32/fmin.c deleted-15| ... | ... | @@ -1,15 +0,0 @@ |
| 1 | #include <math.h> | |
| 2 | ||
| 3 | #if __riscv_flen >= 64 | |
| 4 | ||
| 5 | double fmin(double x, double y) | |
| 6 | { | |
| 7 | 	__asm__ ("fmin.d %0, %1, %2" : "=f"(x) : "f"(x), "f"(y)); | |
| 8 | 	return x; | |
| 9 | } | |
| 10 | ||
| 11 | #else | |
| 12 | ||
| 13 | #include "../fmin.c" | |
| 14 | ||
| 15 | #endif |
lib/libc/musl/src/math/riscv32/fminf.c deleted-15| ... | ... | @@ -1,15 +0,0 @@ |
| 1 | #include <math.h> | |
| 2 | ||
| 3 | #if __riscv_flen >= 32 | |
| 4 | ||
| 5 | float fminf(float x, float y) | |
| 6 | { | |
| 7 | 	__asm__ ("fmin.s %0, %1, %2" : "=f"(x) : "f"(x), "f"(y)); | |
| 8 | 	return x; | |
| 9 | } | |
| 10 | ||
| 11 | #else | |
| 12 | ||
| 13 | #include "../fminf.c" | |
| 14 | ||
| 15 | #endif |
lib/libc/musl/src/math/riscv32/sqrt.c deleted-15| ... | ... | @@ -1,15 +0,0 @@ |
| 1 | #include <math.h> | |
| 2 | ||
| 3 | #if __riscv_flen >= 64 | |
| 4 | ||
| 5 | double sqrt(double x) | |
| 6 | { | |
| 7 | 	__asm__ ("fsqrt.d %0, %1" : "=f"(x) : "f"(x)); | |
| 8 | 	return x; | |
| 9 | } | |
| 10 | ||
| 11 | #else | |
| 12 | ||
| 13 | #include "../sqrt.c" | |
| 14 | ||
| 15 | #endif |
lib/libc/musl/src/math/riscv32/sqrtf.c deleted-15| ... | ... | @@ -1,15 +0,0 @@ |
| 1 | #include <math.h> | |
| 2 | ||
| 3 | #if __riscv_flen >= 32 | |
| 4 | ||
| 5 | float sqrtf(float x) | |
| 6 | { | |
| 7 | 	__asm__ ("fsqrt.s %0, %1" : "=f"(x) : "f"(x)); | |
| 8 | 	return x; | |
| 9 | } | |
| 10 | ||
| 11 | #else | |
| 12 | ||
| 13 | #include "../sqrtf.c" | |
| 14 | ||
| 15 | #endif |
lib/libc/musl/src/math/riscv64/copysign.c deleted-15| ... | ... | @@ -1,15 +0,0 @@ |
| 1 | #include <math.h> | |
| 2 | ||
| 3 | #if __riscv_flen >= 64 | |
| 4 | ||
| 5 | double copysign(double x, double y) | |
| 6 | { | |
| 7 | 	__asm__ ("fsgnj.d %0, %1, %2" : "=f"(x) : "f"(x), "f"(y)); | |
| 8 | 	return x; | |
| 9 | } | |
| 10 | ||
| 11 | #else | |
| 12 | ||
| 13 | #include "../copysign.c" | |
| 14 | ||
| 15 | #endif |
lib/libc/musl/src/math/riscv64/copysignf.c deleted-15| ... | ... | @@ -1,15 +0,0 @@ |
| 1 | #include <math.h> | |
| 2 | ||
| 3 | #if __riscv_flen >= 32 | |
| 4 | ||
| 5 | float copysignf(float x, float y) | |
| 6 | { | |
| 7 | 	__asm__ ("fsgnj.s %0, %1, %2" : "=f"(x) : "f"(x), "f"(y)); | |
| 8 | 	return x; | |
| 9 | } | |
| 10 | ||
| 11 | #else | |
| 12 | ||
| 13 | #include "../copysignf.c" | |
| 14 | ||
| 15 | #endif |
lib/libc/musl/src/math/riscv64/fmax.c deleted-15| ... | ... | @@ -1,15 +0,0 @@ |
| 1 | #include <math.h> | |
| 2 | ||
| 3 | #if __riscv_flen >= 64 | |
| 4 | ||
| 5 | double fmax(double x, double y) | |
| 6 | { | |
| 7 | 	__asm__ ("fmax.d %0, %1, %2" : "=f"(x) : "f"(x), "f"(y)); | |
| 8 | 	return x; | |
| 9 | } | |
| 10 | ||
| 11 | #else | |
| 12 | ||
| 13 | #include "../fmax.c" | |
| 14 | ||
| 15 | #endif |
lib/libc/musl/src/math/riscv64/fmaxf.c deleted-15| ... | ... | @@ -1,15 +0,0 @@ |
| 1 | #include <math.h> | |
| 2 | ||
| 3 | #if __riscv_flen >= 32 | |
| 4 | ||
| 5 | float fmaxf(float x, float y) | |
| 6 | { | |
| 7 | 	__asm__ ("fmax.s %0, %1, %2" : "=f"(x) : "f"(x), "f"(y)); | |
| 8 | 	return x; | |
| 9 | } | |
| 10 | ||
| 11 | #else | |
| 12 | ||
| 13 | #include "../fmaxf.c" | |
| 14 | ||
| 15 | #endif |
lib/libc/musl/src/math/riscv64/fmin.c deleted-15| ... | ... | @@ -1,15 +0,0 @@ |
| 1 | #include <math.h> | |
| 2 | ||
| 3 | #if __riscv_flen >= 64 | |
| 4 | ||
| 5 | double fmin(double x, double y) | |
| 6 | { | |
| 7 | 	__asm__ ("fmin.d %0, %1, %2" : "=f"(x) : "f"(x), "f"(y)); | |
| 8 | 	return x; | |
| 9 | } | |
| 10 | ||
| 11 | #else | |
| 12 | ||
| 13 | #include "../fmin.c" | |
| 14 | ||
| 15 | #endif |
lib/libc/musl/src/math/riscv64/fminf.c deleted-15| ... | ... | @@ -1,15 +0,0 @@ |
| 1 | #include <math.h> | |
| 2 | ||
| 3 | #if __riscv_flen >= 32 | |
| 4 | ||
| 5 | float fminf(float x, float y) | |
| 6 | { | |
| 7 | 	__asm__ ("fmin.s %0, %1, %2" : "=f"(x) : "f"(x), "f"(y)); | |
| 8 | 	return x; | |
| 9 | } | |
| 10 | ||
| 11 | #else | |
| 12 | ||
| 13 | #include "../fminf.c" | |
| 14 | ||
| 15 | #endif |
lib/libc/musl/src/math/riscv64/sqrt.c deleted-15| ... | ... | @@ -1,15 +0,0 @@ |
| 1 | #include <math.h> | |
| 2 | ||
| 3 | #if __riscv_flen >= 64 | |
| 4 | ||
| 5 | double sqrt(double x) | |
| 6 | { | |
| 7 | 	__asm__ ("fsqrt.d %0, %1" : "=f"(x) : "f"(x)); | |
| 8 | 	return x; | |
| 9 | } | |
| 10 | ||
| 11 | #else | |
| 12 | ||
| 13 | #include "../sqrt.c" | |
| 14 | ||
| 15 | #endif |
lib/libc/musl/src/math/riscv64/sqrtf.c deleted-15| ... | ... | @@ -1,15 +0,0 @@ |
| 1 | #include <math.h> | |
| 2 | ||
| 3 | #if __riscv_flen >= 32 | |
| 4 | ||
| 5 | float sqrtf(float x) | |
| 6 | { | |
| 7 | 	__asm__ ("fsqrt.s %0, %1" : "=f"(x) : "f"(x)); | |
| 8 | 	return x; | |
| 9 | } | |
| 10 | ||
| 11 | #else | |
| 12 | ||
| 13 | #include "../sqrtf.c" | |
| 14 | ||
| 15 | #endif |
lib/libc/musl/src/math/s390x/sqrt.c deleted-15| ... | ... | @@ -1,15 +0,0 @@ |
| 1 | #include <math.h> | |
| 2 | ||
| 3 | #if defined(__HTM__) || __ARCH__ >= 9 | |
| 4 | ||
| 5 | double sqrt(double x) | |
| 6 | { | |
| 7 | 	__asm__ ("sqdbr %0, %1" : "=f"(x) : "f"(x)); | |
| 8 | 	return x; | |
| 9 | } | |
| 10 | ||
| 11 | #else | |
| 12 | ||
| 13 | #include "../sqrt.c" | |
| 14 | ||
| 15 | #endif |
lib/libc/musl/src/math/s390x/sqrtf.c deleted-15| ... | ... | @@ -1,15 +0,0 @@ |
| 1 | #include <math.h> | |
| 2 | ||
| 3 | #if defined(__HTM__) || __ARCH__ >= 9 | |
| 4 | ||
| 5 | float sqrtf(float x) | |
| 6 | { | |
| 7 | 	__asm__ ("sqebr %0, %1" : "=f"(x) : "f"(x)); | |
| 8 | 	return x; | |
| 9 | } | |
| 10 | ||
| 11 | #else | |
| 12 | ||
| 13 | #include "../sqrtf.c" | |
| 14 | ||
| 15 | #endif |
lib/libc/musl/src/math/s390x/sqrtl.c deleted-15| ... | ... | @@ -1,15 +0,0 @@ |
| 1 | #include <math.h> | |
| 2 | ||
| 3 | #if defined(__HTM__) || __ARCH__ >= 9 | |
| 4 | ||
| 5 | long double sqrtl(long double x) | |
| 6 | { | |
| 7 | 	__asm__ ("sqxbr %0, %1" : "=f"(x) : "f"(x)); | |
| 8 | 	return x; | |
| 9 | } | |
| 10 | ||
| 11 | #else | |
| 12 | ||
| 13 | #include "../sqrtl.c" | |
| 14 | ||
| 15 | #endif |
lib/libc/musl/src/math/sqrt.c deleted-158| ... | ... | @@ -1,158 +0,0 @@ |
| 1 | #include <stdint.h> | |
| 2 | #include <math.h> | |
| 3 | #include "libm.h" | |
| 4 | #include "sqrt_data.h" | |
| 5 | ||
| 6 | #define FENV_SUPPORT 1 | |
| 7 | ||
| 8 | /* returns a*b*2^-32 - e, with error 0 <= e < 1. */ | |
| 9 | static inline uint32_t mul32(uint32_t a, uint32_t b) | |
| 10 | { | |
| 11 | 	return (uint64_t)a*b >> 32; | |
| 12 | } | |
| 13 | ||
| 14 | /* returns a*b*2^-64 - e, with error 0 <= e < 3. */ | |
| 15 | static inline uint64_t mul64(uint64_t a, uint64_t b) | |
| 16 | { | |
| 17 | 	uint64_t ahi = a>>32; | |
| 18 | 	uint64_t alo = a&0xffffffff; | |
| 19 | 	uint64_t bhi = b>>32; | |
| 20 | 	uint64_t blo = b&0xffffffff; | |
| 21 | 	return ahi*bhi + (ahi*blo >> 32) + (alo*bhi >> 32); | |
| 22 | } | |
| 23 | ||
| 24 | double sqrt(double x) | |
| 25 | { | |
| 26 | 	uint64_t ix, top, m; | |
| 27 | ||
| 28 | 	/* special case handling. */ | |
| 29 | 	ix = asuint64(x); | |
| 30 | 	top = ix >> 52; | |
| 31 | 	if (predict_false(top - 0x001 >= 0x7ff - 0x001)) { | |
| 32 | 		/* x < 0x1p-1022 or inf or nan. */ | |
| 33 | 		if (ix * 2 == 0) | |
| 34 | 			return x; | |
| 35 | 		if (ix == 0x7ff0000000000000) | |
| 36 | 			return x; | |
| 37 | 		if (ix > 0x7ff0000000000000) | |
| 38 | 			return __math_invalid(x); | |
| 39 | 		/* x is subnormal, normalize it. */ | |
| 40 | 		ix = asuint64(x * 0x1p52); | |
| 41 | 		top = ix >> 52; | |
| 42 | 		top -= 52; | |
| 43 | 	} | |
| 44 | ||
| 45 | 	/* argument reduction: | |
| 46 | 	 x = 4^e m; with integer e, and m in [1, 4) | |
| 47 | 	 m: fixed point representation [2.62] | |
| 48 | 	 2^e is the exponent part of the result. */ | |
| 49 | 	int even = top & 1; | |
| 50 | 	m = (ix << 11) | 0x8000000000000000; | |
| 51 | 	if (even) m >>= 1; | |
| 52 | 	top = (top + 0x3ff) >> 1; | |
| 53 | ||
| 54 | 	/* approximate r ~ 1/sqrt(m) and s ~ sqrt(m) when m in [1,4) | |
| 55 | ||
| 56 | 	 initial estimate: | |
| 57 | 	 7bit table lookup (1bit exponent and 6bit significand). | |
| 58 | ||
| 59 | 	 iterative approximation: | |
| 60 | 	 using 2 goldschmidt iterations with 32bit int arithmetics | |
| 61 | 	 and a final iteration with 64bit int arithmetics. | |
| 62 | ||
| 63 | 	 details: | |
| 64 | ||
| 65 | 	 the relative error (e = r0 sqrt(m)-1) of a linear estimate | |
| 66 | 	 (r0 = a m + b) is |e| < 0.085955 ~ 0x1.6p-4 at best, | |
| 67 | 	 a table lookup is faster and needs one less iteration | |
| 68 | 	 6 bit lookup table (128b) gives |e| < 0x1.f9p-8 | |
| 69 | 	 7 bit lookup table (256b) gives |e| < 0x1.fdp-9 | |
| 70 | 	 for single and double prec 6bit is enough but for quad | |
| 71 | 	 prec 7bit is needed (or modified iterations). to avoid | |
| 72 | 	 one more iteration >=13bit table would be needed (16k). | |
| 73 | ||
| 74 | 	 a newton-raphson iteration for r is | |
| 75 | 	 w = r*r | |
| 76 | 	 u = 3 - m*w | |
| 77 | 	 r = r*u/2 | |
| 78 | 	 can use a goldschmidt iteration for s at the end or | |
| 79 | 	 s = m*r | |
| 80 | ||
| 81 | 	 first goldschmidt iteration is | |
| 82 | 	 s = m*r | |
| 83 | 	 u = 3 - s*r | |
| 84 | 	 r = r*u/2 | |
| 85 | 	 s = s*u/2 | |
| 86 | 	 next goldschmidt iteration is | |
| 87 | 	 u = 3 - s*r | |
| 88 | 	 r = r*u/2 | |
| 89 | 	 s = s*u/2 | |
| 90 | 	 and at the end r is not computed only s. | |
| 91 | ||
| 92 | 	 they use the same amount of operations and converge at the | |
| 93 | 	 same quadratic rate, i.e. if | |
| 94 | 	 r1 sqrt(m) - 1 = e, then | |
| 95 | 	 r2 sqrt(m) - 1 = -3/2 e^2 - 1/2 e^3 | |
| 96 | 	 the advantage of goldschmidt is that the mul for s and r | |
| 97 | 	 are independent (computed in parallel), however it is not | |
| 98 | 	 "self synchronizing": it only uses the input m in the | |
| 99 | 	 first iteration so rounding errors accumulate. at the end | |
| 100 | 	 or when switching to larger precision arithmetics rounding | |
| 101 | 	 errors dominate so the first iteration should be used. | |
| 102 | ||
| 103 | 	 the fixed point representations are | |
| 104 | 	 m: 2.30 r: 0.32, s: 2.30, d: 2.30, u: 2.30, three: 2.30 | |
| 105 | 	 and after switching to 64 bit | |
| 106 | 	 m: 2.62 r: 0.64, s: 2.62, d: 2.62, u: 2.62, three: 2.62 */ | |
| 107 | ||
| 108 | 	static const uint64_t three = 0xc0000000; | |
| 109 | 	uint64_t r, s, d, u, i; | |
| 110 | ||
| 111 | 	i = (ix >> 46) % 128; | |
| 112 | 	r = (uint32_t)__rsqrt_tab[i] << 16; | |
| 113 | 	/* |r sqrt(m) - 1| < 0x1.fdp-9 */ | |
| 114 | 	s = mul32(m>>32, r); | |
| 115 | 	/* |s/sqrt(m) - 1| < 0x1.fdp-9 */ | |
| 116 | 	d = mul32(s, r); | |
| 117 | 	u = three - d; | |
| 118 | 	r = mul32(r, u) << 1; | |
| 119 | 	/* |r sqrt(m) - 1| < 0x1.7bp-16 */ | |
| 120 | 	s = mul32(s, u) << 1; | |
| 121 | 	/* |s/sqrt(m) - 1| < 0x1.7bp-16 */ | |
| 122 | 	d = mul32(s, r); | |
| 123 | 	u = three - d; | |
| 124 | 	r = mul32(r, u) << 1; | |
| 125 | 	/* |r sqrt(m) - 1| < 0x1.3704p-29 (measured worst-case) */ | |
| 126 | 	r = r << 32; | |
| 127 | 	s = mul64(m, r); | |
| 128 | 	d = mul64(s, r); | |
| 129 | 	u = (three<<32) - d; | |
| 130 | 	s = mul64(s, u); /* repr: 3.61 */ | |
| 131 | 	/* -0x1p-57 < s - sqrt(m) < 0x1.8001p-61 */ | |
| 132 | 	s = (s - 2) >> 9; /* repr: 12.52 */ | |
| 133 | 	/* -0x1.09p-52 < s - sqrt(m) < -0x1.fffcp-63 */ | |
| 134 | ||
| 135 | 	/* s < sqrt(m) < s + 0x1.09p-52, | |
| 136 | 	 compute nearest rounded result: | |
| 137 | 	 the nearest result to 52 bits is either s or s+0x1p-52, | |
| 138 | 	 we can decide by comparing (2^52 s + 0.5)^2 to 2^104 m. */ | |
| 139 | 	uint64_t d0, d1, d2; | |
| 140 | 	double y, t; | |
| 141 | 	d0 = (m << 42) - s*s; | |
| 142 | 	d1 = s - d0; | |
| 143 | 	d2 = d1 + s + 1; | |
| 144 | 	s += d1 >> 63; | |
| 145 | 	s &= 0x000fffffffffffff; | |
| 146 | 	s |= top << 52; | |
| 147 | 	y = asdouble(s); | |
| 148 | 	if (FENV_SUPPORT) { | |
| 149 | 		/* handle rounding modes and inexact exception: | |
| 150 | 		 only (s+1)^2 == 2^42 m case is exact otherwise | |
| 151 | 		 add a tiny value to cause the fenv effects. */ | |
| 152 | 		uint64_t tiny = predict_false(d2==0) ? 0 : 0x0010000000000000; | |
| 153 | 		tiny |= (d1^d2) & 0x8000000000000000; | |
| 154 | 		t = asdouble(tiny); | |
| 155 | 		y = eval_as_double(y + t); | |
| 156 | 	} | |
| 157 | 	return y; | |
| 158 | } |
lib/libc/musl/src/math/sqrt_data.c deleted-19| ... | ... | @@ -1,19 +0,0 @@ |
| 1 | #include "sqrt_data.h" | |
| 2 | const uint16_t __rsqrt_tab[128] = { | |
| 3 | 0xb451,0xb2f0,0xb196,0xb044,0xaef9,0xadb6,0xac79,0xab43, | |
| 4 | 0xaa14,0xa8eb,0xa7c8,0xa6aa,0xa592,0xa480,0xa373,0xa26b, | |
| 5 | 0xa168,0xa06a,0x9f70,0x9e7b,0x9d8a,0x9c9d,0x9bb5,0x9ad1, | |
| 6 | 0x99f0,0x9913,0x983a,0x9765,0x9693,0x95c4,0x94f8,0x9430, | |
| 7 | 0x936b,0x92a9,0x91ea,0x912e,0x9075,0x8fbe,0x8f0a,0x8e59, | |
| 8 | 0x8daa,0x8cfe,0x8c54,0x8bac,0x8b07,0x8a64,0x89c4,0x8925, | |
| 9 | 0x8889,0x87ee,0x8756,0x86c0,0x862b,0x8599,0x8508,0x8479, | |
| 10 | 0x83ec,0x8361,0x82d8,0x8250,0x81c9,0x8145,0x80c2,0x8040, | |
| 11 | 0xff02,0xfd0e,0xfb25,0xf947,0xf773,0xf5aa,0xf3ea,0xf234, | |
| 12 | 0xf087,0xeee3,0xed47,0xebb3,0xea27,0xe8a3,0xe727,0xe5b2, | |
| 13 | 0xe443,0xe2dc,0xe17a,0xe020,0xdecb,0xdd7d,0xdc34,0xdaf1, | |
| 14 | 0xd9b3,0xd87b,0xd748,0xd61a,0xd4f1,0xd3cd,0xd2ad,0xd192, | |
| 15 | 0xd07b,0xcf69,0xce5b,0xcd51,0xcc4a,0xcb48,0xca4a,0xc94f, | |
| 16 | 0xc858,0xc764,0xc674,0xc587,0xc49d,0xc3b7,0xc2d4,0xc1f4, | |
| 17 | 0xc116,0xc03c,0xbf65,0xbe90,0xbdbe,0xbcef,0xbc23,0xbb59, | |
| 18 | 0xba91,0xb9cc,0xb90a,0xb84a,0xb78c,0xb6d0,0xb617,0xb560, | |
| 19 | }; |
lib/libc/musl/src/math/sqrt_data.h deleted-13| ... | ... | @@ -1,13 +0,0 @@ |
| 1 | #ifndef _SQRT_DATA_H | |
| 2 | #define _SQRT_DATA_H | |
| 3 | ||
| 4 | #include <features.h> | |
| 5 | #include <stdint.h> | |
| 6 | ||
| 7 | /* if x in [1,2): i = (int)(64*x); | |
| 8 | if x in [2,4): i = (int)(32*x-64); | |
| 9 | __rsqrt_tab[i]*2^-16 is estimating 1/sqrt(x) with small relative error: | |
| 10 | |__rsqrt_tab[i]*0x1p-16*sqrt(x) - 1| < -0x1.fdp-9 < 2^-8 */ | |
| 11 | extern hidden const uint16_t __rsqrt_tab[128]; | |
| 12 | ||
| 13 | #endif |
lib/libc/musl/src/math/sqrtf.c deleted-83| ... | ... | @@ -1,83 +0,0 @@ |
| 1 | #include <stdint.h> | |
| 2 | #include <math.h> | |
| 3 | #include "libm.h" | |
| 4 | #include "sqrt_data.h" | |
| 5 | ||
| 6 | #define FENV_SUPPORT 1 | |
| 7 | ||
| 8 | static inline uint32_t mul32(uint32_t a, uint32_t b) | |
| 9 | { | |
| 10 | 	return (uint64_t)a*b >> 32; | |
| 11 | } | |
| 12 | ||
| 13 | /* see sqrt.c for more detailed comments. */ | |
| 14 | ||
| 15 | float sqrtf(float x) | |
| 16 | { | |
| 17 | 	uint32_t ix, m, m1, m0, even, ey; | |
| 18 | ||
| 19 | 	ix = asuint(x); | |
| 20 | 	if (predict_false(ix - 0x00800000 >= 0x7f800000 - 0x00800000)) { | |
| 21 | 		/* x < 0x1p-126 or inf or nan. */ | |
| 22 | 		if (ix * 2 == 0) | |
| 23 | 			return x; | |
| 24 | 		if (ix == 0x7f800000) | |
| 25 | 			return x; | |
| 26 | 		if (ix > 0x7f800000) | |
| 27 | 			return __math_invalidf(x); | |
| 28 | 		/* x is subnormal, normalize it. */ | |
| 29 | 		ix = asuint(x * 0x1p23f); | |
| 30 | 		ix -= 23 << 23; | |
| 31 | 	} | |
| 32 | ||
| 33 | 	/* x = 4^e m; with int e and m in [1, 4). */ | |
| 34 | 	even = ix & 0x00800000; | |
| 35 | 	m1 = (ix << 8) | 0x80000000; | |
| 36 | 	m0 = (ix << 7) & 0x7fffffff; | |
| 37 | 	m = even ? m0 : m1; | |
| 38 | ||
| 39 | 	/* 2^e is the exponent part of the return value. */ | |
| 40 | 	ey = ix >> 1; | |
| 41 | 	ey += 0x3f800000 >> 1; | |
| 42 | 	ey &= 0x7f800000; | |
| 43 | ||
| 44 | 	/* compute r ~ 1/sqrt(m), s ~ sqrt(m) with 2 goldschmidt iterations. */ | |
| 45 | 	static const uint32_t three = 0xc0000000; | |
| 46 | 	uint32_t r, s, d, u, i; | |
| 47 | 	i = (ix >> 17) % 128; | |
| 48 | 	r = (uint32_t)__rsqrt_tab[i] << 16; | |
| 49 | 	/* |r*sqrt(m) - 1| < 0x1p-8 */ | |
| 50 | 	s = mul32(m, r); | |
| 51 | 	/* |s/sqrt(m) - 1| < 0x1p-8 */ | |
| 52 | 	d = mul32(s, r); | |
| 53 | 	u = three - d; | |
| 54 | 	r = mul32(r, u) << 1; | |
| 55 | 	/* |r*sqrt(m) - 1| < 0x1.7bp-16 */ | |
| 56 | 	s = mul32(s, u) << 1; | |
| 57 | 	/* |s/sqrt(m) - 1| < 0x1.7bp-16 */ | |
| 58 | 	d = mul32(s, r); | |
| 59 | 	u = three - d; | |
| 60 | 	s = mul32(s, u); | |
| 61 | 	/* -0x1.03p-28 < s/sqrt(m) - 1 < 0x1.fp-31 */ | |
| 62 | 	s = (s - 1)>>6; | |
| 63 | 	/* s < sqrt(m) < s + 0x1.08p-23 */ | |
| 64 | ||
| 65 | 	/* compute nearest rounded result. */ | |
| 66 | 	uint32_t d0, d1, d2; | |
| 67 | 	float y, t; | |
| 68 | 	d0 = (m << 16) - s*s; | |
| 69 | 	d1 = s - d0; | |
| 70 | 	d2 = d1 + s + 1; | |
| 71 | 	s += d1 >> 31; | |
| 72 | 	s &= 0x007fffff; | |
| 73 | 	s |= ey; | |
| 74 | 	y = asfloat(s); | |
| 75 | 	if (FENV_SUPPORT) { | |
| 76 | 		/* handle rounding and inexact exception. */ | |
| 77 | 		uint32_t tiny = predict_false(d2==0) ? 0 : 0x01000000; | |
| 78 | 		tiny |= (d1^d2) & 0x80000000; | |
| 79 | 		t = asfloat(tiny); | |
| 80 | 		y = eval_as_float(y + t); | |
| 81 | 	} | |
| 82 | 	return y; | |
| 83 | } |
lib/libc/musl/src/math/sqrtl.c deleted-259| ... | ... | @@ -1,259 +0,0 @@ |
| 1 | #include <stdint.h> | |
| 2 | #include <math.h> | |
| 3 | #include <float.h> | |
| 4 | #include "libm.h" | |
| 5 | ||
| 6 | #if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 | |
| 7 | long double sqrtl(long double x) | |
| 8 | { | |
| 9 | 	return sqrt(x); | |
| 10 | } | |
| 11 | #elif (LDBL_MANT_DIG == 113 || LDBL_MANT_DIG == 64) && LDBL_MAX_EXP == 16384 | |
| 12 | #include "sqrt_data.h" | |
| 13 | ||
| 14 | #define FENV_SUPPORT 1 | |
| 15 | ||
| 16 | typedef struct { | |
| 17 | 	uint64_t hi; | |
| 18 | 	uint64_t lo; | |
| 19 | } u128; | |
| 20 | ||
| 21 | /* top: 16 bit sign+exponent, x: significand. */ | |
| 22 | static inline long double mkldbl(uint64_t top, u128 x) | |
| 23 | { | |
| 24 | 	union ldshape u; | |
| 25 | #if LDBL_MANT_DIG == 113 | |
| 26 | 	u.i2.hi = x.hi; | |
| 27 | 	u.i2.lo = x.lo; | |
| 28 | 	u.i2.hi &= 0x0000ffffffffffff; | |
| 29 | 	u.i2.hi |= top << 48; | |
| 30 | #elif LDBL_MANT_DIG == 64 | |
| 31 | 	u.i.se = top; | |
| 32 | 	u.i.m = x.lo; | |
| 33 | 	/* force the top bit on non-zero (and non-subnormal) results. */ | |
| 34 | 	if (top & 0x7fff) | |
| 35 | 		u.i.m |= 0x8000000000000000; | |
| 36 | #endif | |
| 37 | 	return u.f; | |
| 38 | } | |
| 39 | ||
| 40 | /* return: top 16 bit is sign+exp and following bits are the significand. */ | |
| 41 | static inline u128 asu128(long double x) | |
| 42 | { | |
| 43 | 	union ldshape u = {.f=x}; | |
| 44 | 	u128 r; | |
| 45 | #if LDBL_MANT_DIG == 113 | |
| 46 | 	r.hi = u.i2.hi; | |
| 47 | 	r.lo = u.i2.lo; | |
| 48 | #elif LDBL_MANT_DIG == 64 | |
| 49 | 	r.lo = u.i.m<<49; | |
| 50 | 	/* ignore the top bit: pseudo numbers are not handled. */ | |
| 51 | 	r.hi = u.i.m>>15; | |
| 52 | 	r.hi &= 0x0000ffffffffffff; | |
| 53 | 	r.hi |= (uint64_t)u.i.se << 48; | |
| 54 | #endif | |
| 55 | 	return r; | |
| 56 | } | |
| 57 | ||
| 58 | /* returns a*b*2^-32 - e, with error 0 <= e < 1. */ | |
| 59 | static inline uint32_t mul32(uint32_t a, uint32_t b) | |
| 60 | { | |
| 61 | 	return (uint64_t)a*b >> 32; | |
| 62 | } | |
| 63 | ||
| 64 | /* returns a*b*2^-64 - e, with error 0 <= e < 3. */ | |
| 65 | static inline uint64_t mul64(uint64_t a, uint64_t b) | |
| 66 | { | |
| 67 | 	uint64_t ahi = a>>32; | |
| 68 | 	uint64_t alo = a&0xffffffff; | |
| 69 | 	uint64_t bhi = b>>32; | |
| 70 | 	uint64_t blo = b&0xffffffff; | |
| 71 | 	return ahi*bhi + (ahi*blo >> 32) + (alo*bhi >> 32); | |
| 72 | } | |
| 73 | ||
| 74 | static inline u128 add64(u128 a, uint64_t b) | |
| 75 | { | |
| 76 | 	u128 r; | |
| 77 | 	r.lo = a.lo + b; | |
| 78 | 	r.hi = a.hi; | |
| 79 | 	if (r.lo < a.lo) | |
| 80 | 		r.hi++; | |
| 81 | 	return r; | |
| 82 | } | |
| 83 | ||
| 84 | static inline u128 add128(u128 a, u128 b) | |
| 85 | { | |
| 86 | 	u128 r; | |
| 87 | 	r.lo = a.lo + b.lo; | |
| 88 | 	r.hi = a.hi + b.hi; | |
| 89 | 	if (r.lo < a.lo) | |
| 90 | 		r.hi++; | |
| 91 | 	return r; | |
| 92 | } | |
| 93 | ||
| 94 | static inline u128 sub64(u128 a, uint64_t b) | |
| 95 | { | |
| 96 | 	u128 r; | |
| 97 | 	r.lo = a.lo - b; | |
| 98 | 	r.hi = a.hi; | |
| 99 | 	if (a.lo < b) | |
| 100 | 		r.hi--; | |
| 101 | 	return r; | |
| 102 | } | |
| 103 | ||
| 104 | static inline u128 sub128(u128 a, u128 b) | |
| 105 | { | |
| 106 | 	u128 r; | |
| 107 | 	r.lo = a.lo - b.lo; | |
| 108 | 	r.hi = a.hi - b.hi; | |
| 109 | 	if (a.lo < b.lo) | |
| 110 | 		r.hi--; | |
| 111 | 	return r; | |
| 112 | } | |
| 113 | ||
| 114 | /* a<<n, 0 <= n <= 127 */ | |
| 115 | static inline u128 lsh(u128 a, int n) | |
| 116 | { | |
| 117 | 	if (n == 0) | |
| 118 | 		return a; | |
| 119 | 	if (n >= 64) { | |
| 120 | 		a.hi = a.lo<<(n-64); | |
| 121 | 		a.lo = 0; | |
| 122 | 	} else { | |
| 123 | 		a.hi = (a.hi<<n) | (a.lo>>(64-n)); | |
| 124 | 		a.lo = a.lo<<n; | |
| 125 | 	} | |
| 126 | 	return a; | |
| 127 | } | |
| 128 | ||
| 129 | /* a>>n, 0 <= n <= 127 */ | |
| 130 | static inline u128 rsh(u128 a, int n) | |
| 131 | { | |
| 132 | 	if (n == 0) | |
| 133 | 		return a; | |
| 134 | 	if (n >= 64) { | |
| 135 | 		a.lo = a.hi>>(n-64); | |
| 136 | 		a.hi = 0; | |
| 137 | 	} else { | |
| 138 | 		a.lo = (a.lo>>n) | (a.hi<<(64-n)); | |
| 139 | 		a.hi = a.hi>>n; | |
| 140 | 	} | |
| 141 | 	return a; | |
| 142 | } | |
| 143 | ||
| 144 | /* returns a*b exactly. */ | |
| 145 | static inline u128 mul64_128(uint64_t a, uint64_t b) | |
| 146 | { | |
| 147 | 	u128 r; | |
| 148 | 	uint64_t ahi = a>>32; | |
| 149 | 	uint64_t alo = a&0xffffffff; | |
| 150 | 	uint64_t bhi = b>>32; | |
| 151 | 	uint64_t blo = b&0xffffffff; | |
| 152 | 	uint64_t lo1 = ((ahi*blo)&0xffffffff) + ((alo*bhi)&0xffffffff) + (alo*blo>>32); | |
| 153 | 	uint64_t lo2 = (alo*blo)&0xffffffff; | |
| 154 | 	r.hi = ahi*bhi + (ahi*blo>>32) + (alo*bhi>>32) + (lo1>>32); | |
| 155 | 	r.lo = (lo1<<32) + lo2; | |
| 156 | 	return r; | |
| 157 | } | |
| 158 | ||
| 159 | /* returns a*b*2^-128 - e, with error 0 <= e < 7. */ | |
| 160 | static inline u128 mul128(u128 a, u128 b) | |
| 161 | { | |
| 162 | 	u128 hi = mul64_128(a.hi, b.hi); | |
| 163 | 	uint64_t m1 = mul64(a.hi, b.lo); | |
| 164 | 	uint64_t m2 = mul64(a.lo, b.hi); | |
| 165 | 	return add64(add64(hi, m1), m2); | |
| 166 | } | |
| 167 | ||
| 168 | /* returns a*b % 2^128. */ | |
| 169 | static inline u128 mul128_tail(u128 a, u128 b) | |
| 170 | { | |
| 171 | 	u128 lo = mul64_128(a.lo, b.lo); | |
| 172 | 	lo.hi += a.hi*b.lo + a.lo*b.hi; | |
| 173 | 	return lo; | |
| 174 | } | |
| 175 | ||
| 176 | ||
| 177 | /* see sqrt.c for detailed comments. */ | |
| 178 | ||
| 179 | long double sqrtl(long double x) | |
| 180 | { | |
| 181 | 	u128 ix, ml; | |
| 182 | 	uint64_t top; | |
| 183 | ||
| 184 | 	ix = asu128(x); | |
| 185 | 	top = ix.hi >> 48; | |
| 186 | 	if (predict_false(top - 0x0001 >= 0x7fff - 0x0001)) { | |
| 187 | 		/* x < 0x1p-16382 or inf or nan. */ | |
| 188 | 		if (2*ix.hi == 0 && ix.lo == 0) | |
| 189 | 			return x; | |
| 190 | 		if (ix.hi == 0x7fff000000000000 && ix.lo == 0) | |
| 191 | 			return x; | |
| 192 | 		if (top >= 0x7fff) | |
| 193 | 			return __math_invalidl(x); | |
| 194 | 		/* x is subnormal, normalize it. */ | |
| 195 | 		ix = asu128(x * 0x1p112); | |
| 196 | 		top = ix.hi >> 48; | |
| 197 | 		top -= 112; | |
| 198 | 	} | |
| 199 | ||
| 200 | 	/* x = 4^e m; with int e and m in [1, 4) */ | |
| 201 | 	int even = top & 1; | |
| 202 | 	ml = lsh(ix, 15); | |
| 203 | 	ml.hi |= 0x8000000000000000; | |
| 204 | 	if (even) ml = rsh(ml, 1); | |
| 205 | 	top = (top + 0x3fff) >> 1; | |
| 206 | ||
| 207 | 	/* r ~ 1/sqrt(m) */ | |
| 208 | 	const uint64_t three = 0xc0000000; | |
| 209 | 	uint64_t r, s, d, u, i; | |
| 210 | 	i = (ix.hi >> 42) % 128; | |
| 211 | 	r = (uint32_t)__rsqrt_tab[i] << 16; | |
| 212 | 	/* |r sqrt(m) - 1| < 0x1p-8 */ | |
| 213 | 	s = mul32(ml.hi>>32, r); | |
| 214 | 	d = mul32(s, r); | |
| 215 | 	u = three - d; | |
| 216 | 	r = mul32(u, r) << 1; | |
| 217 | 	/* |r sqrt(m) - 1| < 0x1.7bp-16, switch to 64bit */ | |
| 218 | 	r = r<<32; | |
| 219 | 	s = mul64(ml.hi, r); | |
| 220 | 	d = mul64(s, r); | |
| 221 | 	u = (three<<32) - d; | |
| 222 | 	r = mul64(u, r) << 1; | |
| 223 | 	/* |r sqrt(m) - 1| < 0x1.a5p-31 */ | |
| 224 | 	s = mul64(u, s) << 1; | |
| 225 | 	d = mul64(s, r); | |
| 226 | 	u = (three<<32) - d; | |
| 227 | 	r = mul64(u, r) << 1; | |
| 228 | 	/* |r sqrt(m) - 1| < 0x1.c001p-59, switch to 128bit */ | |
| 229 | ||
| 230 | 	const u128 threel = {.hi=three<<32, .lo=0}; | |
| 231 | 	u128 rl, sl, dl, ul; | |
| 232 | 	rl.hi = r; | |
| 233 | 	rl.lo = 0; | |
| 234 | 	sl = mul128(ml, rl); | |
| 235 | 	dl = mul128(sl, rl); | |
| 236 | 	ul = sub128(threel, dl); | |
| 237 | 	sl = mul128(ul, sl); /* repr: 3.125 */ | |
| 238 | 	/* -0x1p-116 < s - sqrt(m) < 0x3.8001p-125 */ | |
| 239 | 	sl = rsh(sub64(sl, 4), 125-(LDBL_MANT_DIG-1)); | |
| 240 | 	/* s < sqrt(m) < s + 1 ULP + tiny */ | |
| 241 | ||
| 242 | 	long double y; | |
| 243 | 	u128 d2, d1, d0; | |
| 244 | 	d0 = sub128(lsh(ml, 2*(LDBL_MANT_DIG-1)-126), mul128_tail(sl,sl)); | |
| 245 | 	d1 = sub128(sl, d0); | |
| 246 | 	d2 = add128(add64(sl, 1), d1); | |
| 247 | 	sl = add64(sl, d1.hi >> 63); | |
| 248 | 	y = mkldbl(top, sl); | |
| 249 | 	if (FENV_SUPPORT) { | |
| 250 | 		/* handle rounding modes and inexact exception. */ | |
| 251 | 		top = predict_false((d2.hi|d2.lo)==0) ? 0 : 1; | |
| 252 | 		top |= ((d1.hi^d2.hi)&0x8000000000000000) >> 48; | |
| 253 | 		y += mkldbl(top, (u128){0}); | |
| 254 | 	} | |
| 255 | 	return y; | |
| 256 | } | |
| 257 | #else | |
| 258 | #error unsupported long double format | |
| 259 | #endif |
lib/libc/musl/src/math/x32/fmodl.s deleted-11| ... | ... | @@ -1,11 +0,0 @@ |
| 1 | .global fmodl | |
| 2 | .type fmodl,@function | |
| 3 | fmodl: | |
| 4 | 	fldt 24(%esp) | |
| 5 | 	fldt 8(%esp) | |
| 6 | 1:	fprem | |
| 7 | 	fnstsw %ax | |
| 8 | 	testb $4,%ah | |
| 9 | 	jnz 1b | |
| 10 | 	fstp %st(1) | |
| 11 | 	ret |
lib/libc/musl/src/math/x32/sqrt.s deleted-4| ... | ... | @@ -1,4 +0,0 @@ |
| 1 | .global sqrt | |
| 2 | .type sqrt,@function | |
| 3 | sqrt:	sqrtsd %xmm0, %xmm0 | |
| 4 | 	ret |
lib/libc/musl/src/math/x32/sqrtf.s deleted-4| ... | ... | @@ -1,4 +0,0 @@ |
| 1 | .global sqrtf | |
| 2 | .type sqrtf,@function | |
| 3 | sqrtf: sqrtss %xmm0, %xmm0 | |
| 4 | 	ret |
lib/libc/musl/src/math/x32/sqrtl.s deleted-5| ... | ... | @@ -1,5 +0,0 @@ |
| 1 | .global sqrtl | |
| 2 | .type sqrtl,@function | |
| 3 | sqrtl:	fldt 8(%esp) | |
| 4 | 	fsqrt | |
| 5 | 	ret |
lib/libc/musl/src/math/x86_64/fmodl.c deleted-9| ... | ... | @@ -1,9 +0,0 @@ |
| 1 | #include <math.h> | |
| 2 | ||
| 3 | long double fmodl(long double x, long double y) | |
| 4 | { | |
| 5 | 	unsigned short fpsr; | |
| 6 | 	do __asm__ ("fprem; fnstsw %%ax" : "+t"(x), "=a"(fpsr) : "u"(y)); | |
| 7 | 	while (fpsr & 0x400); | |
| 8 | 	return x; | |
| 9 | } |
lib/libc/musl/src/math/x86_64/sqrt.c deleted-7| ... | ... | @@ -1,7 +0,0 @@ |
| 1 | #include <math.h> | |
| 2 | ||
| 3 | double sqrt(double x) | |
| 4 | { | |
| 5 | 	__asm__ ("sqrtsd %1, %0" : "=x"(x) : "x"(x)); | |
| 6 | 	return x; | |
| 7 | } |
lib/libc/musl/src/math/x86_64/sqrtf.c deleted-7| ... | ... | @@ -1,7 +0,0 @@ |
| 1 | #include <math.h> | |
| 2 | ||
| 3 | float sqrtf(float x) | |
| 4 | { | |
| 5 | 	__asm__ ("sqrtss %1, %0" : "=x"(x) : "x"(x)); | |
| 6 | 	return x; | |
| 7 | } |
lib/libc/musl/src/math/x86_64/sqrtl.c deleted-7| ... | ... | @@ -1,7 +0,0 @@ |
| 1 | #include <math.h> | |
| 2 | ||
| 3 | long double sqrtl(long double x) | |
| 4 | { | |
| 5 | 	__asm__ ("fsqrt" : "+t"(x)); | |
| 6 | 	return x; | |
| 7 | } |
lib/libc/wasi/libc-bottom-half/sources/math/fmin-fmax.c deleted-34| ... | ... | @@ -1,34 +0,0 @@ |
| 1 | // Wasm's `min` and `max` operators implement the IEEE 754-2019 | |
| 2 | // `minimum` and `maximum` operations, meaning that given a choice | |
| 3 | // between NaN and a number, they return NaN. This differs from | |
| 4 | // the C standard library's `fmin` and `fmax` functions, which | |
| 5 | // return the number. However, we can still use wasm's builtins | |
| 6 | // by handling the NaN cases explicitly, and it still turns out | |
| 7 | // to be faster than doing the whole operation in | |
| 8 | // target-independent C. And, it's smaller. | |
| 9 | ||
| 10 | #include <math.h> | |
| 11 | ||
| 12 | float fminf(float x, float y) { | |
| 13 | if (isnan(x)) return y; | |
| 14 | if (isnan(y)) return x; | |
| 15 | return __builtin_wasm_min_f32(x, y); | |
| 16 | } | |
| 17 | ||
| 18 | float fmaxf(float x, float y) { | |
| 19 | if (isnan(x)) return y; | |
| 20 | if (isnan(y)) return x; | |
| 21 | return __builtin_wasm_max_f32(x, y); | |
| 22 | } | |
| 23 | ||
| 24 | double fmin(double x, double y) { | |
| 25 | if (isnan(x)) return y; | |
| 26 | if (isnan(y)) return x; | |
| 27 | return __builtin_wasm_min_f64(x, y); | |
| 28 | } | |
| 29 | ||
| 30 | double fmax(double x, double y) { | |
| 31 | if (isnan(x)) return y; | |
| 32 | if (isnan(y)) return x; | |
| 33 | return __builtin_wasm_max_f64(x, y); | |
| 34 | } |
src/libs/mingw.zig-7| ... | ... | @@ -630,7 +630,6 @@ const mingw32_generic_src = [_][]const u8{ |
| 630 | 630 | "math" ++ path.sep_str ++ "signbitl.c", |
| 631 | 631 | "math" ++ path.sep_str ++ "signgam.c", |
| 632 | 632 | "math" ++ path.sep_str ++ "sinhl.c", |
| 633 | "math" ++ path.sep_str ++ "sqrtl.c", | |
| 634 | 633 | "math" ++ path.sep_str ++ "tanhl.c", |
| 635 | 634 | "misc" ++ path.sep_str ++ "alarm.c", |
| 636 | 635 | "misc" ++ path.sep_str ++ "btowc.c", |
| ... | ... | @@ -942,8 +941,6 @@ const mingw32_x86_src = [_][]const u8{ |
| 942 | 941 | "math" ++ path.sep_str ++ "erfl.c", |
| 943 | 942 | "math" ++ path.sep_str ++ "fdiml.c", |
| 944 | 943 | "math" ++ path.sep_str ++ "fmal.c", |
| 945 | "math" ++ path.sep_str ++ "fmaxl.c", | |
| 946 | "math" ++ path.sep_str ++ "fminl.c", | |
| 947 | 944 | "math" ++ path.sep_str ++ "llrintl.c", |
| 948 | 945 | "math" ++ path.sep_str ++ "llroundl.c", |
| 949 | 946 | "math" ++ path.sep_str ++ "lrintl.c", |
| ... | ... | @@ -959,14 +956,12 @@ const mingw32_x86_src = [_][]const u8{ |
| 959 | 956 | "math" ++ path.sep_str ++ "x86" ++ path.sep_str ++ "atan2l.c", |
| 960 | 957 | "math" ++ path.sep_str ++ "x86" ++ path.sep_str ++ "atanhl.c", |
| 961 | 958 | "math" ++ path.sep_str ++ "x86" ++ path.sep_str ++ "atanl.c", |
| 962 | "math" ++ path.sep_str ++ "x86" ++ path.sep_str ++ "copysignl.S", | |
| 963 | 959 | "math" ++ path.sep_str ++ "x86" ++ path.sep_str ++ "cosl.c", |
| 964 | 960 | "math" ++ path.sep_str ++ "x86" ++ path.sep_str ++ "cosl_internal.S", |
| 965 | 961 | "math" ++ path.sep_str ++ "x86" ++ path.sep_str ++ "cossinl.c", |
| 966 | 962 | "math" ++ path.sep_str ++ "x86" ++ path.sep_str ++ "exp2l.S", |
| 967 | 963 | "math" ++ path.sep_str ++ "x86" ++ path.sep_str ++ "expl.c", |
| 968 | 964 | "math" ++ path.sep_str ++ "x86" ++ path.sep_str ++ "expm1l.c", |
| 969 | "math" ++ path.sep_str ++ "x86" ++ path.sep_str ++ "fmodl.c", | |
| 970 | 965 | "math" ++ path.sep_str ++ "x86" ++ path.sep_str ++ "fucom.c", |
| 971 | 966 | "math" ++ path.sep_str ++ "x86" ++ path.sep_str ++ "ilogbl.S", |
| 972 | 967 | "math" ++ path.sep_str ++ "x86" ++ path.sep_str ++ "internal_logl.S", |
| ... | ... | @@ -999,13 +994,11 @@ const mingw32_x86_32_src = [_][]const u8{ |
| 999 | 994 | "math" ++ path.sep_str ++ "modff.c", |
| 1000 | 995 | "math" ++ path.sep_str ++ "powf.c", |
| 1001 | 996 | "math" ++ path.sep_str ++ "sinhf.c", |
| 1002 | "math" ++ path.sep_str ++ "sqrtf.c", | |
| 1003 | 997 | "math" ++ path.sep_str ++ "tanhf.c", |
| 1004 | 998 | "math" ++ path.sep_str ++ "x86" ++ path.sep_str ++ "acosf.c", |
| 1005 | 999 | "math" ++ path.sep_str ++ "x86" ++ path.sep_str ++ "asinf.c", |
| 1006 | 1000 | "math" ++ path.sep_str ++ "x86" ++ path.sep_str ++ "atan2f.c", |
| 1007 | 1001 | "math" ++ path.sep_str ++ "x86" ++ path.sep_str ++ "atanf.c", |
| 1008 | "math" ++ path.sep_str ++ "x86" ++ path.sep_str ++ "fmodf.c", | |
| 1009 | 1002 | }; |
| 1010 | 1003 | |
| 1011 | 1004 | const mingw32_arm_src = [_][]const u8{ |
src/libs/musl.zig-75| ... | ... | @@ -812,10 +812,6 @@ const src_files = [_][]const u8{ |
| 812 | 812 | "musl/src/malloc/replaced.c", |
| 813 | 813 | "musl/src/math/aarch64/fma.c", |
| 814 | 814 | "musl/src/math/aarch64/fmaf.c", |
| 815 | "musl/src/math/aarch64/fmax.c", | |
| 816 | "musl/src/math/aarch64/fmaxf.c", | |
| 817 | "musl/src/math/aarch64/fmin.c", | |
| 818 | "musl/src/math/aarch64/fminf.c", | |
| 819 | 815 | "musl/src/math/aarch64/llrint.c", |
| 820 | 816 | "musl/src/math/aarch64/llrintf.c", |
| 821 | 817 | "musl/src/math/aarch64/llround.c", |
| ... | ... | @@ -830,8 +826,6 @@ const src_files = [_][]const u8{ |
| 830 | 826 | "musl/src/math/aarch64/rintf.c", |
| 831 | 827 | "musl/src/math/aarch64/round.c", |
| 832 | 828 | "musl/src/math/aarch64/roundf.c", |
| 833 | "musl/src/math/aarch64/sqrt.c", | |
| 834 | "musl/src/math/aarch64/sqrtf.c", | |
| 835 | 829 | "musl/src/math/acos.c", |
| 836 | 830 | "musl/src/math/acosf.c", |
| 837 | 831 | "musl/src/math/acosh.c", |
| ... | ... | @@ -840,8 +834,6 @@ const src_files = [_][]const u8{ |
| 840 | 834 | "musl/src/math/acosl.c", |
| 841 | 835 | "musl/src/math/arm/fma.c", |
| 842 | 836 | "musl/src/math/arm/fmaf.c", |
| 843 | "musl/src/math/arm/sqrt.c", | |
| 844 | "musl/src/math/arm/sqrtf.c", | |
| 845 | 837 | "musl/src/math/asin.c", |
| 846 | 838 | "musl/src/math/asinf.c", |
| 847 | 839 | "musl/src/math/asinh.c", |
| ... | ... | @@ -860,9 +852,6 @@ const src_files = [_][]const u8{ |
| 860 | 852 | "musl/src/math/cbrt.c", |
| 861 | 853 | "musl/src/math/cbrtf.c", |
| 862 | 854 | "musl/src/math/cbrtl.c", |
| 863 | "musl/src/math/copysign.c", | |
| 864 | "musl/src/math/copysignf.c", | |
| 865 | "musl/src/math/copysignl.c", | |
| 866 | 855 | "musl/src/math/__cos.c", |
| 867 | 856 | "musl/src/math/__cosdf.c", |
| 868 | 857 | "musl/src/math/cosh.c", |
| ... | ... | @@ -893,12 +882,6 @@ const src_files = [_][]const u8{ |
| 893 | 882 | "musl/src/math/fma.c", |
| 894 | 883 | "musl/src/math/fmaf.c", |
| 895 | 884 | "musl/src/math/fmal.c", |
| 896 | "musl/src/math/fmax.c", | |
| 897 | "musl/src/math/fmaxf.c", | |
| 898 | "musl/src/math/fmaxl.c", | |
| 899 | "musl/src/math/fmin.c", | |
| 900 | "musl/src/math/fminf.c", | |
| 901 | "musl/src/math/fminl.c", | |
| 902 | 885 | "musl/src/math/__fpclassify.c", |
| 903 | 886 | "musl/src/math/__fpclassifyf.c", |
| 904 | 887 | "musl/src/math/__fpclassifyl.c", |
| ... | ... | @@ -924,9 +907,6 @@ const src_files = [_][]const u8{ |
| 924 | 907 | "musl/src/math/i386/exp_ld.s", |
| 925 | 908 | "musl/src/math/i386/expl.s", |
| 926 | 909 | "musl/src/math/i386/expm1l.s", |
| 927 | "musl/src/math/i386/fmod.c", | |
| 928 | "musl/src/math/i386/fmodf.c", | |
| 929 | "musl/src/math/i386/fmodl.c", | |
| 930 | 910 | "musl/src/math/i386/hypotf.s", |
| 931 | 911 | "musl/src/math/i386/hypot.s", |
| 932 | 912 | "musl/src/math/i386/__invtrigl.s", |
| ... | ... | @@ -936,18 +916,12 @@ const src_files = [_][]const u8{ |
| 936 | 916 | "musl/src/math/i386/llrint.c", |
| 937 | 917 | "musl/src/math/i386/llrintf.c", |
| 938 | 918 | "musl/src/math/i386/llrintl.c", |
| 939 | "musl/src/math/i386/log10f.s", | |
| 940 | 919 | "musl/src/math/i386/log10l.s", |
| 941 | "musl/src/math/i386/log10.s", | |
| 942 | 920 | "musl/src/math/i386/log1pf.s", |
| 943 | 921 | "musl/src/math/i386/log1pl.s", |
| 944 | 922 | "musl/src/math/i386/log1p.s", |
| 945 | "musl/src/math/i386/log2f.s", | |
| 946 | 923 | "musl/src/math/i386/log2l.s", |
| 947 | "musl/src/math/i386/log2.s", | |
| 948 | "musl/src/math/i386/logf.s", | |
| 949 | 924 | "musl/src/math/i386/logl.s", |
| 950 | "musl/src/math/i386/log.s", | |
| 951 | 925 | "musl/src/math/i386/lrint.c", |
| 952 | 926 | "musl/src/math/i386/lrintf.c", |
| 953 | 927 | "musl/src/math/i386/lrintl.c", |
| ... | ... | @@ -966,9 +940,6 @@ const src_files = [_][]const u8{ |
| 966 | 940 | "musl/src/math/i386/scalbnf.s", |
| 967 | 941 | "musl/src/math/i386/scalbnl.s", |
| 968 | 942 | "musl/src/math/i386/scalbn.s", |
| 969 | "musl/src/math/i386/sqrt.c", | |
| 970 | "musl/src/math/i386/sqrtf.c", | |
| 971 | "musl/src/math/i386/sqrtl.c", | |
| 972 | 943 | "musl/src/math/ilogb.c", |
| 973 | 944 | "musl/src/math/ilogbf.c", |
| 974 | 945 | "musl/src/math/ilogbl.c", |
| ... | ... | @@ -997,14 +968,10 @@ const src_files = [_][]const u8{ |
| 997 | 968 | "musl/src/math/log1p.c", |
| 998 | 969 | "musl/src/math/log1pf.c", |
| 999 | 970 | "musl/src/math/log1pl.c", |
| 1000 | "musl/src/math/log2_data.c", | |
| 1001 | "musl/src/math/log2f_data.c", | |
| 1002 | 971 | "musl/src/math/log2l.c", |
| 1003 | 972 | "musl/src/math/logb.c", |
| 1004 | 973 | "musl/src/math/logbf.c", |
| 1005 | 974 | "musl/src/math/logbl.c", |
| 1006 | "musl/src/math/log_data.c", | |
| 1007 | "musl/src/math/logf_data.c", | |
| 1008 | 975 | "musl/src/math/logl.c", |
| 1009 | 976 | "musl/src/math/lrint.c", |
| 1010 | 977 | "musl/src/math/lrintf.c", |
| ... | ... | @@ -1012,7 +979,6 @@ const src_files = [_][]const u8{ |
| 1012 | 979 | "musl/src/math/lround.c", |
| 1013 | 980 | "musl/src/math/lroundf.c", |
| 1014 | 981 | "musl/src/math/lroundl.c", |
| 1015 | "musl/src/math/m68k/sqrtl.c", | |
| 1016 | 982 | "musl/src/math/__math_divzero.c", |
| 1017 | 983 | "musl/src/math/__math_divzerof.c", |
| 1018 | 984 | "musl/src/math/__math_invalid.c", |
| ... | ... | @@ -1024,8 +990,6 @@ const src_files = [_][]const u8{ |
| 1024 | 990 | "musl/src/math/__math_uflowf.c", |
| 1025 | 991 | "musl/src/math/__math_xflow.c", |
| 1026 | 992 | "musl/src/math/__math_xflowf.c", |
| 1027 | "musl/src/math/mips/sqrt.c", | |
| 1028 | "musl/src/math/mips/sqrtf.c", | |
| 1029 | 993 | "musl/src/math/modf.c", |
| 1030 | 994 | "musl/src/math/modff.c", |
| 1031 | 995 | "musl/src/math/modfl.c", |
| ... | ... | @@ -1043,22 +1007,14 @@ const src_files = [_][]const u8{ |
| 1043 | 1007 | "musl/src/math/pow_data.c", |
| 1044 | 1008 | "musl/src/math/powerpc64/fma.c", |
| 1045 | 1009 | "musl/src/math/powerpc64/fmaf.c", |
| 1046 | "musl/src/math/powerpc64/fmax.c", | |
| 1047 | "musl/src/math/powerpc64/fmaxf.c", | |
| 1048 | "musl/src/math/powerpc64/fmin.c", | |
| 1049 | "musl/src/math/powerpc64/fminf.c", | |
| 1050 | 1010 | "musl/src/math/powerpc64/lrint.c", |
| 1051 | 1011 | "musl/src/math/powerpc64/lrintf.c", |
| 1052 | 1012 | "musl/src/math/powerpc64/lround.c", |
| 1053 | 1013 | "musl/src/math/powerpc64/lroundf.c", |
| 1054 | 1014 | "musl/src/math/powerpc64/round.c", |
| 1055 | 1015 | "musl/src/math/powerpc64/roundf.c", |
| 1056 | "musl/src/math/powerpc64/sqrt.c", | |
| 1057 | "musl/src/math/powerpc64/sqrtf.c", | |
| 1058 | 1016 | "musl/src/math/powerpc/fma.c", |
| 1059 | 1017 | "musl/src/math/powerpc/fmaf.c", |
| 1060 | "musl/src/math/powerpc/sqrt.c", | |
| 1061 | "musl/src/math/powerpc/sqrtf.c", | |
| 1062 | 1018 | "musl/src/math/powf.c", |
| 1063 | 1019 | "musl/src/math/powf_data.c", |
| 1064 | 1020 | "musl/src/math/powl.c", |
| ... | ... | @@ -1075,26 +1031,10 @@ const src_files = [_][]const u8{ |
| 1075 | 1031 | "musl/src/math/rint.c", |
| 1076 | 1032 | "musl/src/math/rintf.c", |
| 1077 | 1033 | "musl/src/math/rintl.c", |
| 1078 | "musl/src/math/riscv32/copysign.c", | |
| 1079 | "musl/src/math/riscv32/copysignf.c", | |
| 1080 | 1034 | "musl/src/math/riscv32/fma.c", |
| 1081 | 1035 | "musl/src/math/riscv32/fmaf.c", |
| 1082 | "musl/src/math/riscv32/fmax.c", | |
| 1083 | "musl/src/math/riscv32/fmaxf.c", | |
| 1084 | "musl/src/math/riscv32/fmin.c", | |
| 1085 | "musl/src/math/riscv32/fminf.c", | |
| 1086 | "musl/src/math/riscv32/sqrt.c", | |
| 1087 | "musl/src/math/riscv32/sqrtf.c", | |
| 1088 | "musl/src/math/riscv64/copysign.c", | |
| 1089 | "musl/src/math/riscv64/copysignf.c", | |
| 1090 | 1036 | "musl/src/math/riscv64/fma.c", |
| 1091 | 1037 | "musl/src/math/riscv64/fmaf.c", |
| 1092 | "musl/src/math/riscv64/fmax.c", | |
| 1093 | "musl/src/math/riscv64/fmaxf.c", | |
| 1094 | "musl/src/math/riscv64/fmin.c", | |
| 1095 | "musl/src/math/riscv64/fminf.c", | |
| 1096 | "musl/src/math/riscv64/sqrt.c", | |
| 1097 | "musl/src/math/riscv64/sqrtf.c", | |
| 1098 | 1038 | "musl/src/math/round.c", |
| 1099 | 1039 | "musl/src/math/roundf.c", |
| 1100 | 1040 | "musl/src/math/roundl.c", |
| ... | ... | @@ -1109,9 +1049,6 @@ const src_files = [_][]const u8{ |
| 1109 | 1049 | "musl/src/math/s390x/round.c", |
| 1110 | 1050 | "musl/src/math/s390x/roundf.c", |
| 1111 | 1051 | "musl/src/math/s390x/roundl.c", |
| 1112 | "musl/src/math/s390x/sqrt.c", | |
| 1113 | "musl/src/math/s390x/sqrtf.c", | |
| 1114 | "musl/src/math/s390x/sqrtl.c", | |
| 1115 | 1052 | "musl/src/math/scalb.c", |
| 1116 | 1053 | "musl/src/math/scalbf.c", |
| 1117 | 1054 | "musl/src/math/scalbln.c", |
| ... | ... | @@ -1134,10 +1071,6 @@ const src_files = [_][]const u8{ |
| 1134 | 1071 | "musl/src/math/sinhl.c", |
| 1135 | 1072 | "musl/src/math/__sinl.c", |
| 1136 | 1073 | "musl/src/math/sinl.c", |
| 1137 | "musl/src/math/sqrt.c", | |
| 1138 | "musl/src/math/sqrt_data.c", | |
| 1139 | "musl/src/math/sqrtf.c", | |
| 1140 | "musl/src/math/sqrtl.c", | |
| 1141 | 1074 | "musl/src/math/__tan.c", |
| 1142 | 1075 | "musl/src/math/__tandf.c", |
| 1143 | 1076 | "musl/src/math/tanh.c", |
| ... | ... | @@ -1157,7 +1090,6 @@ const src_files = [_][]const u8{ |
| 1157 | 1090 | "musl/src/math/x32/expm1l.s", |
| 1158 | 1091 | "musl/src/math/x32/fma.c", |
| 1159 | 1092 | "musl/src/math/x32/fmaf.c", |
| 1160 | "musl/src/math/x32/fmodl.s", | |
| 1161 | 1093 | "musl/src/math/x32/__invtrigl.s", |
| 1162 | 1094 | "musl/src/math/x32/llrintf.s", |
| 1163 | 1095 | "musl/src/math/x32/llrintl.s", |
| ... | ... | @@ -1171,9 +1103,6 @@ const src_files = [_][]const u8{ |
| 1171 | 1103 | "musl/src/math/x32/lrint.s", |
| 1172 | 1104 | "musl/src/math/x32/remainderl.s", |
| 1173 | 1105 | "musl/src/math/x32/rintl.s", |
| 1174 | "musl/src/math/x32/sqrtf.s", | |
| 1175 | "musl/src/math/x32/sqrtl.s", | |
| 1176 | "musl/src/math/x32/sqrt.s", | |
| 1177 | 1106 | "musl/src/math/x86_64/acosl.s", |
| 1178 | 1107 | "musl/src/math/x86_64/asinl.s", |
| 1179 | 1108 | "musl/src/math/x86_64/atan2l.s", |
| ... | ... | @@ -1183,7 +1112,6 @@ const src_files = [_][]const u8{ |
| 1183 | 1112 | "musl/src/math/x86_64/expm1l.s", |
| 1184 | 1113 | "musl/src/math/x86_64/fma.c", |
| 1185 | 1114 | "musl/src/math/x86_64/fmaf.c", |
| 1186 | "musl/src/math/x86_64/fmodl.c", | |
| 1187 | 1115 | "musl/src/math/x86_64/__invtrigl.s", |
| 1188 | 1116 | "musl/src/math/x86_64/llrint.c", |
| 1189 | 1117 | "musl/src/math/x86_64/llrintf.c", |
| ... | ... | @@ -1198,9 +1126,6 @@ const src_files = [_][]const u8{ |
| 1198 | 1126 | "musl/src/math/x86_64/remainderl.c", |
| 1199 | 1127 | "musl/src/math/x86_64/remquol.c", |
| 1200 | 1128 | "musl/src/math/x86_64/rintl.c", |
| 1201 | "musl/src/math/x86_64/sqrt.c", | |
| 1202 | "musl/src/math/x86_64/sqrtf.c", | |
| 1203 | "musl/src/math/x86_64/sqrtl.c", | |
| 1204 | 1129 | "musl/src/misc/a64l.c", |
| 1205 | 1130 | "musl/src/misc/basename.c", |
| 1206 | 1131 | "musl/src/misc/dirname.c", |
src/libs/wasi_libc.zig-10| ... | ... | @@ -547,7 +547,6 @@ const libc_bottom_half_src_files = [_][]const u8{ |
| 547 | 547 | "wasi/libc-bottom-half/sources/getentropy.c", |
| 548 | 548 | "wasi/libc-bottom-half/sources/isatty.c", |
| 549 | 549 | "wasi/libc-bottom-half/sources/__main_void.c", |
| 550 | "wasi/libc-bottom-half/sources/math/fmin-fmax.c", | |
| 551 | 550 | "wasi/libc-bottom-half/sources/math/math-builtins.c", |
| 552 | 551 | "wasi/libc-bottom-half/sources/posix.c", |
| 553 | 552 | "wasi/libc-bottom-half/sources/preopens.c", |
| ... | ... | @@ -711,7 +710,6 @@ const libc_top_half_src_files = [_][]const u8{ |
| 711 | 710 | "musl/src/math/cbrt.c", |
| 712 | 711 | "musl/src/math/cbrtf.c", |
| 713 | 712 | "musl/src/math/cbrtl.c", |
| 714 | "musl/src/math/copysignl.c", | |
| 715 | 713 | "musl/src/math/__cos.c", |
| 716 | 714 | "musl/src/math/__cosdf.c", |
| 717 | 715 | "musl/src/math/coshl.c", |
| ... | ... | @@ -737,8 +735,6 @@ const libc_top_half_src_files = [_][]const u8{ |
| 737 | 735 | "musl/src/math/finitef.c", |
| 738 | 736 | "musl/src/math/fma.c", |
| 739 | 737 | "musl/src/math/fmaf.c", |
| 740 | "musl/src/math/fmaxl.c", | |
| 741 | "musl/src/math/fminl.c", | |
| 742 | 738 | "musl/src/math/frexp.c", |
| 743 | 739 | "musl/src/math/frexpf.c", |
| 744 | 740 | "musl/src/math/frexpl.c", |
| ... | ... | @@ -773,14 +769,10 @@ const libc_top_half_src_files = [_][]const u8{ |
| 773 | 769 | "musl/src/math/log1p.c", |
| 774 | 770 | "musl/src/math/log1pf.c", |
| 775 | 771 | "musl/src/math/log1pl.c", |
| 776 | "musl/src/math/log2_data.c", | |
| 777 | "musl/src/math/log2f_data.c", | |
| 778 | 772 | "musl/src/math/log2l.c", |
| 779 | 773 | "musl/src/math/logb.c", |
| 780 | 774 | "musl/src/math/logbf.c", |
| 781 | 775 | "musl/src/math/logbl.c", |
| 782 | "musl/src/math/log_data.c", | |
| 783 | "musl/src/math/logf_data.c", | |
| 784 | 776 | "musl/src/math/logl.c", |
| 785 | 777 | "musl/src/math/lrint.c", |
| 786 | 778 | "musl/src/math/lrintf.c", |
| ... | ... | @@ -842,8 +834,6 @@ const libc_top_half_src_files = [_][]const u8{ |
| 842 | 834 | "musl/src/math/sinhl.c", |
| 843 | 835 | "musl/src/math/__sinl.c", |
| 844 | 836 | "musl/src/math/sinl.c", |
| 845 | "musl/src/math/sqrt_data.c", | |
| 846 | "musl/src/math/sqrtl.c", | |
| 847 | 837 | "musl/src/math/__tan.c", |
| 848 | 838 | "musl/src/math/__tandf.c", |
| 849 | 839 | "musl/src/math/tanh.c", |
test/libc.zig+200| ... | ... | @@ -137,6 +137,206 @@ pub fn addCases(cases: *tests.LibcContext) void { |
| 137 | 137 | cases.addLibcTestCase("regression/uselocale-0.c", true, .{}); |
| 138 | 138 | cases.addLibcTestCase("regression/wcsncpy-read-overflow.c", true, .{}); |
| 139 | 139 | cases.addLibcTestCase("regression/wcsstr-false-negative.c", true, .{}); |
| 140 | ||
| 141 | // cases.addLibcTestCase("math/acos.c", true, .{}); | |
| 142 | // cases.addLibcTestCase("math/acosf.c", true, .{}); | |
| 143 | // cases.addLibcTestCase("math/acosh.c", true, .{}); | |
| 144 | cases.addLibcTestCase("math/acoshf.c", true, .{}); | |
| 145 | // cases.addLibcTestCase("math/acoshl.c", true, .{}); | |
| 146 | // cases.addLibcTestCase("math/acosl.c", true, .{}); | |
| 147 | cases.addLibcTestCase("math/asin.c", true, .{}); | |
| 148 | cases.addLibcTestCase("math/asinf.c", true, .{}); | |
| 149 | // cases.addLibcTestCase("math/asinh.c", true, .{}); | |
| 150 | cases.addLibcTestCase("math/asinhf.c", true, .{}); | |
| 151 | // cases.addLibcTestCase("math/asinhl.c", true, .{}); | |
| 152 | cases.addLibcTestCase("math/asinl.c", true, .{}); | |
| 153 | cases.addLibcTestCase("math/atan.c", true, .{}); | |
| 154 | // cases.addLibcTestCase("math/atan2.c", true, .{}); | |
| 155 | // cases.addLibcTestCase("math/atan2f.c", true, .{}); | |
| 156 | // cases.addLibcTestCase("math/atan2l.c", true, .{}); | |
| 157 | cases.addLibcTestCase("math/atanf.c", true, .{}); | |
| 158 | cases.addLibcTestCase("math/atanh.c", true, .{}); | |
| 159 | cases.addLibcTestCase("math/atanhf.c", true, .{}); | |
| 160 | cases.addLibcTestCase("math/atanhl.c", true, .{}); | |
| 161 | cases.addLibcTestCase("math/atanl.c", true, .{}); | |
| 162 | cases.addLibcTestCase("math/cbrt.c", true, .{}); | |
| 163 | cases.addLibcTestCase("math/cbrtf.c", true, .{}); | |
| 164 | cases.addLibcTestCase("math/cbrtl.c", true, .{}); | |
| 165 | cases.addLibcTestCase("math/ceil.c", true, .{}); | |
| 166 | cases.addLibcTestCase("math/ceilf.c", true, .{}); | |
| 167 | cases.addLibcTestCase("math/ceill.c", true, .{}); | |
| 168 | cases.addLibcTestCase("math/copysign.c", true, .{}); | |
| 169 | cases.addLibcTestCase("math/copysignf.c", true, .{}); | |
| 170 | cases.addLibcTestCase("math/copysignl.c", true, .{}); | |
| 171 | cases.addLibcTestCase("math/cos.c", true, .{}); | |
| 172 | cases.addLibcTestCase("math/cosf.c", true, .{}); | |
| 173 | cases.addLibcTestCase("math/cosh.c", true, .{}); | |
| 174 | cases.addLibcTestCase("math/coshf.c", true, .{}); | |
| 175 | cases.addLibcTestCase("math/coshl.c", true, .{}); | |
| 176 | cases.addLibcTestCase("math/cosl.c", true, .{}); | |
| 177 | cases.addLibcTestCase("math/drem.c", true, .{}); | |
| 178 | cases.addLibcTestCase("math/dremf.c", true, .{}); | |
| 179 | cases.addLibcTestCase("math/erf.c", true, .{}); | |
| 180 | cases.addLibcTestCase("math/erfc.c", true, .{}); | |
| 181 | // cases.addLibcTestCase("math/erfcf.c", true, .{}); | |
| 182 | cases.addLibcTestCase("math/erfcl.c", true, .{}); | |
| 183 | cases.addLibcTestCase("math/erff.c", true, .{}); | |
| 184 | cases.addLibcTestCase("math/erfl.c", true, .{}); | |
| 185 | cases.addLibcTestCase("math/exp.c", true, .{}); | |
| 186 | cases.addLibcTestCase("math/exp10.c", true, .{}); | |
| 187 | cases.addLibcTestCase("math/exp10f.c", true, .{}); | |
| 188 | cases.addLibcTestCase("math/exp10l.c", true, .{}); | |
| 189 | cases.addLibcTestCase("math/exp2.c", true, .{}); | |
| 190 | cases.addLibcTestCase("math/exp2f.c", true, .{}); | |
| 191 | cases.addLibcTestCase("math/exp2l.c", true, .{}); | |
| 192 | cases.addLibcTestCase("math/expf.c", true, .{}); | |
| 193 | cases.addLibcTestCase("math/expl.c", true, .{}); | |
| 194 | // cases.addLibcTestCase("math/expm1.c", true, .{}); | |
| 195 | // cases.addLibcTestCase("math/expm1f.c", true, .{}); | |
| 196 | // cases.addLibcTestCase("math/expm1l.c", true, .{}); | |
| 197 | cases.addLibcTestCase("math/fabs.c", true, .{}); | |
| 198 | cases.addLibcTestCase("math/fabsf.c", true, .{}); | |
| 199 | cases.addLibcTestCase("math/fabsl.c", true, .{}); | |
| 200 | // cases.addLibcTestCase("math/fdim.c", true, .{}); | |
| 201 | // cases.addLibcTestCase("math/fdimf.c", true, .{}); | |
| 202 | // cases.addLibcTestCase("math/fdiml.c", true, .{}); | |
| 203 | cases.addLibcTestCase("math/fenv.c", true, .{}); | |
| 204 | cases.addLibcTestCase("math/floor.c", true, .{}); | |
| 205 | cases.addLibcTestCase("math/floorf.c", true, .{}); | |
| 206 | cases.addLibcTestCase("math/floorl.c", true, .{}); | |
| 207 | // cases.addLibcTestCase("math/fma.c", true, .{}); | |
| 208 | // cases.addLibcTestCase("math/fmaf.c", true, .{}); | |
| 209 | // cases.addLibcTestCase("math/fmal.c", true, .{}); | |
| 210 | cases.addLibcTestCase("math/fmax.c", true, .{}); | |
| 211 | cases.addLibcTestCase("math/fmaxf.c", true, .{}); | |
| 212 | cases.addLibcTestCase("math/fmaxl.c", true, .{}); | |
| 213 | cases.addLibcTestCase("math/fmin.c", true, .{}); | |
| 214 | cases.addLibcTestCase("math/fminf.c", true, .{}); | |
| 215 | cases.addLibcTestCase("math/fminl.c", true, .{}); | |
| 216 | cases.addLibcTestCase("math/fmod.c", true, .{}); | |
| 217 | cases.addLibcTestCase("math/fmodf.c", true, .{}); | |
| 218 | cases.addLibcTestCase("math/fmodl.c", true, .{}); | |
| 219 | cases.addLibcTestCase("math/fpclassify.c", true, .{}); | |
| 220 | cases.addLibcTestCase("math/frexp.c", true, .{}); | |
| 221 | cases.addLibcTestCase("math/frexpf.c", true, .{}); | |
| 222 | cases.addLibcTestCase("math/frexpl.c", true, .{}); | |
| 223 | cases.addLibcTestCase("math/hypot.c", true, .{}); | |
| 224 | cases.addLibcTestCase("math/hypotf.c", true, .{}); | |
| 225 | cases.addLibcTestCase("math/hypotl.c", true, .{}); | |
| 226 | // cases.addLibcTestCase("math/ilogb.c", true, .{}); | |
| 227 | // cases.addLibcTestCase("math/ilogbf.c", true, .{}); | |
| 228 | // cases.addLibcTestCase("math/ilogbl.c", true, .{}); | |
| 229 | cases.addLibcTestCase("math/isless.c", true, .{}); | |
| 230 | // cases.addLibcTestCase("math/j0.c", true, .{}); | |
| 231 | cases.addLibcTestCase("math/j0f.c", true, .{}); | |
| 232 | cases.addLibcTestCase("math/j1.c", true, .{}); | |
| 233 | cases.addLibcTestCase("math/j1f.c", true, .{}); | |
| 234 | // cases.addLibcTestCase("math/jn.c", true, .{}); | |
| 235 | // cases.addLibcTestCase("math/jnf.c", true, .{}); | |
| 236 | cases.addLibcTestCase("math/ldexp.c", true, .{}); | |
| 237 | cases.addLibcTestCase("math/ldexpf.c", true, .{}); | |
| 238 | cases.addLibcTestCase("math/ldexpl.c", true, .{}); | |
| 239 | // cases.addLibcTestCase("math/lgamma.c", true, .{}); | |
| 240 | cases.addLibcTestCase("math/lgamma_r.c", true, .{}); | |
| 241 | // cases.addLibcTestCase("math/lgammaf.c", true, .{}); | |
| 242 | // cases.addLibcTestCase("math/lgammaf_r.c", true, .{}); | |
| 243 | // cases.addLibcTestCase("math/lgammal.c", true, .{}); | |
| 244 | cases.addLibcTestCase("math/lgammal_r.c", true, .{}); | |
| 245 | // cases.addLibcTestCase("math/llrint.c", true, .{}); | |
| 246 | // cases.addLibcTestCase("math/llrintf.c", true, .{}); | |
| 247 | // cases.addLibcTestCase("math/llrintl.c", true, .{}); | |
| 248 | // cases.addLibcTestCase("math/llround.c", true, .{}); | |
| 249 | // cases.addLibcTestCase("math/llroundf.c", true, .{}); | |
| 250 | // cases.addLibcTestCase("math/llroundl.c", true, .{}); | |
| 251 | cases.addLibcTestCase("math/log.c", true, .{}); | |
| 252 | cases.addLibcTestCase("math/log10.c", true, .{}); | |
| 253 | cases.addLibcTestCase("math/log10f.c", true, .{}); | |
| 254 | cases.addLibcTestCase("math/log10l.c", true, .{}); | |
| 255 | // cases.addLibcTestCase("math/log1p.c", true, .{}); | |
| 256 | // cases.addLibcTestCase("math/log1pf.c", true, .{}); | |
| 257 | // cases.addLibcTestCase("math/log1pl.c", true, .{}); | |
| 258 | cases.addLibcTestCase("math/log2.c", true, .{}); | |
| 259 | cases.addLibcTestCase("math/log2f.c", true, .{}); | |
| 260 | cases.addLibcTestCase("math/log2l.c", true, .{}); | |
| 261 | cases.addLibcTestCase("math/logb.c", true, .{}); | |
| 262 | cases.addLibcTestCase("math/logbf.c", true, .{}); | |
| 263 | cases.addLibcTestCase("math/logbl.c", true, .{}); | |
| 264 | cases.addLibcTestCase("math/logf.c", true, .{}); | |
| 265 | cases.addLibcTestCase("math/logl.c", true, .{}); | |
| 266 | cases.addLibcTestCase("math/lrint.c", true, .{}); | |
| 267 | cases.addLibcTestCase("math/lrintf.c", true, .{}); | |
| 268 | cases.addLibcTestCase("math/lrintl.c", true, .{}); | |
| 269 | cases.addLibcTestCase("math/lround.c", true, .{}); | |
| 270 | cases.addLibcTestCase("math/lroundf.c", true, .{}); | |
| 271 | cases.addLibcTestCase("math/lroundl.c", true, .{}); | |
| 272 | cases.addLibcTestCase("math/modf.c", true, .{}); | |
| 273 | cases.addLibcTestCase("math/modff.c", true, .{}); | |
| 274 | cases.addLibcTestCase("math/modfl.c", true, .{}); | |
| 275 | // cases.addLibcTestCase("math/nearbyint.c", true, .{}); | |
| 276 | cases.addLibcTestCase("math/nearbyintf.c", true, .{}); | |
| 277 | // cases.addLibcTestCase("math/nearbyintl.c", true, .{}); | |
| 278 | cases.addLibcTestCase("math/nextafter.c", true, .{}); | |
| 279 | cases.addLibcTestCase("math/nextafterf.c", true, .{}); | |
| 280 | cases.addLibcTestCase("math/nextafterl.c", true, .{}); | |
| 281 | cases.addLibcTestCase("math/nexttoward.c", true, .{}); | |
| 282 | cases.addLibcTestCase("math/nexttowardf.c", true, .{}); | |
| 283 | cases.addLibcTestCase("math/nexttowardl.c", true, .{}); | |
| 284 | // cases.addLibcTestCase("math/pow.c", true, .{}); | |
| 285 | cases.addLibcTestCase("math/pow10.c", true, .{}); | |
| 286 | cases.addLibcTestCase("math/pow10f.c", true, .{}); | |
| 287 | cases.addLibcTestCase("math/pow10l.c", true, .{}); | |
| 288 | // cases.addLibcTestCase("math/powf.c", true, .{}); | |
| 289 | // cases.addLibcTestCase("math/powl.c", true, .{}); | |
| 290 | cases.addLibcTestCase("math/remainder.c", true, .{}); | |
| 291 | cases.addLibcTestCase("math/remainderf.c", true, .{}); | |
| 292 | cases.addLibcTestCase("math/remainderl.c", true, .{}); | |
| 293 | cases.addLibcTestCase("math/remquo.c", true, .{}); | |
| 294 | cases.addLibcTestCase("math/remquof.c", true, .{}); | |
| 295 | cases.addLibcTestCase("math/remquol.c", true, .{}); | |
| 296 | // cases.addLibcTestCase("math/rint.c", true, .{}); | |
| 297 | cases.addLibcTestCase("math/rintf.c", true, .{}); | |
| 298 | // cases.addLibcTestCase("math/rintl.c", true, .{}); | |
| 299 | // cases.addLibcTestCase("math/round.c", true, .{}); | |
| 300 | // cases.addLibcTestCase("math/roundf.c", true, .{}); | |
| 301 | // cases.addLibcTestCase("math/roundl.c", true, .{}); | |
| 302 | cases.addLibcTestCase("math/scalb.c", true, .{}); | |
| 303 | cases.addLibcTestCase("math/scalbf.c", true, .{}); | |
| 304 | cases.addLibcTestCase("math/scalbln.c", true, .{}); | |
| 305 | cases.addLibcTestCase("math/scalblnf.c", true, .{}); | |
| 306 | cases.addLibcTestCase("math/scalblnl.c", true, .{}); | |
| 307 | cases.addLibcTestCase("math/scalbn.c", true, .{}); | |
| 308 | cases.addLibcTestCase("math/scalbnf.c", true, .{}); | |
| 309 | cases.addLibcTestCase("math/scalbnl.c", true, .{}); | |
| 310 | cases.addLibcTestCase("math/sin.c", true, .{}); | |
| 311 | cases.addLibcTestCase("math/sincos.c", true, .{}); | |
| 312 | cases.addLibcTestCase("math/sincosf.c", true, .{}); | |
| 313 | cases.addLibcTestCase("math/sincosl.c", true, .{}); | |
| 314 | cases.addLibcTestCase("math/sinf.c", true, .{}); | |
| 315 | // cases.addLibcTestCase("math/sinh.c", true, .{}); | |
| 316 | cases.addLibcTestCase("math/sinhf.c", true, .{}); | |
| 317 | // cases.addLibcTestCase("math/sinhl.c", true, .{}); | |
| 318 | cases.addLibcTestCase("math/sinl.c", true, .{}); | |
| 319 | cases.addLibcTestCase("math/sqrt.c", true, .{}); | |
| 320 | cases.addLibcTestCase("math/sqrtf.c", true, .{}); | |
| 321 | cases.addLibcTestCase("math/sqrtl.c", true, .{}); | |
| 322 | cases.addLibcTestCase("math/tan.c", true, .{}); | |
| 323 | cases.addLibcTestCase("math/tanf.c", true, .{}); | |
| 324 | cases.addLibcTestCase("math/tanh.c", true, .{}); | |
| 325 | cases.addLibcTestCase("math/tanhf.c", true, .{}); | |
| 326 | cases.addLibcTestCase("math/tanhl.c", true, .{}); | |
| 327 | cases.addLibcTestCase("math/tanl.c", true, .{}); | |
| 328 | // cases.addLibcTestCase("math/tgamma.c", true, .{}); | |
| 329 | // cases.addLibcTestCase("math/tgammaf.c", true, .{}); | |
| 330 | // cases.addLibcTestCase("math/tgammal.c", true, .{}); | |
| 331 | cases.addLibcTestCase("math/trunc.c", true, .{}); | |
| 332 | cases.addLibcTestCase("math/truncf.c", true, .{}); | |
| 333 | cases.addLibcTestCase("math/truncl.c", true, .{}); | |
| 334 | // cases.addLibcTestCase("math/y0.c", true, .{}); | |
| 335 | // cases.addLibcTestCase("math/y0f.c", true, .{}); | |
| 336 | // cases.addLibcTestCase("math/y1.c", true, .{}); | |
| 337 | // cases.addLibcTestCase("math/y1f.c", true, .{}); | |
| 338 | // cases.addLibcTestCase("math/yn.c", true, .{}); | |
| 339 | // cases.addLibcTestCase("math/ynf.c", true, .{}); | |
| 140 | 340 | } |
| 141 | 341 | |
| 142 | 342 | const std = @import("std"); |
test/src/Libc.zig+2-2| ... | ... | @@ -60,10 +60,10 @@ pub fn addTarget(libc: *const Libc, target: std.Build.ResolvedTarget) void { |
| 60 | 60 | .link_libc = true, |
| 61 | 61 | }); |
| 62 | 62 | |
| 63 | var libtest_c_source_files: []const []const u8 = &.{ "print.c", "rand.c", "setrlim.c", "memfill.c", "vmfill.c", "fdfill.c", "utf8.c" }; | |
| 63 | var libtest_c_source_files: []const []const u8 = &.{ "print.c", "rand.c", "mtest.c", "setrlim.c", "memfill.c", "vmfill.c", "fdfill.c", "utf8.c" }; | |
| 64 | 64 | libtest_mod.addCSourceFiles(.{ |
| 65 | 65 | .root = common, |
| 66 | .files = libtest_c_source_files[0..if (target.result.isMuslLibC()) 7 else 2], | |
| 66 | .files = libtest_c_source_files[0..if (target.result.isMuslLibC()) 8 else 3], | |
| 67 | 67 | .flags = &.{"-fno-builtin"}, |
| 68 | 68 | }); |
| 69 | 69 |
test/tests.zig+6-5| ... | ... | @@ -2873,11 +2873,12 @@ const libc_targets: []const std.Target.Query = &.{ |
| 2873 | 2873 | .os_tag = .linux, |
| 2874 | 2874 | .abi = .musl, |
| 2875 | 2875 | }, |
| 2876 | .{ | |
| 2877 | .cpu_arch = .loongarch64, | |
| 2878 | .os_tag = .linux, | |
| 2879 | .abi = .muslsf, | |
| 2880 | }, | |
| 2876 | // Macros like FE_INVALID are defined by musl, but they shouldn't. | |
| 2877 | // .{ | |
| 2878 | // .cpu_arch = .loongarch64, | |
| 2879 | // .os_tag = .linux, | |
| 2880 | // .abi = .muslsf, | |
| 2881 | // }, | |
| 2881 | 2882 | // .{ |
| 2882 | 2883 | // .cpu_arch = .mips, |
| 2883 | 2884 | // .os_tag = .linux, |