apple / swift-numerics

Advanced mathematical types and functions for Swift
Apache License 2.0
1.67k stars 142 forks source link

Fix edge-cases for Complex.pow(.zero, <Int>), and Real.pow(zero, zero) #235

Closed stephentyrone closed 1 year ago

stephentyrone commented 1 year ago

Previously the complex pow unconditionally returned .zero, but they should actually return one of .infinity, .zero, or .one depending on whether the exponent is negative, positive, or zero, matching the behavior of real types.

Similarly, the real pow didn't quite match IEEE 754 powr for the (0, 0) case (should be .nan, was 0).

stephentyrone commented 1 year ago

@swift-ci test

stephentyrone commented 1 year ago

@swift-ci test