| author | |
| committer | |
| log | 1d998d5dce73d8d500dee5e41a3dca92a7f9b03e |
| tree | 4fac84336118ea7cdc221f76be5c7ff3797d0cd9 |
| parent | d5e99cc05ea05d701adffce55defc512d75e10d1 |
16 files changed, 46 insertions(+), 112 deletions(-)
std/math/complex/acos.zig+2-5| ... | @@ -16,9 +16,6 @@ test "complex.cacos" { | ... | @@ -16,9 +16,6 @@ test "complex.cacos" { |
| 16 | const a = Complex(f32).new(5, 3); | 16 | const a = Complex(f32).new(5, 3); |
| 17 | const c = acos(a); | 17 | const c = acos(a); |
| 18 | 18 | ||
| 19 | const re = c.re; | 19 | debug.assert(math.approxEq(f32, c.re, 0.546975, epsilon)); |
| 20 | const im = c.im; | 20 | debug.assert(math.approxEq(f32, c.im, -2.452914, epsilon)); |
| 21 | |||
| 22 | debug.assert(math.approxEq(f32, re, 0.546975, epsilon)); | ||
| 23 | debug.assert(math.approxEq(f32, im, -2.452914, epsilon)); | ||
| 24 | } | 21 | } |
std/math/complex/acosh.zig+2-5| ... | @@ -16,9 +16,6 @@ test "complex.cacosh" { | ... | @@ -16,9 +16,6 @@ test "complex.cacosh" { |
| 16 | const a = Complex(f32).new(5, 3); | 16 | const a = Complex(f32).new(5, 3); |
| 17 | const c = acosh(a); | 17 | const c = acosh(a); |
| 18 | 18 | ||
| 19 | const re = c.re; | 19 | debug.assert(math.approxEq(f32, c.re, 2.452914, epsilon)); |
| 20 | const im = c.im; | 20 | debug.assert(math.approxEq(f32, c.im, 0.546975, epsilon)); |
| 21 | |||
| 22 | debug.assert(math.approxEq(f32, re, 2.452914, epsilon)); | ||
| 23 | debug.assert(math.approxEq(f32, im, 0.546975, epsilon)); | ||
| 24 | } | 21 | } |
std/math/complex/asin.zig+2-5| ... | @@ -22,9 +22,6 @@ test "complex.casin" { | ... | @@ -22,9 +22,6 @@ test "complex.casin" { |
| 22 | const a = Complex(f32).new(5, 3); | 22 | const a = Complex(f32).new(5, 3); |
| 23 | const c = asin(a); | 23 | const c = asin(a); |
| 24 | 24 | ||
| 25 | const re = c.re; | 25 | debug.assert(math.approxEq(f32, c.re, 1.023822, epsilon)); |
| 26 | const im = c.im; | 26 | debug.assert(math.approxEq(f32, c.im, 2.452914, epsilon)); |
| 27 | |||
| 28 | debug.assert(math.approxEq(f32, re, 1.023822, epsilon)); | ||
| 29 | debug.assert(math.approxEq(f32, im, 2.452914, epsilon)); | ||
| 30 | } | 27 | } |
std/math/complex/asinh.zig+2-5| ... | @@ -17,9 +17,6 @@ test "complex.casinh" { | ... | @@ -17,9 +17,6 @@ test "complex.casinh" { |
| 17 | const a = Complex(f32).new(5, 3); | 17 | const a = Complex(f32).new(5, 3); |
| 18 | const c = asinh(a); | 18 | const c = asinh(a); |
| 19 | 19 | ||
| 20 | const re = c.re; | 20 | debug.assert(math.approxEq(f32, c.re, 2.459831, epsilon)); |
| 21 | const im = c.im; | 21 | debug.assert(math.approxEq(f32, c.im, 0.533999, epsilon)); |
| 22 | |||
| 23 | debug.assert(math.approxEq(f32, re, 2.459831, epsilon)); | ||
| 24 | debug.assert(math.approxEq(f32, im, 0.533999, epsilon)); | ||
| 25 | } | 22 | } |
std/math/complex/atan.zig+6-12| ... | @@ -113,24 +113,18 @@ fn atan64(z: &const Complex(f64)) Complex(f64) { | ... | @@ -113,24 +113,18 @@ fn atan64(z: &const Complex(f64)) Complex(f64) { |
| 113 | 113 | ||
| 114 | const epsilon = 0.0001; | 114 | const epsilon = 0.0001; |
| 115 | 115 | ||
| 116 | test "complex.ctan32" { | 116 | test "complex.catan32" { |
| 117 | const a = Complex(f32).new(5, 3); | 117 | const a = Complex(f32).new(5, 3); |
| 118 | const c = atan(a); | 118 | const c = atan(a); |
| 119 | 119 | ||
| 120 | const re = c.re; | 120 | debug.assert(math.approxEq(f32, c.re, 1.423679, epsilon)); |
| 121 | const im = c.im; | 121 | debug.assert(math.approxEq(f32, c.im, 0.086569, epsilon)); |
| 122 | |||
| 123 | debug.assert(math.approxEq(f32, re, 1.423679, epsilon)); | ||
| 124 | debug.assert(math.approxEq(f32, im, 0.086569, epsilon)); | ||
| 125 | } | 122 | } |
| 126 | 123 | ||
| 127 | test "complex.ctan64" { | 124 | test "complex.catan64" { |
| 128 | const a = Complex(f64).new(5, 3); | 125 | const a = Complex(f64).new(5, 3); |
| 129 | const c = atan(a); | 126 | const c = atan(a); |
| 130 | 127 | ||
| 131 | const re = c.re; | 128 | debug.assert(math.approxEq(f64, c.re, 1.423679, epsilon)); |
| 132 | const im = c.im; | 129 | debug.assert(math.approxEq(f64, c.im, 0.086569, epsilon)); |
| 133 | |||
| 134 | debug.assert(math.approxEq(f64, re, 1.423679, epsilon)); | ||
| 135 | debug.assert(math.approxEq(f64, im, 0.086569, epsilon)); | ||
| 136 | } | 130 | } |
std/math/complex/atanh.zig+2-5| ... | @@ -17,9 +17,6 @@ test "complex.catanh" { | ... | @@ -17,9 +17,6 @@ test "complex.catanh" { |
| 17 | const a = Complex(f32).new(5, 3); | 17 | const a = Complex(f32).new(5, 3); |
| 18 | const c = atanh(a); | 18 | const c = atanh(a); |
| 19 | 19 | ||
| 20 | const re = c.re; | 20 | debug.assert(math.approxEq(f32, c.re, 0.146947, epsilon)); |
| 21 | const im = c.im; | 21 | debug.assert(math.approxEq(f32, c.im, 1.480870, epsilon)); |
| 22 | |||
| 23 | debug.assert(math.approxEq(f32, re, 0.146947, epsilon)); | ||
| 24 | debug.assert(math.approxEq(f32, im, 1.480870, epsilon)); | ||
| 25 | } | 22 | } |
std/math/complex/cos.zig+2-5| ... | @@ -16,9 +16,6 @@ test "complex.ccos" { | ... | @@ -16,9 +16,6 @@ test "complex.ccos" { |
| 16 | const a = Complex(f32).new(5, 3); | 16 | const a = Complex(f32).new(5, 3); |
| 17 | const c = cos(a); | 17 | const c = cos(a); |
| 18 | 18 | ||
| 19 | const re = c.re; | 19 | debug.assert(math.approxEq(f32, c.re, 2.855815, epsilon)); |
| 20 | const im = c.im; | 20 | debug.assert(math.approxEq(f32, c.im, 9.606383, epsilon)); |
| 21 | |||
| 22 | debug.assert(math.approxEq(f32, re, 2.855815, epsilon)); | ||
| 23 | debug.assert(math.approxEq(f32, im, 9.606383, epsilon)); | ||
| 24 | } | 21 | } |
std/math/complex/cosh.zig+4-10| ... | @@ -152,20 +152,14 @@ test "complex.ccosh32" { | ... | @@ -152,20 +152,14 @@ test "complex.ccosh32" { |
| 152 | const a = Complex(f32).new(5, 3); | 152 | const a = Complex(f32).new(5, 3); |
| 153 | const c = cosh(a); | 153 | const c = cosh(a); |
| 154 | 154 | ||
| 155 | const re = c.re; | 155 | debug.assert(math.approxEq(f32, c.re, -73.467300, epsilon)); |
| 156 | const im = c.im; | 156 | debug.assert(math.approxEq(f32, c.im, 10.471557, epsilon)); |
| 157 | |||
| 158 | debug.assert(math.approxEq(f32, re, -73.467300, epsilon)); | ||
| 159 | debug.assert(math.approxEq(f32, im, 10.471557, epsilon)); | ||
| 160 | } | 157 | } |
| 161 | 158 | ||
| 162 | test "complex.ccosh64" { | 159 | test "complex.ccosh64" { |
| 163 | const a = Complex(f64).new(5, 3); | 160 | const a = Complex(f64).new(5, 3); |
| 164 | const c = cosh(a); | 161 | const c = cosh(a); |
| 165 | 162 | ||
| 166 | const re = c.re; | 163 | debug.assert(math.approxEq(f64, c.re, -73.467300, epsilon)); |
| 167 | const im = c.im; | 164 | debug.assert(math.approxEq(f64, c.im, 10.471557, epsilon)); |
| 168 | |||
| 169 | debug.assert(math.approxEq(f64, re, -73.467300, epsilon)); | ||
| 170 | debug.assert(math.approxEq(f64, im, 10.471557, epsilon)); | ||
| 171 | } | 165 | } |
std/math/complex/exp.zig+4-10| ... | @@ -127,20 +127,14 @@ test "complex.cexp32" { | ... | @@ -127,20 +127,14 @@ test "complex.cexp32" { |
| 127 | const a = Complex(f32).new(5, 3); | 127 | const a = Complex(f32).new(5, 3); |
| 128 | const c = exp(a); | 128 | const c = exp(a); |
| 129 | 129 | ||
| 130 | const re = c.re; | 130 | debug.assert(math.approxEq(f32, c.re, -146.927917, epsilon)); |
| 131 | const im = c.im; | 131 | debug.assert(math.approxEq(f32, c.im, 20.944065, epsilon)); |
| 132 | |||
| 133 | debug.assert(math.approxEq(f32, re, -146.927917, epsilon)); | ||
| 134 | debug.assert(math.approxEq(f32, im, 20.944065, epsilon)); | ||
| 135 | } | 132 | } |
| 136 | 133 | ||
| 137 | test "complex.cexp64" { | 134 | test "complex.cexp64" { |
| 138 | const a = Complex(f32).new(5, 3); | 135 | const a = Complex(f32).new(5, 3); |
| 139 | const c = exp(a); | 136 | const c = exp(a); |
| 140 | 137 | ||
| 141 | const re = c.re; | 138 | debug.assert(math.approxEq(f64, c.re, -146.927917, epsilon)); |
| 142 | const im = c.im; | 139 | debug.assert(math.approxEq(f64, c.im, 20.944065, epsilon)); |
| 143 | |||
| 144 | debug.assert(math.approxEq(f64, re, -146.927917, epsilon)); | ||
| 145 | debug.assert(math.approxEq(f64, im, 20.944065, epsilon)); | ||
| 146 | } | 140 | } |
std/math/complex/log.zig+2-5| ... | @@ -18,9 +18,6 @@ test "complex.clog" { | ... | @@ -18,9 +18,6 @@ test "complex.clog" { |
| 18 | const a = Complex(f32).new(5, 3); | 18 | const a = Complex(f32).new(5, 3); |
| 19 | const c = log(a); | 19 | const c = log(a); |
| 20 | 20 | ||
| 21 | const re = c.re; | 21 | debug.assert(math.approxEq(f32, c.re, 1.763180, epsilon)); |
| 22 | const im = c.im; | 22 | debug.assert(math.approxEq(f32, c.im, 0.540419, epsilon)); |
| 23 | |||
| 24 | debug.assert(math.approxEq(f32, re, 1.763180, epsilon)); | ||
| 25 | debug.assert(math.approxEq(f32, im, 0.540419, epsilon)); | ||
| 26 | } | 23 | } |
std/math/complex/pow.zig+2-5| ... | @@ -17,9 +17,6 @@ test "complex.cpow" { | ... | @@ -17,9 +17,6 @@ test "complex.cpow" { |
| 17 | const b = Complex(f32).new(2.3, -1.3); | 17 | const b = Complex(f32).new(2.3, -1.3); |
| 18 | const c = pow(Complex(f32), a, b); | 18 | const c = pow(Complex(f32), a, b); |
| 19 | 19 | ||
| 20 | const re = c.re; | 20 | debug.assert(math.approxEq(f32, c.re, 58.049110, epsilon)); |
| 21 | const im = c.im; | 21 | debug.assert(math.approxEq(f32, c.im, -101.003433, epsilon)); |
| 22 | |||
| 23 | debug.assert(math.approxEq(f32, re, 58.049110, epsilon)); | ||
| 24 | debug.assert(math.approxEq(f32, im, -101.003433, epsilon)); | ||
| 25 | } | 22 | } |
std/math/complex/sin.zig+2-5| ... | @@ -17,9 +17,6 @@ test "complex.csin" { | ... | @@ -17,9 +17,6 @@ test "complex.csin" { |
| 17 | const a = Complex(f32).new(5, 3); | 17 | const a = Complex(f32).new(5, 3); |
| 18 | const c = sin(a); | 18 | const c = sin(a); |
| 19 | 19 | ||
| 20 | const re = c.re; | 20 | debug.assert(math.approxEq(f32, c.re, -9.654126, epsilon)); |
| 21 | const im = c.im; | 21 | debug.assert(math.approxEq(f32, c.im, 2.841692, epsilon)); |
| 22 | |||
| 23 | debug.assert(math.approxEq(f32, re, -9.654126, epsilon)); | ||
| 24 | debug.assert(math.approxEq(f32, im, 2.841692, epsilon)); | ||
| 25 | } | 22 | } |
std/math/complex/sinh.zig+4-10| ... | @@ -151,20 +151,14 @@ test "complex.csinh32" { | ... | @@ -151,20 +151,14 @@ test "complex.csinh32" { |
| 151 | const a = Complex(f32).new(5, 3); | 151 | const a = Complex(f32).new(5, 3); |
| 152 | const c = sinh(a); | 152 | const c = sinh(a); |
| 153 | 153 | ||
| 154 | const re = c.re; | 154 | debug.assert(math.approxEq(f32, c.re, -73.460617, epsilon)); |
| 155 | const im = c.im; | 155 | debug.assert(math.approxEq(f32, c.im, 10.472508, epsilon)); |
| 156 | |||
| 157 | debug.assert(math.approxEq(f32, re, -73.460617, epsilon)); | ||
| 158 | debug.assert(math.approxEq(f32, im, 10.472508, epsilon)); | ||
| 159 | } | 156 | } |
| 160 | 157 | ||
| 161 | test "complex.csinh64" { | 158 | test "complex.csinh64" { |
| 162 | const a = Complex(f64).new(5, 3); | 159 | const a = Complex(f64).new(5, 3); |
| 163 | const c = sinh(a); | 160 | const c = sinh(a); |
| 164 | 161 | ||
| 165 | const re = c.re; | 162 | debug.assert(math.approxEq(f64, c.re, -73.460617, epsilon)); |
| 166 | const im = c.im; | 163 | debug.assert(math.approxEq(f64, c.im, 10.472508, epsilon)); |
| 167 | |||
| 168 | debug.assert(math.approxEq(f64, re, -73.460617, epsilon)); | ||
| 169 | debug.assert(math.approxEq(f64, im, 10.472508, epsilon)); | ||
| 170 | } | 164 | } |
std/math/complex/sqrt.zig+4-10| ... | @@ -121,20 +121,14 @@ test "complex.csqrt32" { | ... | @@ -121,20 +121,14 @@ test "complex.csqrt32" { |
| 121 | const a = Complex(f32).new(5, 3); | 121 | const a = Complex(f32).new(5, 3); |
| 122 | const c = sqrt(a); | 122 | const c = sqrt(a); |
| 123 | 123 | ||
| 124 | const re = c.re; | 124 | debug.assert(math.approxEq(f32, c.re, 2.327117, epsilon)); |
| 125 | const im = c.im; | 125 | debug.assert(math.approxEq(f32, c.im, 0.644574, epsilon)); |
| 126 | |||
| 127 | debug.assert(math.approxEq(f32, re, 2.327117, epsilon)); | ||
| 128 | debug.assert(math.approxEq(f32, im, 0.644574, epsilon)); | ||
| 129 | } | 126 | } |
| 130 | 127 | ||
| 131 | test "complex.csqrt64" { | 128 | test "complex.csqrt64" { |
| 132 | const a = Complex(f64).new(5, 3); | 129 | const a = Complex(f64).new(5, 3); |
| 133 | const c = sqrt(a); | 130 | const c = sqrt(a); |
| 134 | 131 | ||
| 135 | const re = c.re; | 132 | debug.assert(math.approxEq(f64, c.re, 2.3271175190399496, epsilon)); |
| 136 | const im = c.im; | 133 | debug.assert(math.approxEq(f64, c.im, 0.6445742373246469, epsilon)); |
| 137 | |||
| 138 | debug.assert(math.approxEq(f64, re, 2.3271175190399496, epsilon)); | ||
| 139 | debug.assert(math.approxEq(f64, im, 0.6445742373246469, epsilon)); | ||
| 140 | } | 134 | } |
std/math/complex/tan.zig+2-5| ... | @@ -17,9 +17,6 @@ test "complex.ctan" { | ... | @@ -17,9 +17,6 @@ test "complex.ctan" { |
| 17 | const a = Complex(f32).new(5, 3); | 17 | const a = Complex(f32).new(5, 3); |
| 18 | const c = tan(a); | 18 | const c = tan(a); |
| 19 | 19 | ||
| 20 | const re = c.re; | 20 | debug.assert(math.approxEq(f32, c.re, -0.002708233, epsilon)); |
| 21 | const im = c.im; | 21 | debug.assert(math.approxEq(f32, c.im, 1.004165, epsilon)); |
| 22 | |||
| 23 | debug.assert(math.approxEq(f32, re, -0.002708233, epsilon)); | ||
| 24 | debug.assert(math.approxEq(f32, im, 1.004165, epsilon)); | ||
| 25 | } | 22 | } |
std/math/complex/tanh.zig+4-10| ... | @@ -98,20 +98,14 @@ test "complex.ctanh32" { | ... | @@ -98,20 +98,14 @@ test "complex.ctanh32" { |
| 98 | const a = Complex(f32).new(5, 3); | 98 | const a = Complex(f32).new(5, 3); |
| 99 | const c = tanh(a); | 99 | const c = tanh(a); |
| 100 | 100 | ||
| 101 | const re = c.re; | 101 | debug.assert(math.approxEq(f32, c.re, 0.999913, epsilon)); |
| 102 | const im = c.im; | 102 | debug.assert(math.approxEq(f32, c.im, -0.000025, epsilon)); |
| 103 | |||
| 104 | debug.assert(math.approxEq(f32, re, 0.999913, epsilon)); | ||
| 105 | debug.assert(math.approxEq(f32, im, -0.000025, epsilon)); | ||
| 106 | } | 103 | } |
| 107 | 104 | ||
| 108 | test "complex.ctanh64" { | 105 | test "complex.ctanh64" { |
| 109 | const a = Complex(f64).new(5, 3); | 106 | const a = Complex(f64).new(5, 3); |
| 110 | const c = tanh(a); | 107 | const c = tanh(a); |
| 111 | 108 | ||
| 112 | const re = c.re; | 109 | debug.assert(math.approxEq(f64, c.re, 0.999913, epsilon)); |
| 113 | const im = c.im; | 110 | debug.assert(math.approxEq(f64, c.im, -0.000025, epsilon)); |
| 114 | |||
| 115 | debug.assert(math.approxEq(f64, re, 0.999913, epsilon)); | ||
| 116 | debug.assert(math.approxEq(f64, im, -0.000025, epsilon)); | ||
| 117 | } | 111 | } |