aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2018-04-09 18:02:59 -0500
committerTimo Teräs <timo.teras@iki.fi>2018-04-10 05:46:09 +0000
commitcbd6d5b76a903b24dc51fe354c0c8265f3f1a9a3 (patch)
treee1b363470a8c17117fbc2f9368cf81b7c57698bb
parent28adcc77cdfce3c541ca057e10288d4fadf46f9e (diff)
downloadaports-cbd6d5b76a903b24dc51fe354c0c8265f3f1a9a3.tar.bz2
aports-cbd6d5b76a903b24dc51fe354c0c8265f3f1a9a3.tar.xz
main/musl: fix complex math functions
-rw-r--r--main/musl/APKBUILD4
-rw-r--r--main/musl/complex-math.patch59
2 files changed, 62 insertions, 1 deletions
diff --git a/main/musl/APKBUILD b/main/musl/APKBUILD
index 8ecd2eb6e0..5f13e496a8 100644
--- a/main/musl/APKBUILD
+++ b/main/musl/APKBUILD
@@ -2,7 +2,7 @@
# Maintainer: Timo Teräs <timo.teras@iki.fi>
pkgname=musl
pkgver=1.1.19
-pkgrel=4
+pkgrel=5
pkgdesc="the musl c library (libc) implementation"
url="http://www.musl-libc.org/"
arch="all"
@@ -22,6 +22,7 @@ source="http://www.musl-libc.org/releases/musl-$pkgver.tar.gz
1000-cloudflare-stupidity.patch
2000-pthread-internals-increase-DEFAULT_GUARD_SIZE-to-2-p.patch
+ complex-math.patch
handle-aux-at_base.patch
ldconfig
@@ -151,6 +152,7 @@ sha512sums="abee52d53af4b3c14c9088866c911a24d2b6ef67dc494f38a7a09dfe77250026f775
1c649ebd4814ee22364d8766fdf93732e0c0c54361fcfcc994be254b52e9beb276fca5031a1cef9d4f971c96dc3d3774a1738ba3a38263d8e139ea3947c9b7c3 0002-fix-nl_langinfo_l-CODESET-loc-reporting-wrong-locale.patch
26465058345bcb0d8f5ebd4645b43b2cb3dec26ac55f8cb97a13961f28046fe04bd68e48ba585cc3c036ba75e3cabadf096595e71d1c8c9ec0fb69ebc8340cf5 1000-cloudflare-stupidity.patch
2c8e1dde1834238097b2ee8a7bfb53471a0d9cff4a5e38b55f048b567deff1cdd47c170d0578a67b1a039f95a6c5fbb8cff369c75b6a3e4d7ed171e8e86ebb8c 2000-pthread-internals-increase-DEFAULT_GUARD_SIZE-to-2-p.patch
+8909dc260968770ace8f3ffdc04c6c7d20933ff115b4fa3e512fb7460860a8216c73ca7a7ad54f59cb5988ef011f02bf18aa13cc2287cc64ffdb8db84ef69d47 complex-math.patch
6a7ff16d95b5d1be77e0a0fbb245491817db192176496a57b22ab037637d97a185ea0b0d19da687da66c2a2f5578e4343d230f399d49fe377d8f008410974238 handle-aux-at_base.patch
8d3a2d5315fc56fee7da9abb8b89bb38c6046c33d154c10d168fb35bfde6b0cf9f13042a3bceee34daf091bc409d699223735dcf19f382eeee1f6be34154f26f ldconfig
062bb49fa54839010acd4af113e20f7263dde1c8a2ca359b5fb2661ef9ed9d84a0f7c3bc10c25dcfa10bb3c5a4874588dff636ac43d5dbb3d748d75400756d0b __stack_chk_fail_local.c
diff --git a/main/musl/complex-math.patch b/main/musl/complex-math.patch
new file mode 100644
index 0000000000..fff4b59c17
--- /dev/null
+++ b/main/musl/complex-math.patch
@@ -0,0 +1,59 @@
+From ae2a01da2e388535da243b3d974aef74a3c06ae0 Mon Sep 17 00:00:00 2001
+From: Rich Felker <dalias@aerifal.cx>
+Date: Mon, 9 Apr 2018 12:33:17 -0400
+Subject: fix wrong result in casin and many related complex functions
+
+the factor of -i noted in the comment at the top of casin.c was
+omitted from the actual code, yielding a result rotated 90 degrees and
+propagating into errors in other functions defined in terms of casin.
+
+implement multiplication by -i as a rotation of the real and imaginary
+parts of the result, rather than by actual multiplication, since the
+latter cannot be optimized without knowledge that the operand is
+finite. here, the rotation is the actual intent, anyway.
+---
+ src/complex/casin.c | 3 ++-
+ src/complex/casinf.c | 3 ++-
+ src/complex/casinl.c | 3 ++-
+ 3 files changed, 6 insertions(+), 3 deletions(-)
+
+diff --git a/src/complex/casin.c b/src/complex/casin.c
+index dfdda98..01ed618 100644
+--- a/src/complex/casin.c
++++ b/src/complex/casin.c
+@@ -12,5 +12,6 @@ double complex casin(double complex z)
+ x = creal(z);
+ y = cimag(z);
+ w = CMPLX(1.0 - (x - y)*(x + y), -2.0*x*y);
+- return clog(CMPLX(-y, x) + csqrt(w));
++ double complex r = clog(CMPLX(-y, x) + csqrt(w));
++ return CMPLX(cimag(r), -creal(r));
+ }
+diff --git a/src/complex/casinf.c b/src/complex/casinf.c
+index 93f0e33..4fcb76f 100644
+--- a/src/complex/casinf.c
++++ b/src/complex/casinf.c
+@@ -10,5 +10,6 @@ float complex casinf(float complex z)
+ x = crealf(z);
+ y = cimagf(z);
+ w = CMPLXF(1.0 - (x - y)*(x + y), -2.0*x*y);
+- return clogf(CMPLXF(-y, x) + csqrtf(w));
++ float complex r = clogf(CMPLXF(-y, x) + csqrtf(w));
++ return CMPLXF(cimagf(r), -crealf(r));
+ }
+diff --git a/src/complex/casinl.c b/src/complex/casinl.c
+index 0916c60..3b7ceba 100644
+--- a/src/complex/casinl.c
++++ b/src/complex/casinl.c
+@@ -15,6 +15,7 @@ long double complex casinl(long double complex z)
+ x = creall(z);
+ y = cimagl(z);
+ w = CMPLXL(1.0 - (x - y)*(x + y), -2.0*x*y);
+- return clogl(CMPLXL(-y, x) + csqrtl(w));
++ long double complex r = clogl(CMPLXL(-y, x) + csqrtl(w));
++ return CMPLXL(cimagl(r), -creall(r));
+ }
+ #endif
+--
+cgit v0.11.2
+