Added setters for real and imaginary properties of Complex

This commit is contained in:
Noah Wilder committed 2019-11-07 23:51:40 -05:00
1 parent 67528d4a53
commit 0308def714
1 file changed
+6
+6
View File
@@ -77,6 +77,9 @@ extension Complex {
public var real: RealType {
@_transparent
get { isFinite ? x : .nan }
@_transparent
set { x = newValue }
}
/// The imaginary part of this complex value.
@@ -85,6 +88,9 @@ extension Complex {
public var imaginary: RealType {
@_transparent
get { isFinite ? y : .nan }
@_transparent
set { y = newValue }
}
/// The additive identity, with real and imaginary parts both zero.