nsdecimal

    0熱度

    1回答

    我在我的應用程序中使用NSDecimalNumber在文本框中輸入了大量計算結果。我在模擬器和設備上測試了它(不知道它是否在iOS 8中更改過,或者我沒有注意到),但在故事板上我使用了十進制鍵盤。 當我在模擬器上運行應用程序時,我在設備上看到一個點(。),我看到一個逗號(,)。模擬器採用正確的值,例如15.99存儲爲15.99,但如果我輸入15.99,則會將其轉換爲15.00。 我在做什麼錯了?如

    0熱度

    1回答

    let highDouble = 1.7976931348623e+308 // Just under Double.greatestFiniteMagnitude print(highDouble) // 1.7976931348623e+308 let highDecimal = Decimal(highDouble) print(highDecimal) // 179769313486