Xcode 9 beta 3: Prefix operator '-' on Decimal value 0 gives NaN

Number:rdar://33311786 Date Originated:2017-07-14
Status:Closed Resolved:2017-07-21
Product:Xcode 9 Product Version:beta 3
Classification:Serious bug Reproducible:Always
In Xcode 9 beta 3, the prefix operator '-' on the Decimal value '0' returns NaN instead of the expected value '0'.
The infix operator '0 - 0' works correctly. In Xcode 8.3 both the infix and the prefix operators work as expected.

Steps to Reproduce:
Create a Playground in Xcode 9 beta 3 containing:
import Foundation
let zero: Decimal = 0

Expected Results:
I expect that the negated 0 is still 0

Observed Results:
The negated 0 is NaN

Xcode 9 beta 3


Created a pull request for a fix to the issue in swift-corelibs-foundation


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!