summaryrefslogtreecommitdiff
path: root/lib/math
diff options
context:
space:
mode:
authorS. Gilles <sgilles@math.umd.edu>2018-06-28 10:33:47 -0400
committerS. Gilles <sgilles@math.umd.edu>2018-06-28 10:33:47 -0400
commitbc7b9cf7c49595c758d68c30ee1179740e269121 (patch)
tree4db8f3d2593c3732a9a3e5e854f86865523e5a00 /lib/math
parentf6e3a00fc29a7770b39c1ad51e4cfbff305bda38 (diff)
downloadmc-bc7b9cf7c49595c758d68c30ee1179740e269121.tar.gz
Fix pi/2 constants.
Diffstat (limited to 'lib/math')
-rw-r--r--lib/math/ancillary/pi-constants.c4
-rw-r--r--lib/math/sin-impl.myr6
2 files changed, 5 insertions, 5 deletions
diff --git a/lib/math/ancillary/pi-constants.c b/lib/math/ancillary/pi-constants.c
index 71d22f9..db90042 100644
--- a/lib/math/ancillary/pi-constants.c
+++ b/lib/math/ancillary/pi-constants.c
@@ -48,9 +48,10 @@ int main(void)
printf("\n");
printf("1000 bits of pi/2:\n");
+ mpfr_const_pi(pi, MPFR_RNDN);
+ mpfr_div_si(pi, pi, 2, MPFR_RNDN);
for (int bits_obtained = 0; bits_obtained < 1000; bits_obtained += 53) {
- mpfr_div_si(pi, pi, 2, MPFR_RNDN);
d = mpfr_get_d(pi, MPFR_RNDN);
u = FLT64_TO_UINT64(d);
printf("%#018lx\n", u);
@@ -66,7 +67,6 @@ int main(void)
d = mpfr_get_d(pi, MPFR_RNDN);
u = FLT64_TO_UINT64(d);
printf("%#018lx\n", u);
-
printf("\n");
printf("Pre-computed 1/(pi/1024):\n");
mpfr_const_pi(pi, MPFR_RNDN);
diff --git a/lib/math/sin-impl.myr b/lib/math/sin-impl.myr
index 91ace69..f9feb97 100644
--- a/lib/math/sin-impl.myr
+++ b/lib/math/sin-impl.myr
@@ -53,9 +53,9 @@ const twentysix_bits_mask = (0xffffffffffffffff << 27)
/* Pi/2 in lots of detail, for range reducing sin(2^18) or so */
const pi_over_2 : uint64[4] = [
0x3ff921fb54442d18,
- 0x3c81a62633145c07,
- 0xb8ff1976b7ed8fbc,
- 0x3584cf98e804177d,
+ 0x3c91a62633145c07,
+ 0xb91f1976b7ed8fbc,
+ 0x35b4cf98e804177d,
]
/* Pre-computed inverses */