ios - NSDecimal equal to NSDecimalNumber value? -


i looking effective way save nsdecimalnumber other data in nsdata buffer.

i have not found method directly nsdecimalnumber. however, easy convert :

nsdecimal value = [thedecimalnumber decimalvalue]; 

and not difficult transfer nsdecimal in memory (20 bytes).

but, question: the nsdecimalnumber , nsdecimal values same?

because declarations have differences (externalrefcount ?):

@interface nsdecimalnumber : nsnumber { @private     signed   int _exponent:8;     unsigned int _length:4;     unsigned int _isnegative:1;     unsigned int _iscompact:1;     unsigned int _reserved:1;     unsigned int _hasexternalrefcount:1;     unsigned int _refs:16;     unsigned short _mantissa[0]; /* gcc */ }  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; 

is possible perform many transfers between 2 type, without loss of precision ?

did try use nsarchiver class methods?

nsdata *data=[nsarchiver archiveddatawithrootobject:yournumber]; 

Comments

Popular posts from this blog

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -