I'm having an issue when I convert a double to a decimal:
import Foundation
var double:Double = 0.23
var decimal = Decimal(double)
print(double)
print(decimal)
Line 4 will print out 0.23 which is the value i've set.
however, line 5 prints out "0.2300000000000000512"
Why is this happening? I
It works correctly if I do this:
var double:Double = 0.23
Decimal.init(string:double.description)