Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有Double数据类型,因为我需要浮点数的结果,但如果我的结果是否定的,它会破坏我的所有算法。是否可能存在带浮点的无符号数据类型?
Double
用于max限制数字低于零:
max
let posOrZero = max(possiblyNegative, 0)
如果possiblyNegative高于零,它将是max;的结果 否则,返回零。
possiblyNegative