hare

[hare] The Hare programming language
git clone https://git.torresjrjr.com/hare.git
Log | Files | Refs | README | LICENSE

commit 6297b8d4b472e662b9a650d2a77f56ed0d166d6f
parent 6bc42d1dba8c0bee89c27d8325a7ec58a2797e67
Author: Carlos Une <une@fastmail.fm>
Date:   Sat, 13 May 2023 23:54:07 -0300

math::complex::tan: test huge arguments

Signed-off-by: Carlos Une <une@fastmail.fm>

Diffstat:
Mmath/complex/+test.ha | 18++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/math/complex/+test.ha b/math/complex/+test.ha @@ -345,12 +345,12 @@ const TEST_HUGEIN: []c128 = [ ((1 << 29): u64: f64, 0f64), ((1 << 30): u64: f64, 0f64), ((1 << 35): u64: f64, 0f64), - ((-1 << 120): u64: f64, 0f64), - ((1 << 240): u64: f64, 0f64), - ((1 << 300): u64: f64, 0f64), - ((-1 << 480): u64: f64, 0f64), - ((1234567891234567 << 180): u64: f64, 0f64), - ((-1234567891234567 << 300): u64: f64, 0f64), + (-1.329227995784916e+36, 0f64), + (1.7668470647783843e+72, 0f64), + (2.037035976334486e+90, 0f64), + (-3.1217485503159922e+144, 0f64), + (1.8919697882131776e+69, 0f64), + (-2.514859209672214e+105, 0f64), ]; // Results for TEST_TANHUGE[i] calculated with https://github.com/robpike/ivy @@ -1419,3 +1419,9 @@ fn isexact(x: f64) bool = || calike(v.0, (-v.0.0, -v.0.1))); }; }; + +@test fn tanhuge() void = { + for (let i = 0z; i < len(TEST_HUGEIN); i += 1) { + assert(csoclose(TEST_TANHUGE[i], tanc128(TEST_HUGEIN[i]), 1e-15)); + }; +};