Swift iOS Development
Your Receipt Says $0.13. Your Label Says $0.12. Swift Has Two Rounding Rules and You're Using Both.
Swift's Double.rounded() rounds half away from zero, but NumberFormatter, FormatStyle, and String(format:) round half to even. Here's why the same number displays two ways, the 1.005 trap, and how to pick one rounding rule and enforce it.
8 min read
Swift iOS Development
One NaN Got Into Your Array. Now sorted(), contains(), and Set Are All Quietly Lying.
Double.nan isn't equal to itself, so one NaN silently breaks Swift's sorted(), contains(), firstIndex(of:), max(), Set and Dictionary, and even your clamp function. Where NaN comes from in iOS apps, why it spreads, and how to stop it at the boundary.
9 min read
Swift Evolution Swift
Float.pi Has Been Slightly Wrong Since 2016. Swift Is Finally Fixing the Rounding.
SE-0552, in active review through October 6, 2026, changes how Float.pi rounds — undoing a Swift 3-era decision to always round toward zero. Here's the actual bit that moves, why it was ever rounded down on purpose, and whether your code needs to care.
6 min read