mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
add angle func
This commit is contained in:

committed by
Alexander Medvednikov

parent
b40ad7c83f
commit
ccf733ac95
@ -101,4 +101,19 @@ fn test_complex_equals() {
|
||||
c1 = math.complex(-3,19)
|
||||
c2 = math.complex(-3,19)
|
||||
assert c1.equals(c2)
|
||||
}
|
||||
}
|
||||
|
||||
fn test_complex_angle(){
|
||||
mut c := math.complex(1, 0)
|
||||
assert c.angle() * 180 / math.Pi == 0
|
||||
c = math.complex(1, 1)
|
||||
assert c.angle() * 180 / math.Pi == 45
|
||||
c = math.complex(0, 1)
|
||||
assert c.angle() * 180 / math.Pi == 90
|
||||
c = math.complex(-1, 1)
|
||||
assert c.angle() * 180 / math.Pi == 135
|
||||
c = math.complex(-1, -1)
|
||||
assert c.angle() * 180 / math.Pi == -135
|
||||
mut cc := c.conjugate()
|
||||
assert cc.angle() + c.angle() == 0
|
||||
}
|
||||
|
Reference in New Issue
Block a user