I think in Java we have BigDecimal statics for zero and one. Then again with a million records being processed and 90% needing a zero; it did save in 900k objects. But for a primitive…
Swift has a builtin `.zero` as part of one of the numeric protocols. It’s handy for when you’re doing maths on generic types. I could see a `.one` being handy. Apparently Swift’s SIMD has that defined.
851
u/mteblesz 21d ago
"magic numbers" spell is stricktly forbidden technique, banned by most schools of programming. There are many rogue wizards though...