Numbers
Numbers
Int
Decimal
Parsing
Error: Initializer 'init(_:)' requires that 'Decimal' conform to 'BinaryInteger'
var integer = 0
let temp = Decimal(value) * (pow(10, digits.count-index-1))
print(type(of: temp)) // prints ** NSDecimal **
integer += Int(truncating: temp as NSNumber)
// Converting NSDecimal to Int
let size = Decimal(2)
let test = pow(size, 2) - 1
let result = NSDecimalNumber(decimal: test)
print(Int(result)) // testing the cast to Int