I know that float or double are not suitable for storing a decimal number, such as money and quantity. Instead, I'm trying to use NSDecimalNumber. Here is my code on the Swift playground.
let number:NSDecimalNumber = 1.66 let text:String = String(describing: number) NSLog(text)
Console Output: 1.6599999999999995904
How can I store the exact decimal value of 1.66 in a variable?
source share