swift - How to get the smallest possible Float in Swift
问题描述
I want to find, programmatically, and portably, the smallest Float possible.
By smallest I mean the smallest > 0 Float. Any way to achieve that ?
解决方案
查找Float
我发现的文档:Float.leastNonzeroMagnitude
最小的正数。
此值比较小于或等于所有正数,但大于零。如果类型支持次正规值,
leastNonzeroMagnitude
则小于leastNormalMagnitude
;否则他们是平等的。