summaryrefslogtreecommitdiff
path: root/lib/math
diff options
context:
space:
mode:
authorS. Gilles <sgilles@math.umd.edu>2018-07-23 03:29:36 -0400
committerS. Gilles <sgilles@math.umd.edu>2018-07-23 03:29:36 -0400
commit90d9a10c0234f5868c2e86882aae72fc931d53fd (patch)
treef66a4e36f49ae308825235592d52a43e96e72426 /lib/math
parented2bcb605e43881ebe854040f1e3e6f918ed9b26 (diff)
downloadmc-90d9a10c0234f5868c2e86882aae72fc931d53fd.tar.gz
Handle awkward special cases in tan/cot32.
Diffstat (limited to 'lib/math')
-rw-r--r--lib/math/tan-impl.myr12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/math/tan-impl.myr b/lib/math/tan-impl.myr
index 63897f1..adbc0ff 100644
--- a/lib/math/tan-impl.myr
+++ b/lib/math/tan-impl.myr
@@ -334,12 +334,24 @@ const C : (uint64, uint64, uint64)[257] = [
]
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)
}
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)