0

I have to add decimal values after converting them from NSString, but it fails for null values, even if I do the test.

[lastPrice decimalNumberByAdding:actualPrice==nil?nullValue:actualPrice]] 

In debug mode :

lastPrice = 0;
actualPrice = NaN
nullValue = 0;

I expected that

actualPrice==nil?nullValue:actualPrice

would be estimated correctly but nil is not NaN...

How can I do this ?

Jan ATAC
  • 1,212
  • 1
  • 18
  • 36

1 Answers1

0

Ok ! The solution is here

The test should be :

[lastPrice decimalNumberByAdding:isnan([actualPrice doubleValue]?nullValue:actualPrice]] 
Community
  • 1
  • 1
Jan ATAC
  • 1,212
  • 1
  • 18
  • 36