iphone Programming Glossary: isnegative
Correcting floating point numbers http://stackoverflow.com/questions/10049533/correcting-floating-point-numbers @ 32.1 Or since you use exponents NSDecimalNumber num2 NSDecimalNumber decimalNumberWithMantissa 321 exponent 1 isNegative NO NSDecimalNumber myNumber num1 decimalNumberByAdding num2 NSString result myNumber stringValue result will contain 64.1..
Converting NSString to Currency - The Complete Story http://stackoverflow.com/questions/1960300/converting-nsstring-to-currency-the-complete-story decimalNumberWithMantissa aString integerValue exponent 1 currencyFormatter maximumFractionDigits isNegative NO return currencyFormatter stringFromNumber value NSString decimalToIntString NSDecimalNumber aDecimal NSNumberFormatter.. decimalNumberWithMantissa aDecimal integerValue exponent currencyFormatter maximumFractionDigits isNegative NO return price stringValue @end The first method stringToCurrency will take an integer number passed in from a textfield..
Creating NSDecimal http://stackoverflow.com/questions/2035421/creating-nsdecimal itself can be found in the NSDecimal.h header typedef struct signed int _exponent 8 unsigned int _length 4 length 0 isNegative NaN unsigned int _isNegative 1 unsigned int _isCompact 1 unsigned int _reserved 18 unsigned short _mantissa NSDecimalMaxSize.. NSDecimal.h header typedef struct signed int _exponent 8 unsigned int _length 4 length 0 isNegative NaN unsigned int _isNegative 1 unsigned int _isCompact 1 unsigned int _reserved 18 unsigned short _mantissa NSDecimalMaxSize NSDecimal but I don't know..
Proper way to instantiate an NSDecimalNumber from float or double http://stackoverflow.com/questions/5304855/proper-way-to-instantiate-an-nsdecimalnumber-from-float-or-double NSNumber. On the other side NSDecimalNumber defines the following NSDecimalNumber decimalNumberWithMantissa exponent isNegative NSDecimalNumber decimalNumberWithDecimal There are a few possibilities here on which way to go. Xcode generates a warning.. @ 36.76662445068359375000 id xx4 NSDecimalNumber decimalNumberWithMantissa 3676662445068359375L exponent 17 isNegative NO NSLog @ raw doubleValue .20f .17f dbl dbl NSLog @ xx1 doubleValue .20f description @ xx1 doubleValue xx1 NSLog @ xx2.. is not as accurate as the one you get when you invoke decimalNumberWithString or decimalNumberWithMantissa exponent isNegative . Also note that converting back to a double by calling doubleValue on the NSDecimalNumber instance is losing precision..
|