diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2019-02-09 18:57:39 -0500 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2019-02-09 18:57:39 -0500 |
| commit | 1864acd32608ae917f8afc11b11f08a4bb362cef (patch) | |
| tree | d96b50a927fc67583d88c71822513594609621fb /std/math/complex | |
| parent | 48c1e235cb620dacc30254d0898390b4d97f3e73 (diff) | |
| parent | ca8580ece1ab07215b72394cc4ab3030bf9df139 (diff) | |
| download | zig-1864acd32608ae917f8afc11b11f08a4bb362cef.tar.gz zig-1864acd32608ae917f8afc11b11f08a4bb362cef.zip | |
Merge remote-tracking branch 'origin/master' into llvm8
Diffstat (limited to 'std/math/complex')
| -rw-r--r-- | std/math/complex/abs.zig | 4 | ||||
| -rw-r--r-- | std/math/complex/acos.zig | 6 | ||||
| -rw-r--r-- | std/math/complex/acosh.zig | 6 | ||||
| -rw-r--r-- | std/math/complex/arg.zig | 4 | ||||
| -rw-r--r-- | std/math/complex/asin.zig | 6 | ||||
| -rw-r--r-- | std/math/complex/asinh.zig | 6 | ||||
| -rw-r--r-- | std/math/complex/atan.zig | 10 | ||||
| -rw-r--r-- | std/math/complex/atanh.zig | 6 | ||||
| -rw-r--r-- | std/math/complex/conj.zig | 4 | ||||
| -rw-r--r-- | std/math/complex/cos.zig | 6 | ||||
| -rw-r--r-- | std/math/complex/cosh.zig | 10 | ||||
| -rw-r--r-- | std/math/complex/exp.zig | 10 | ||||
| -rw-r--r-- | std/math/complex/index.zig | 16 | ||||
| -rw-r--r-- | std/math/complex/log.zig | 6 | ||||
| -rw-r--r-- | std/math/complex/pow.zig | 6 | ||||
| -rw-r--r-- | std/math/complex/proj.zig | 4 | ||||
| -rw-r--r-- | std/math/complex/sin.zig | 6 | ||||
| -rw-r--r-- | std/math/complex/sinh.zig | 10 | ||||
| -rw-r--r-- | std/math/complex/sqrt.zig | 10 | ||||
| -rw-r--r-- | std/math/complex/tan.zig | 6 | ||||
| -rw-r--r-- | std/math/complex/tanh.zig | 10 |
21 files changed, 76 insertions, 76 deletions
diff --git a/std/math/complex/abs.zig b/std/math/complex/abs.zig index 4cd095c46b..245d67d4c5 100644 --- a/std/math/complex/abs.zig +++ b/std/math/complex/abs.zig @@ -1,5 +1,5 @@ const std = @import("../../index.zig"); -const debug = std.debug; +const testing = std.testing; const math = std.math; const cmath = math.complex; const Complex = cmath.Complex; @@ -14,5 +14,5 @@ const epsilon = 0.0001; test "complex.cabs" { const a = Complex(f32).new(5, 3); const c = abs(a); - debug.assert(math.approxEq(f32, c, 5.83095, epsilon)); + testing.expect(math.approxEq(f32, c, 5.83095, epsilon)); } diff --git a/std/math/complex/acos.zig b/std/math/complex/acos.zig index a5760b4ace..1b314bc31a 100644 --- a/std/math/complex/acos.zig +++ b/std/math/complex/acos.zig @@ -1,5 +1,5 @@ const std = @import("../../index.zig"); -const debug = std.debug; +const testing = std.testing; const math = std.math; const cmath = math.complex; const Complex = cmath.Complex; @@ -16,6 +16,6 @@ test "complex.cacos" { const a = Complex(f32).new(5, 3); const c = acos(a); - debug.assert(math.approxEq(f32, c.re, 0.546975, epsilon)); - debug.assert(math.approxEq(f32, c.im, -2.452914, epsilon)); + testing.expect(math.approxEq(f32, c.re, 0.546975, epsilon)); + testing.expect(math.approxEq(f32, c.im, -2.452914, epsilon)); } diff --git a/std/math/complex/acosh.zig b/std/math/complex/acosh.zig index 8dd91b2836..0e4c0121f4 100644 --- a/std/math/complex/acosh.zig +++ b/std/math/complex/acosh.zig @@ -1,5 +1,5 @@ const std = @import("../../index.zig"); -const debug = std.debug; +const testing = std.testing; const math = std.math; const cmath = math.complex; const Complex = cmath.Complex; @@ -16,6 +16,6 @@ test "complex.cacosh" { const a = Complex(f32).new(5, 3); const c = acosh(a); - debug.assert(math.approxEq(f32, c.re, 2.452914, epsilon)); - debug.assert(math.approxEq(f32, c.im, 0.546975, epsilon)); + testing.expect(math.approxEq(f32, c.re, 2.452914, epsilon)); + testing.expect(math.approxEq(f32, c.im, 0.546975, epsilon)); } diff --git a/std/math/complex/arg.zig b/std/math/complex/arg.zig index f24512ac73..be117a5940 100644 --- a/std/math/complex/arg.zig +++ b/std/math/complex/arg.zig @@ -1,5 +1,5 @@ const std = @import("../../index.zig"); -const debug = std.debug; +const testing = std.testing; const math = std.math; const cmath = math.complex; const Complex = cmath.Complex; @@ -14,5 +14,5 @@ const epsilon = 0.0001; test "complex.carg" { const a = Complex(f32).new(5, 3); const c = arg(a); - debug.assert(math.approxEq(f32, c, 0.540420, epsilon)); + testing.expect(math.approxEq(f32, c, 0.540420, epsilon)); } diff --git a/std/math/complex/asin.zig b/std/math/complex/asin.zig index 584a3a1a9b..cf802ea206 100644 --- a/std/math/complex/asin.zig +++ b/std/math/complex/asin.zig @@ -1,5 +1,5 @@ const std = @import("../../index.zig"); -const debug = std.debug; +const testing = std.testing; const math = std.math; const cmath = math.complex; const Complex = cmath.Complex; @@ -22,6 +22,6 @@ test "complex.casin" { const a = Complex(f32).new(5, 3); const c = asin(a); - debug.assert(math.approxEq(f32, c.re, 1.023822, epsilon)); - debug.assert(math.approxEq(f32, c.im, 2.452914, epsilon)); + testing.expect(math.approxEq(f32, c.re, 1.023822, epsilon)); + testing.expect(math.approxEq(f32, c.im, 2.452914, epsilon)); } diff --git a/std/math/complex/asinh.zig b/std/math/complex/asinh.zig index 0c4dc2b6e4..0386a636b0 100644 --- a/std/math/complex/asinh.zig +++ b/std/math/complex/asinh.zig @@ -1,5 +1,5 @@ const std = @import("../../index.zig"); -const debug = std.debug; +const testing = std.testing; const math = std.math; const cmath = math.complex; const Complex = cmath.Complex; @@ -17,6 +17,6 @@ test "complex.casinh" { const a = Complex(f32).new(5, 3); const c = asinh(a); - debug.assert(math.approxEq(f32, c.re, 2.459831, epsilon)); - debug.assert(math.approxEq(f32, c.im, 0.533999, epsilon)); + testing.expect(math.approxEq(f32, c.re, 2.459831, epsilon)); + testing.expect(math.approxEq(f32, c.im, 0.533999, epsilon)); } diff --git a/std/math/complex/atan.zig b/std/math/complex/atan.zig index de60f2546d..8e60e58e43 100644 --- a/std/math/complex/atan.zig +++ b/std/math/complex/atan.zig @@ -1,5 +1,5 @@ const std = @import("../../index.zig"); -const debug = std.debug; +const testing = std.testing; const math = std.math; const cmath = math.complex; const Complex = cmath.Complex; @@ -117,14 +117,14 @@ test "complex.catan32" { const a = Complex(f32).new(5, 3); const c = atan(a); - debug.assert(math.approxEq(f32, c.re, 1.423679, epsilon)); - debug.assert(math.approxEq(f32, c.im, 0.086569, epsilon)); + testing.expect(math.approxEq(f32, c.re, 1.423679, epsilon)); + testing.expect(math.approxEq(f32, c.im, 0.086569, epsilon)); } test "complex.catan64" { const a = Complex(f64).new(5, 3); const c = atan(a); - debug.assert(math.approxEq(f64, c.re, 1.423679, epsilon)); - debug.assert(math.approxEq(f64, c.im, 0.086569, epsilon)); + testing.expect(math.approxEq(f64, c.re, 1.423679, epsilon)); + testing.expect(math.approxEq(f64, c.im, 0.086569, epsilon)); } diff --git a/std/math/complex/atanh.zig b/std/math/complex/atanh.zig index f70c741765..5b18fe1992 100644 --- a/std/math/complex/atanh.zig +++ b/std/math/complex/atanh.zig @@ -1,5 +1,5 @@ const std = @import("../../index.zig"); -const debug = std.debug; +const testing = std.testing; const math = std.math; const cmath = math.complex; const Complex = cmath.Complex; @@ -17,6 +17,6 @@ test "complex.catanh" { const a = Complex(f32).new(5, 3); const c = atanh(a); - debug.assert(math.approxEq(f32, c.re, 0.146947, epsilon)); - debug.assert(math.approxEq(f32, c.im, 1.480870, epsilon)); + testing.expect(math.approxEq(f32, c.re, 0.146947, epsilon)); + testing.expect(math.approxEq(f32, c.im, 1.480870, epsilon)); } diff --git a/std/math/complex/conj.zig b/std/math/complex/conj.zig index ad3e8b5036..143543f9e7 100644 --- a/std/math/complex/conj.zig +++ b/std/math/complex/conj.zig @@ -1,5 +1,5 @@ const std = @import("../../index.zig"); -const debug = std.debug; +const testing = std.testing; const math = std.math; const cmath = math.complex; const Complex = cmath.Complex; @@ -13,5 +13,5 @@ test "complex.conj" { const a = Complex(f32).new(5, 3); const c = a.conjugate(); - debug.assert(c.re == 5 and c.im == -3); + testing.expect(c.re == 5 and c.im == -3); } diff --git a/std/math/complex/cos.zig b/std/math/complex/cos.zig index 96e4ffcdb0..658d19c3b6 100644 --- a/std/math/complex/cos.zig +++ b/std/math/complex/cos.zig @@ -1,5 +1,5 @@ const std = @import("../../index.zig"); -const debug = std.debug; +const testing = std.testing; const math = std.math; const cmath = math.complex; const Complex = cmath.Complex; @@ -16,6 +16,6 @@ test "complex.ccos" { const a = Complex(f32).new(5, 3); const c = cos(a); - debug.assert(math.approxEq(f32, c.re, 2.855815, epsilon)); - debug.assert(math.approxEq(f32, c.im, 9.606383, epsilon)); + testing.expect(math.approxEq(f32, c.re, 2.855815, epsilon)); + testing.expect(math.approxEq(f32, c.im, 9.606383, epsilon)); } diff --git a/std/math/complex/cosh.zig b/std/math/complex/cosh.zig index 91875a0c47..5ce10b03f8 100644 --- a/std/math/complex/cosh.zig +++ b/std/math/complex/cosh.zig @@ -1,5 +1,5 @@ const std = @import("../../index.zig"); -const debug = std.debug; +const testing = std.testing; const math = std.math; const cmath = math.complex; const Complex = cmath.Complex; @@ -152,14 +152,14 @@ test "complex.ccosh32" { const a = Complex(f32).new(5, 3); const c = cosh(a); - debug.assert(math.approxEq(f32, c.re, -73.467300, epsilon)); - debug.assert(math.approxEq(f32, c.im, 10.471557, epsilon)); + testing.expect(math.approxEq(f32, c.re, -73.467300, epsilon)); + testing.expect(math.approxEq(f32, c.im, 10.471557, epsilon)); } test "complex.ccosh64" { const a = Complex(f64).new(5, 3); const c = cosh(a); - debug.assert(math.approxEq(f64, c.re, -73.467300, epsilon)); - debug.assert(math.approxEq(f64, c.im, 10.471557, epsilon)); + testing.expect(math.approxEq(f64, c.re, -73.467300, epsilon)); + testing.expect(math.approxEq(f64, c.im, 10.471557, epsilon)); } diff --git a/std/math/complex/exp.zig b/std/math/complex/exp.zig index 0473f653b6..9ded698d08 100644 --- a/std/math/complex/exp.zig +++ b/std/math/complex/exp.zig @@ -1,5 +1,5 @@ const std = @import("../../index.zig"); -const debug = std.debug; +const testing = std.testing; const math = std.math; const cmath = math.complex; const Complex = cmath.Complex; @@ -118,14 +118,14 @@ test "complex.cexp32" { const a = Complex(f32).new(5, 3); const c = exp(a); - debug.assert(math.approxEq(f32, c.re, -146.927917, epsilon)); - debug.assert(math.approxEq(f32, c.im, 20.944065, epsilon)); + testing.expect(math.approxEq(f32, c.re, -146.927917, epsilon)); + testing.expect(math.approxEq(f32, c.im, 20.944065, epsilon)); } test "complex.cexp64" { const a = Complex(f64).new(5, 3); const c = exp(a); - debug.assert(math.approxEq(f64, c.re, -146.927917, epsilon)); - debug.assert(math.approxEq(f64, c.im, 20.944065, epsilon)); + testing.expect(math.approxEq(f64, c.re, -146.927917, epsilon)); + testing.expect(math.approxEq(f64, c.im, 20.944065, epsilon)); } diff --git a/std/math/complex/index.zig b/std/math/complex/index.zig index 171c4c5829..ffbf14d83e 100644 --- a/std/math/complex/index.zig +++ b/std/math/complex/index.zig @@ -1,5 +1,5 @@ const std = @import("../../index.zig"); -const debug = std.debug; +const testing = std.testing; const math = std.math; pub const abs = @import("abs.zig").abs; @@ -97,7 +97,7 @@ test "complex.add" { const b = Complex(f32).new(2, 7); const c = a.add(b); - debug.assert(c.re == 7 and c.im == 10); + testing.expect(c.re == 7 and c.im == 10); } test "complex.sub" { @@ -105,7 +105,7 @@ test "complex.sub" { const b = Complex(f32).new(2, 7); const c = a.sub(b); - debug.assert(c.re == 3 and c.im == -4); + testing.expect(c.re == 3 and c.im == -4); } test "complex.mul" { @@ -113,7 +113,7 @@ test "complex.mul" { const b = Complex(f32).new(2, 7); const c = a.mul(b); - debug.assert(c.re == -11 and c.im == 41); + testing.expect(c.re == -11 and c.im == 41); } test "complex.div" { @@ -121,7 +121,7 @@ test "complex.div" { const b = Complex(f32).new(2, 7); const c = a.div(b); - debug.assert(math.approxEq(f32, c.re, f32(31) / 53, epsilon) and + testing.expect(math.approxEq(f32, c.re, f32(31) / 53, epsilon) and math.approxEq(f32, c.im, f32(-29) / 53, epsilon)); } @@ -129,14 +129,14 @@ test "complex.conjugate" { const a = Complex(f32).new(5, 3); const c = a.conjugate(); - debug.assert(c.re == 5 and c.im == -3); + testing.expect(c.re == 5 and c.im == -3); } test "complex.reciprocal" { const a = Complex(f32).new(5, 3); const c = a.reciprocal(); - debug.assert(math.approxEq(f32, c.re, f32(5) / 34, epsilon) and + testing.expect(math.approxEq(f32, c.re, f32(5) / 34, epsilon) and math.approxEq(f32, c.im, f32(-3) / 34, epsilon)); } @@ -144,7 +144,7 @@ test "complex.magnitude" { const a = Complex(f32).new(5, 3); const c = a.magnitude(); - debug.assert(math.approxEq(f32, c, 5.83095, epsilon)); + testing.expect(math.approxEq(f32, c, 5.83095, epsilon)); } test "complex.cmath" { diff --git a/std/math/complex/log.zig b/std/math/complex/log.zig index a4a1d1664f..360bb7d21e 100644 --- a/std/math/complex/log.zig +++ b/std/math/complex/log.zig @@ -1,5 +1,5 @@ const std = @import("../../index.zig"); -const debug = std.debug; +const testing = std.testing; const math = std.math; const cmath = math.complex; const Complex = cmath.Complex; @@ -18,6 +18,6 @@ test "complex.clog" { const a = Complex(f32).new(5, 3); const c = log(a); - debug.assert(math.approxEq(f32, c.re, 1.763180, epsilon)); - debug.assert(math.approxEq(f32, c.im, 0.540419, epsilon)); + testing.expect(math.approxEq(f32, c.re, 1.763180, epsilon)); + testing.expect(math.approxEq(f32, c.im, 0.540419, epsilon)); } diff --git a/std/math/complex/pow.zig b/std/math/complex/pow.zig index edf68653b6..bd625626c8 100644 --- a/std/math/complex/pow.zig +++ b/std/math/complex/pow.zig @@ -1,5 +1,5 @@ const std = @import("../../index.zig"); -const debug = std.debug; +const testing = std.testing; const math = std.math; const cmath = math.complex; const Complex = cmath.Complex; @@ -17,6 +17,6 @@ test "complex.cpow" { const b = Complex(f32).new(2.3, -1.3); const c = pow(Complex(f32), a, b); - debug.assert(math.approxEq(f32, c.re, 58.049110, epsilon)); - debug.assert(math.approxEq(f32, c.im, -101.003433, epsilon)); + testing.expect(math.approxEq(f32, c.re, 58.049110, epsilon)); + testing.expect(math.approxEq(f32, c.im, -101.003433, epsilon)); } diff --git a/std/math/complex/proj.zig b/std/math/complex/proj.zig index b6c4cc046e..d31006129e 100644 --- a/std/math/complex/proj.zig +++ b/std/math/complex/proj.zig @@ -1,5 +1,5 @@ const std = @import("../../index.zig"); -const debug = std.debug; +const testing = std.testing; const math = std.math; const cmath = math.complex; const Complex = cmath.Complex; @@ -20,5 +20,5 @@ test "complex.cproj" { const a = Complex(f32).new(5, 3); const c = proj(a); - debug.assert(c.re == 5 and c.im == 3); + testing.expect(c.re == 5 and c.im == 3); } diff --git a/std/math/complex/sin.zig b/std/math/complex/sin.zig index d32b771d3b..9d54ab0969 100644 --- a/std/math/complex/sin.zig +++ b/std/math/complex/sin.zig @@ -1,5 +1,5 @@ const std = @import("../../index.zig"); -const debug = std.debug; +const testing = std.testing; const math = std.math; const cmath = math.complex; const Complex = cmath.Complex; @@ -17,6 +17,6 @@ test "complex.csin" { const a = Complex(f32).new(5, 3); const c = sin(a); - debug.assert(math.approxEq(f32, c.re, -9.654126, epsilon)); - debug.assert(math.approxEq(f32, c.im, 2.841692, epsilon)); + testing.expect(math.approxEq(f32, c.re, -9.654126, epsilon)); + testing.expect(math.approxEq(f32, c.im, 2.841692, epsilon)); } diff --git a/std/math/complex/sinh.zig b/std/math/complex/sinh.zig index dc19a0ba1b..469ea6067a 100644 --- a/std/math/complex/sinh.zig +++ b/std/math/complex/sinh.zig @@ -1,5 +1,5 @@ const std = @import("../../index.zig"); -const debug = std.debug; +const testing = std.testing; const math = std.math; const cmath = math.complex; const Complex = cmath.Complex; @@ -151,14 +151,14 @@ test "complex.csinh32" { const a = Complex(f32).new(5, 3); const c = sinh(a); - debug.assert(math.approxEq(f32, c.re, -73.460617, epsilon)); - debug.assert(math.approxEq(f32, c.im, 10.472508, epsilon)); + testing.expect(math.approxEq(f32, c.re, -73.460617, epsilon)); + testing.expect(math.approxEq(f32, c.im, 10.472508, epsilon)); } test "complex.csinh64" { const a = Complex(f64).new(5, 3); const c = sinh(a); - debug.assert(math.approxEq(f64, c.re, -73.460617, epsilon)); - debug.assert(math.approxEq(f64, c.im, 10.472508, epsilon)); + testing.expect(math.approxEq(f64, c.re, -73.460617, epsilon)); + testing.expect(math.approxEq(f64, c.im, 10.472508, epsilon)); } diff --git a/std/math/complex/sqrt.zig b/std/math/complex/sqrt.zig index 47367816f7..60f6061baa 100644 --- a/std/math/complex/sqrt.zig +++ b/std/math/complex/sqrt.zig @@ -1,5 +1,5 @@ const std = @import("../../index.zig"); -const debug = std.debug; +const testing = std.testing; const math = std.math; const cmath = math.complex; const Complex = cmath.Complex; @@ -125,14 +125,14 @@ test "complex.csqrt32" { const a = Complex(f32).new(5, 3); const c = sqrt(a); - debug.assert(math.approxEq(f32, c.re, 2.327117, epsilon)); - debug.assert(math.approxEq(f32, c.im, 0.644574, epsilon)); + testing.expect(math.approxEq(f32, c.re, 2.327117, epsilon)); + testing.expect(math.approxEq(f32, c.im, 0.644574, epsilon)); } test "complex.csqrt64" { const a = Complex(f64).new(5, 3); const c = sqrt(a); - debug.assert(math.approxEq(f64, c.re, 2.3271175190399496, epsilon)); - debug.assert(math.approxEq(f64, c.im, 0.6445742373246469, epsilon)); + testing.expect(math.approxEq(f64, c.re, 2.3271175190399496, epsilon)); + testing.expect(math.approxEq(f64, c.im, 0.6445742373246469, epsilon)); } diff --git a/std/math/complex/tan.zig b/std/math/complex/tan.zig index 4ea5182fa7..db34580598 100644 --- a/std/math/complex/tan.zig +++ b/std/math/complex/tan.zig @@ -1,5 +1,5 @@ const std = @import("../../index.zig"); -const debug = std.debug; +const testing = std.testing; const math = std.math; const cmath = math.complex; const Complex = cmath.Complex; @@ -17,6 +17,6 @@ test "complex.ctan" { const a = Complex(f32).new(5, 3); const c = tan(a); - debug.assert(math.approxEq(f32, c.re, -0.002708233, epsilon)); - debug.assert(math.approxEq(f32, c.im, 1.004165, epsilon)); + testing.expect(math.approxEq(f32, c.re, -0.002708233, epsilon)); + testing.expect(math.approxEq(f32, c.im, 1.004165, epsilon)); } diff --git a/std/math/complex/tanh.zig b/std/math/complex/tanh.zig index e48d438783..03ab431312 100644 --- a/std/math/complex/tanh.zig +++ b/std/math/complex/tanh.zig @@ -1,5 +1,5 @@ const std = @import("../../index.zig"); -const debug = std.debug; +const testing = std.testing; const math = std.math; const cmath = math.complex; const Complex = cmath.Complex; @@ -100,14 +100,14 @@ test "complex.ctanh32" { const a = Complex(f32).new(5, 3); const c = tanh(a); - debug.assert(math.approxEq(f32, c.re, 0.999913, epsilon)); - debug.assert(math.approxEq(f32, c.im, -0.000025, epsilon)); + testing.expect(math.approxEq(f32, c.re, 0.999913, epsilon)); + testing.expect(math.approxEq(f32, c.im, -0.000025, epsilon)); } test "complex.ctanh64" { const a = Complex(f64).new(5, 3); const c = tanh(a); - debug.assert(math.approxEq(f64, c.re, 0.999913, epsilon)); - debug.assert(math.approxEq(f64, c.im, -0.000025, epsilon)); + testing.expect(math.approxEq(f64, c.re, 0.999913, epsilon)); + testing.expect(math.approxEq(f64, c.im, -0.000025, epsilon)); } |
