Let us suppose I have a variable v of type NSDecimalNumber
let v = 34.596904 in its own format.
I want to know the precision and scale of this number, not the default one. I did not find any function in the NSDecimalNumber class which gives these values or maybe someone would like to throw some light on how it works.
precision = 8
scale = 6
precision is count of significant digits in number and scale is count of significant digit after decimal
This extension will give you the specific value for your only example:
Usage:
But I cannot be sure if this generates expected results in all cases you have in mind, as you have shown only one example...
One more, in Swift,
DecimalandNSDecimalNumberare easily bridgeable and you should better useDecimalas far as you can.