mirror of
https://github.com/apple/swift-numerics
synced 2026-11-27 05:04:26 +00:00
Fix the edge-case handling of Complex.pow(.zero, <int>)
This commit is contained in:
1 parent
2624562948
commit
d34f5636c4
2 files changed
+21
-1
No files matched your search
@@ -420,7 +420,9 @@ extension Complex: ElementaryFunctions {
|
||||
|
||||
@inlinable
|
||||
public static func pow(_ z: Complex, _ n: Int) -> Complex {
|
||||
if z.isZero { return .zero }
|
||||
if z.isZero {
|
||||
return n < 0 ? .infinity : n == 0 ? .one : .zero
|
||||
}
|
||||
// TODO: this implementation is not quite correct, because n may be
|
||||
// rounded in conversion to RealType. This only effects very extreme
|
||||
// cases, so we'll leave it alone for now.
|
||||
|
||||
Reference in new issue
Block a user