In short I was playing with calculations to analyse reliability and error propagation with different numeric type when high precision matters. The sa ...
In short I was playing with calculations to analyse reliability and error propagation with different numeric type when high precision matters. The sa ...
I want the exact 2 digits after the decimal point. I tried the toFixed(2) function but it returns rounded off 2 digits. Here is my Code it returns 18. ...
I'm trying to convert a Decimal number which represents a dollar amount. Then I cast it into a NSDecimalNumber to apply .intValue transformation. Ho ...
is there any way to tell JSONDecoder to convert incoming decimals to Strings? Consider what would happen when AMOUNT is something like 397289527598 ...
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 numb ...
Please check this example it always returns 12 not 12.00 I also try with NSNumber, Float, and Double but it always remove zeros. Can you please h ...
I am dealing with money amounts in my app so precision is obviously very important and Decimal/NSDecimal number is supposed to be the way to handle mo ...
I am a new Swift developer. I am using Swift 4.2 and Xcode 10.1. I need to pull a number from firebase that represents dollars and cents (e.g., 10.20 ...
I need to decode (Decodable protocol) an imprecise decimal value correctly, from this question I understand how to properly handle the Decimal instant ...
I found a bug in my code that is caused by NSDecimalNumber.notANumber.intValue returning 9, while I would expect NaN (as floatValue or doubleValue ret ...
I want to store a value something like 3.2.7 in Numbers in iOS, coz I want to compare the value with other. Is there any data type is available? or a ...
there are a short code seem ok, print "2128.12". ..... but you can try numString = @"78.991"; print "78.98999999999999".... why scale is inva ...
Here is my code The following is the output and input doubleValueOfDecimal = 2.95699999999998 Output 2.95699999999998 Optional("2.9569999999999800 ...
I have implementation of the function that is : After usage of this function with 0 cof: But when I call function with different cof value. A ...
I have been trying the question on hacker rank in which addition of all the substring of a string is taken into account. In doing so our answer exceed ...
The code is simple and you can reproduce it. isEqualToNumber: always returns YES, even I compare d1 to other numbers like @6560601600245628930... A ...
As we all know, when calculating with a precise number (E.g. money), it's best to use NSDecimalNumber instead of basic float or double. Then, we have ...
I have an app that's been in the store since iOS 9. Recently it just broke because of rounding errors. I'm using Xcode Version 9.2 (9C40b). I wrote a ...
I have a Core Data Entity called Transaction with the property value of type Decimal. I'm trying to reduce an array of Transactions, to sum the value ...
I'm using Xcode 9.1 and when I try to display the NSDecimalNumber values in Xcode debugger console, it prints it out like this. However when I use ...