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

Originator:bek
Number:rdar://33311786 Date Originated:2017-07-14
Status:Open Resolved:
Product:Xcode 9 Product Version:beta 3
Classification:Serious bug Reproducible:Always
 
Summary:
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
-zero

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

Observed Results:
The negated 0 is NaN

Version:
Xcode 9 beta 3

Comments

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

https://github.com/apple/swift-corelibs-foundation/pull/1117


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!