2
我正在制作一个计算器应用程序,当它达到高数量时它崩溃。 这是代码。var双重类型快速崩溃
var accumulator: Double = 0.0
func updateDisplay() {
// If the value is an integer, don't show a decimal point
let iAcc = Int(accumulator)
if accumulator - Double(iAcc) == 0 {
numField.text = "\(iAcc)"
} else {
numField.text = "\(accumulator)"
}
}
,这里是错误
fatal error: floating point value can not be converted to Int because it is greater than Int.max
如果任何人能帮助这将是伟大的!
什么是'accumulator',你可以在运行时打印'accumulator'? – Breek