3

This code prints "eighteen quadrillion fourteen trillion three hundred ninety-eight billion five hundred nine million four hundred eighty-one thousand nine hundred eighty-four", but the numeric value of Int.max is 9223372036854775807.

let formatter = NumberFormatter()
formatter.numberStyle = .spellOut
print(formatter.string(from: Int.max))

Why?

Tone416
  • 540
  • 3
  • 10
  • 4
    NSNumberFormatter uses a Double to store the value (53 bits), so your value is too big. http://stackoverflow.com/questions/35205450/bug-in-nsnumberformatterstyle-spelloutstyle – Asdrubal Jul 22 '16 at 01:28

0 Answers0