How to store 1.66 in NSDecimalNumber

In let number:NSDecimalNumber = 1.66 the right-hand side is a floating point number which cannot represent the value “1.66” exactly. One option is to create the decimal number from a string: let number = NSDecimalNumber(string: “1.66”) print(number) // 1.66 Another option is to use arithmetic: let number = NSDecimalNumber(value: 166).dividing(by: 100) print(number) // 1.66 With … Read more