Swift documentation confusing about Float/Double recommendations
| Originator: | robnapier | ||
| Number: | rdar://17567466 | Date Originated: | 05-Jul-2014 01:00 PM |
| Status: | New | Resolved: | |
| Product: | Swift | Product Version: | 6.0Beta2 |
| Classification: | Reproducible: |
The Swift documentation says: “Double represents a 64-bit floating-point number. Use it when floating-point values must be very large or particularly precise. Float represents a 32-bit floating-point number. Use it when floating-point values do not require 64-bit precision.” This seems at odds with the language, which defaults to Double for real constants. Developers who try to follow the recommendation to prefer Float over Double with find themselves fighting the type inference system. Either the documentation should make it clear that Double is preferred, or the language should default to Float for real constants.
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!