Swift: importing Foundation changes arithmetic

Originator:vincetogo
Number:rdar://17959344 Date Originated:8 August 2014
Status:Open Resolved:
Product:Developer Tools Product Version:Xcode Version 6.0 (6A279r) (Xcode6-Beta5)
Classification: Reproducible:Always
 
Summary:
Simple arithmetic evaluations change when Foundation or Cocoa is imported at the top of the .swift file.

Steps to Reproduce:
Create a new Playground. Keep the "import Cocoa" or replace it with "import Foundation" and enter the following:

3.0/2.0
3.0/2
Float(3.0/2)
Float(3.0)/2
(3.0)/2

These evaluate to 1.5, 1, 1.5, 1.5, and 1.

Next, comment out the "import" line. The expressions above are recomputed, and each one evaluates to be 1.5.


Expected Results:
I would expect the expressions to all be evaluated to be 1.5, whether or not there is an "import" line

Actual Results:
The results of computation are different if there is an import line in the source file

Version:
Xcode Version 6.0 (6A279r) (Xcode6-Beta5)
Mac OS X 10.9.4

Comments


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!