math.complex: make fields public

pull/2353/head
Simon Heuser 2019-10-15 11:43:28 +02:00 committed by Alexander Medvednikov
parent 49d6c26da4
commit a5d61f6da0
2 changed files with 7 additions and 0 deletions

View File

@ -7,6 +7,7 @@ module complex
import math import math
struct Complex { struct Complex {
pub:
re f64 re f64
im f64 im f64
} }

View File

@ -781,3 +781,9 @@ fn test_complex_acsch() {
// Some issue with precision comparison in f64 using == operator hence serializing to string // Some issue with precision comparison in f64 using == operator hence serializing to string
assert result.str().eq(c2.str()) assert result.str().eq(c2.str())
} }
fn test_complex_re_im() {
c := cmplx.complex(2.1, 9.05)
assert c.re == 2.1
assert c.im == 9.05
}