Hi, I was using pow
in my code and noticed that it returns decimal type. As I had to further use this value in different calculations, I was looking into converting this to Int
type.
I did this by wrapping it with NSDecimalNumber
and then Int
as follows; Int(NSDecimalNumber(decimal: pow(10,i)))
.
However, this is giving me a warning
warning: 'init(_:)' is deprecated: replaced by 'init(truncating:)'
and a note
during compilation and execution
note: use 'init(truncating:)' instead
recreated_n += digits[i-len]*Int(NSDecimalNumber(decimal: pow(10,i)))
^
truncating:
I just wanted know if there's a better way to do this.
Thanks