Skip to content

Commit

Permalink
testing imaginary parts for large inputs
Browse files Browse the repository at this point in the history
that overflow if squared
  • Loading branch information
Expander committed Oct 18, 2023
1 parent 4cc7be7 commit 473e978
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 16 deletions.
4 changes: 2 additions & 2 deletions tests/li.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,6 @@ fn test_values() {
// test value that causes overflow if squared
assert!(!Complex::new(1e300, 1.0).li(7).is_infinite());
assert!(!Complex::new(1.0, 1e300).li(7).is_infinite());
assert_eq_float!(Complex::new(1e300, 1.0).li(7).re, Complex::new(-1.4886831990993457e16, -4.74066248802866e14).re, 1e-15);
assert_eq_float!(Complex::new(1.0, 1e300).li(7).re, Complex::new(-1.489168315226607e16, 2.3705150998401e14).re, 1e-5);
assert_eq_complex!(Complex::new(1e300, 1.0).li(7), Complex::new(-1.4886831990993457e16, 4.74066248802866e14), 1e-15);
assert_eq_complex!(Complex::new(1.0, 1e300).li(7), Complex::new(-1.489168315226607e16, 2.3705150998401e14), 1e-5);
}
4 changes: 2 additions & 2 deletions tests/li0.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ fn test_values() {
// test value that causes overflow if squared
assert!(!Complex::new(1e300, 1.0).li0().is_infinite());
assert!(!Complex::new(1.0, 1e300).li0().is_infinite());
assert_eq_float!(Complex::new(1e300, 1.0).li0().re, -1.0, eps);
assert_eq_float!(Complex::new(1.0, 1e300).li0().re, -1.0, eps);
assert_eq_complex!(Complex::new(1e300, 1.0).li0(), Complex::new(-1.0, 0.0), eps);
assert_eq_complex!(Complex::new(1.0, 1e300).li0(), Complex::new(-1.0, 0.0), eps);
}
4 changes: 2 additions & 2 deletions tests/li1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ fn test_values() {
// test value that causes overflow if squared
assert!(!Complex::new(1e300, 1.0).li1().is_infinite());
assert!(!Complex::new(1.0, 1e300).li1().is_infinite());
assert_eq_float!(Complex::new(1e300, 1.0).li1().re, Complex::new(-690.77552789821371, -3.14159265358979).re, eps);
assert_eq_float!(Complex::new(1.0, 1e300).li1().re, Complex::new(-690.77552789821371, 1.5707963267948966).re, eps);
assert_eq_complex!(Complex::new(1e300, 1.0).li1(), Complex::new(-690.77552789821371, 3.14159265358979), eps);
assert_eq_complex!(Complex::new(1.0, 1e300).li1(), Complex::new(-690.77552789821371, 1.5707963267948966), eps);
}
4 changes: 2 additions & 2 deletions tests/li2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ fn special_values() {
// test value that causes overflow if squared
assert!(!Complex::new(1e300, 1.0).li2().is_infinite());
assert!(!Complex::new(1.0, 1e300).li2().is_infinite());
assert_eq_float!(Complex::new(1e300, 1.0).li2().re, Complex::new(-238582.12510339421, -2170.13532372464).re, eps);
assert_eq_float!(Complex::new(1.0, 1e300).li2().re, Complex::new(-238585.82620504462, 1085.06766186232).re, eps);
assert_eq_complex!(Complex::new(1e300, 1.0).li2(), Complex::new(-238582.12510339421, 2170.13532372464), eps);
assert_eq_complex!(Complex::new(1.0, 1e300).li2(), Complex::new(-238585.82620504462, 1085.06766186232), eps);
}


Expand Down
4 changes: 2 additions & 2 deletions tests/li3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ fn special_values() {
// test value that causes overflow if squared
assert!(!Complex::new(1e300, 1.0).li3().is_infinite());
assert!(!Complex::new(1.0, 1e300).li3().is_infinite());
assert_eq_float!(Complex::new(1e300, 1.0).li3().re, Complex::new(-5.4934049431527088e7, -749538.186928224).re, eps);
assert_eq_float!(Complex::new(1.0, 1e300).li3().re, Complex::new(-5.4936606061973454e7, 374771.031356405).re, eps);
assert_eq_complex!(Complex::new(1e300, 1.0).li3(), Complex::new(-5.4934049431527088e7, 749538.186928224), eps);
assert_eq_complex!(Complex::new(1.0, 1e300).li3(), Complex::new(-5.4936606061973454e7, 374771.031356405), eps);
}


Expand Down
4 changes: 2 additions & 2 deletions tests/li4.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ fn special_values() {
// test value that causes overflow if squared
assert!(!Complex::new(1e300, 1.0).li4().is_infinite());
assert!(!Complex::new(1.0, 1e300).li4().is_infinite());
assert_eq_float!(Complex::new(1e300, 1.0).li4().re, Complex::new(-9.4863817894708364e9, -1.725875455850714e8).re, eps);
assert_eq_float!(Complex::new(1.0, 1e300).li4().re, Complex::new(-9.4872648206269765e9, 8.62951114411071e7).re, eps);
assert_eq_complex!(Complex::new(1e300, 1.0).li4(), Complex::new(-9.4863817894708364e9, 1.725875455850714e8), eps);
assert_eq_complex!(Complex::new(1.0, 1e300).li4(), Complex::new(-9.4872648206269765e9, 8.62951114411071e7), eps);
}


Expand Down
4 changes: 2 additions & 2 deletions tests/li5.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ fn special_values() {
// test value that causes overflow if squared
assert!(!Complex::new(1e300, 1.0).li5().is_infinite());
assert!(!Complex::new(1.0, 1e300).li5().is_infinite());
assert_eq_float!(Complex::new(1e300, 1.0).li5().re, Complex::new(-1.3105197831948743e12, -2.980481322754618e10).re, eps);
assert_eq_float!(Complex::new(1.0, 1e300).li5().re, Complex::new(-1.31072310968392418e12, 1.490286896860219e10).re, eps);
assert_eq_complex!(Complex::new(1e300, 1.0).li5(), Complex::new(-1.3105197831948743e12, 2.980481322754618e10), eps);
assert_eq_complex!(Complex::new(1.0, 1e300).li5(), Complex::new(-1.31072310968392418e12, 1.490286896860219e10), eps);
}


Expand Down
4 changes: 2 additions & 2 deletions tests/li6.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ fn special_values() {
// test value that causes overflow if squared
assert!(!Complex::new(1e300, 1.0).li6().is_infinite());
assert!(!Complex::new(1.0, 1e300).li6().is_infinite());
assert_eq_float!(Complex::new(1e300, 1.0).li6().re, Complex::new(-1.5086876165613597e14, -4.11768711823317e12).re, eps);
assert_eq_float!(Complex::new(1.0, 1e300).li6().re, Complex::new(-1.5090387516918862e14, 2.0589500211678e12).re, eps);
assert_eq_complex!(Complex::new(1e300, 1.0).li6(), Complex::new(-1.5086876165613597e14, 4.11768711823317e12), 2.0*eps);
assert_eq_complex!(Complex::new(1.0, 1e300).li6(), Complex::new(-1.5090387516918862e14, 2.0589500211678e12), 2.0*eps);
}


Expand Down

0 comments on commit 473e978

Please sign in to comment.