From 0308def714aeb125ec8f83cffd73d1a5c8f66410 Mon Sep 17 00:00:00 2001 From: Noah Wilder Date: Thu, 7 Nov 2019 23:51:40 -0500 Subject: [PATCH] Added setters for `real` and `imaginary` properties of `Complex` --- Sources/Complex/Complex.swift | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Sources/Complex/Complex.swift b/Sources/Complex/Complex.swift index 5707784..513de47 100644 --- a/Sources/Complex/Complex.swift +++ b/Sources/Complex/Complex.swift @@ -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.