multiplication - Swift - Multiply two NSDecimal Numbers -
I am currently trying to multiply two NSDecimal
numbers, this Swift ?
I have found the method ' matching the decimal number
on the Apple Dev pages but I have used it as below and I get' poor access' 'error
In the item category, both the price and quantity are NSDecimalNumbers
and of course the population (with purchase price of 35.99 and 30 quantities)
Var one = item.purchasePrice var two = item.quantity Give two: NSDecimalNumber = one.decimalNumberByMultiplyingby (two)
I have tried it in many ways but all the tutorial objectives.
Thanks
This works perfectly.
var number one: Ansdisimlnanbr = Ansdisimlnanbr (Float: 35.9 9) var number two: Ansdisimlnanbr = Ansdisiaielmel (Int 30) l At number three: Ansdisimlnanbr = Snkyaoadisiaielelbibiaflipifaing (number two) Print (No. Three)
The output on the console is:
1079.7000503540041728
Note: Your var The type of ( three
) no can be NSDecimalNumber
example, this is the reason that the exception was found.
Comments
Post a Comment