0
試圖將一些簡單的數字加在一起。在最後一行獲取「表達太複雜,無法在合理的時間內解決......」的錯誤。爲什麼?當然它不會變得更簡單?基本添加 - 表達式太複雜錯誤(Swift)
let year = calendar.component(.CalendarUnitYear, fromDate: inputGregorianDate)
let month = calendar.component(.CalendarUnitMonth, fromDate: inputGregorianDate)
let day = calendar.component(.CalendarUnitDay, fromDate: inputGregorianDate)
// Conversion Calulation
let AGR = year/100
let BGR = AGR/4
let CGR = 2 - AGR + BGR
var EGR = 0.00
if (month <= 2) {
EGR = 365.25 * Double(year + 4716)
} else {
EGR = 365.25 * Double(year + 4716);
}
let FGR = 30.6001 * Double(month + 1);
let dateJulian = Double(CGR + day + EGR + FGR - 1524.5)
是謝謝你 - 但爲什麼不是編譯器給人一種雙/ INT /的Int32轉換錯誤呢?非常感謝,我將來會在源頭上將它們捆綁在一起。 –
@EdwardHasted Swift以錯過主要錯誤信息而聞名 –