In the spirit of Ted's RFC on making swift.org a more valuable resource, I thought I'd share something I've been working on for a while:
A great number of questions are raised in these forums as to the functioning and design of numeric types and protocols in Swift. Sometimes, the answer can be found only by digging through the source code, and even then it's hard to place what you learn there within a larger context. Therefore, I've compiled a series of articles that delve into these topics in more detail.
Who's it for? Anyone who's working intensively with Swift but less familiar with its numeric types, or anyone who's working intensively with numbers in other programming languages but less familiar with Swift. Hopefully, you'll find tidbits you didn't know but find useful:
Concrete integer types, part 1
Introduction, integer literals, conversions among integer types
Concrete integer types, part 2
Operator precedence, overflow behavior, integer remainder, bitwise operations
Concrete binary floating-point types, part 1
Introduction (IEEE 754, C mathematical functions, finite constants)
Concrete binary floating-point types, part 2
Floating-point precision (striding, fused multiply-add, unit in the last place, approximating π, subnormal values on 32-bit ARM, string representation)
Concrete binary floating-point types, part 3
Float literals, conversions between floating-point types, other initializers
Concrete binary floating-point types, part 4
Signed zero, infinity, and NaN; floating-point remainder; significand representation
Numeric types in Foundation
Foundation.Decimal, Foundation.NSNumber
Numeric protocols
Introduction, design rationale, generic algorithms, conformance
The source repository for these documents is at GitHub - xwu/xwu-swift-numerics: Notes on numerics in Swift. Corrections welcome. And, of course, if the community feels that this would be the sort of thing that should be available on swift.org, I'm happy to contribute.