shithub: mc

Download patch

ref: 90d9a10c0234f5868c2e86882aae72fc931d53fd
parent: ed2bcb605e43881ebe854040f1e3e6f918ed9b26
author: S. Gilles <sgilles@math.umd.edu>
date: Sun Jul 22 23:29:36 EDT 2018

Handle awkward special cases in tan/cot32.

--- a/lib/math/tan-impl.myr
+++ b/lib/math/tan-impl.myr
@@ -334,6 +334,11 @@
 ]
 
 const tan32 = {x : flt32
+	/* A rather irritating special rounding case */
+	if std.flt32bits(x) == 0xdffd33a4
+		-> std.flt32frombits(0xbfd06c8c)
+	;;
+
 	var r, s
 	(r, s) = tanorcot((x : flt64), true)
 	-> round_down(r, s)
@@ -340,6 +345,13 @@
 }
 
 const cot32 = {x : flt32
+	/* Two more irritating special cases */
+	if std.flt32bits(x) == 0x33de86a9
+		-> std.flt32frombits(0x4b134133)
+	elif std.flt32bits(x) == 0xb3de86a9
+		-> std.flt32frombits(0xcb134133)
+	;;
+
 	var r, s
 	(r, s) = tanorcot((x : flt64), false)
 	-> round_down(r, s)