![]() System : Linux absol.cf 5.4.0-198-generic #218-Ubuntu SMP Fri Sep 27 20:18:53 UTC 2024 x86_64 User : www-data ( 33) PHP Version : 7.4.33 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, Directory : /usr/share/doc/gnustep-base-doc/Base/Reference/ |
Upload File : |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>NSDecimalNumber class reference</title> </head> <body> <font face="serif"> <a href="Base.html">Up</a> <br /> <h1><a name="title$NSDecimalNumber">NSDecimalNumber class reference</a></h1> <h3>Authors</h3> <dl> <dt>Fred Kiefer (<a href="mailto:FredKiefer@gmx.de"><code>FredKiefer@gmx.de</code></a>)</dt> <dd> </dd> </dl> <p><b>Copyright:</b> (C) 2000 Free Software Foundation, Inc.</p> <div> <hr width="50%" align="left" /> <h3>Contents -</h3> <ol> <li> <a href="#001000000000">Software documentation for the NSDecimalNumber class</a> </li> <li> <a href="#002000000000">Software documentation for the NSDecimalNumberHandler class</a> </li> <li> <a href="#003000000000">Software documentation for the NSNumber(NSDecimalNumber) category</a> </li> <li> <a href="#004000000000">Software documentation for the NSDecimalNumberBehaviors protocol</a> </li> </ol> <hr width="50%" align="left" /> </div> <h1><a name="001000000000"> Software documentation for the NSDecimalNumber class </a></h1> <h2><a name="class$NSDecimalNumber">NSDecimalNumber</a> : <a rel="gsdoc" href="NSValue.html#class$NSNumber">NSNumber</a></h2> <blockquote class="declared"> <dl> <dt><b>Declared in:</b></dt> <dd>Foundation/NSDecimalNumber.h</dd> </dl> </blockquote> <blockquote> <dl> <dt><b>Conforms to:</b></dt> <dd><a rel="gsdoc" href="#protocol$(NSDecimalNumberBehaviors)">NSDecimalNumberBehaviors</a></dd> </dl> </blockquote> <div class="availability"> <b>Availability:</b> MacOS-X 10.0.0</div> <br /> <div class="desc"> </p> <p> <strong>Class</strong> that implements a number of methods for performing decimal arithmetic to arbitrary precision. The behavior in terms of rounding choices and exception handling may be customized using the <a rel="gsdoc" href="#class$NSDecimalNumberHandler">NSDecimalNumberHandler</a> class, and defaults to <a rel="gsdoc" href="#method$NSDecimalNumberHandler+defaultDecimalNumberHandler">[NSDecimalNumberHandler +defaultDecimalNumberHandler]</a> . </p> <p> </p> <p> Equivalent functionality to the <code>NSDecimalNumber</code> class may be accessed through functions, mostly named <code>NSDecimalXXX</code>, e.g., <a rel="gsdoc" href="Functions.html#function$NSDecimalMin"> NSDecimalMin() </a> . Both the class and the functions use a structure called <code>NSDecimal</code>. </p> <p> </p> <p> Note that instances of <code>NSDecimalNumber</code> are immutable. </p> <p> </div> <hr width="50%" align="left" /> <a href="#_NSDecimalNumber_ivars">Instance Variables</a> <br/><br/> <b>Method summary</b> <ul> <li><a rel="gsdoc" href="NSDecimalNumber.html#method$NSDecimalNumber+decimalNumberWithDecimal$">+decimalNumberWithDecimal:</a></li> <li><a rel="gsdoc" href="NSDecimalNumber.html#method$NSDecimalNumber+decimalNumberWithMantissa$exponent$isNegative$">+decimalNumberWithMantissa:exponent:isNegative:</a></li> <li><a rel="gsdoc" href="NSDecimalNumber.html#method$NSDecimalNumber+decimalNumberWithString$">+decimalNumberWithString:</a></li> <li><a rel="gsdoc" href="NSDecimalNumber.html#method$NSDecimalNumber+decimalNumberWithString$locale$">+decimalNumberWithString:locale:</a></li> <li><a rel="gsdoc" href="NSDecimalNumber.html#method$NSDecimalNumber+defaultBehavior">+defaultBehavior</a></li> <li><a rel="gsdoc" href="NSDecimalNumber.html#method$NSDecimalNumber+maximumDecimalNumber">+maximumDecimalNumber</a></li> <li><a rel="gsdoc" href="NSDecimalNumber.html#method$NSDecimalNumber+minimumDecimalNumber">+minimumDecimalNumber</a></li> <li><a rel="gsdoc" href="NSDecimalNumber.html#method$NSDecimalNumber+notANumber">+notANumber</a></li> <li><a rel="gsdoc" href="NSDecimalNumber.html#method$NSDecimalNumber+one">+one</a></li> <li><a rel="gsdoc" href="NSDecimalNumber.html#method$NSDecimalNumber+setDefaultBehavior$">+setDefaultBehavior:</a></li> <li><a rel="gsdoc" href="NSDecimalNumber.html#method$NSDecimalNumber+zero">+zero</a></li> <li><a rel="gsdoc" href="NSDecimalNumber.html#method$NSDecimalNumber-compare$">-compare:</a></li> <li><a rel="gsdoc" href="NSDecimalNumber.html#method$NSDecimalNumber-decimalNumberByAdding$">-decimalNumberByAdding:</a></li> <li><a rel="gsdoc" href="NSDecimalNumber.html#method$NSDecimalNumber-decimalNumberByAdding$withBehavior$">-decimalNumberByAdding:withBehavior:</a></li> <li><a rel="gsdoc" href="NSDecimalNumber.html#method$NSDecimalNumber-decimalNumberByDividingBy$">-decimalNumberByDividingBy:</a></li> <li><a rel="gsdoc" href="NSDecimalNumber.html#method$NSDecimalNumber-decimalNumberByDividingBy$withBehavior$">-decimalNumberByDividingBy:withBehavior:</a></li> <li><a rel="gsdoc" href="NSDecimalNumber.html#method$NSDecimalNumber-decimalNumberByMultiplyingBy$">-decimalNumberByMultiplyingBy:</a></li> <li><a rel="gsdoc" href="NSDecimalNumber.html#method$NSDecimalNumber-decimalNumberByMultiplyingBy$withBehavior$">-decimalNumberByMultiplyingBy:withBehavior:</a></li> <li><a rel="gsdoc" href="NSDecimalNumber.html#method$NSDecimalNumber-decimalNumberByMultiplyingByPowerOf10$">-decimalNumberByMultiplyingByPowerOf10:</a></li> <li><a rel="gsdoc" href="NSDecimalNumber.html#method$NSDecimalNumber-decimalNumberByMultiplyingByPowerOf10$withBehavior$">-decimalNumberByMultiplyingByPowerOf10:withBehavior:</a></li> <li><a rel="gsdoc" href="NSDecimalNumber.html#method$NSDecimalNumber-decimalNumberByRaisingToPower$">-decimalNumberByRaisingToPower:</a></li> <li><a rel="gsdoc" href="NSDecimalNumber.html#method$NSDecimalNumber-decimalNumberByRaisingToPower$withBehavior$">-decimalNumberByRaisingToPower:withBehavior:</a></li> <li><a rel="gsdoc" href="NSDecimalNumber.html#method$NSDecimalNumber-decimalNumberByRoundingAccordingToBehavior$">-decimalNumberByRoundingAccordingToBehavior:</a></li> <li><a rel="gsdoc" href="NSDecimalNumber.html#method$NSDecimalNumber-decimalNumberBySubtracting$">-decimalNumberBySubtracting:</a></li> <li><a rel="gsdoc" href="NSDecimalNumber.html#method$NSDecimalNumber-decimalNumberBySubtracting$withBehavior$">-decimalNumberBySubtracting:withBehavior:</a></li> <li><a rel="gsdoc" href="NSDecimalNumber.html#method$NSDecimalNumber-decimalValue">-decimalValue</a></li> <li><a rel="gsdoc" href="NSDecimalNumber.html#method$NSDecimalNumber-descriptionWithLocale$">-descriptionWithLocale:</a></li> <li><a rel="gsdoc" href="NSDecimalNumber.html#method$NSDecimalNumber-doubleValue">-doubleValue</a></li> <li><a rel="gsdoc" href="NSDecimalNumber.html#method$NSDecimalNumber-initWithDecimal$">-initWithDecimal:</a></li> <li><a rel="gsdoc" href="NSDecimalNumber.html#method$NSDecimalNumber-initWithMantissa$exponent$isNegative$">-initWithMantissa:exponent:isNegative:</a></li> <li><a rel="gsdoc" href="NSDecimalNumber.html#method$NSDecimalNumber-initWithString$">-initWithString:</a></li> <li><a rel="gsdoc" href="NSDecimalNumber.html#method$NSDecimalNumber-initWithString$locale$">-initWithString:locale:</a></li> <li><a rel="gsdoc" href="NSDecimalNumber.html#method$NSDecimalNumber-objCType">-objCType</a></li> </ul> <hr width="50%" align="left" /> <div class="method"> <h3><a name="method$NSDecimalNumber+decimalNumberWithDecimal$">decimalNumberWithDecimal: </a></h3> + (<a rel="gsdoc" href="#class$NSDecimalNumber">NSDecimalNumber</a>*) <b>decimalNumberWithDecimal:</b> (NSDecimal)decimal;<br /> <div class="availability"> <b>Availability:</b> MacOS-X 10.0.0</div> <br /> <div class="desc"> New instance with given value. Note an NSDecimal may be created using the function <a rel="gsdoc" href="Functions.html#function$NSDecimalFromString"> NSDecimalFromString() </a> . </div> <hr width="25%" align="left" /> </div> <div class="method"> <h3><a name="method$NSDecimalNumber+decimalNumberWithMantissa$exponent$isNegative$">decimalNumberWithMantissa: exponent: isNegative: </a></h3> + (<a rel="gsdoc" href="#class$NSDecimalNumber">NSDecimalNumber</a>*) <b>decimalNumberWithMantissa:</b> (unsigned long long)mantissa<b> exponent:</b> (short)exponent<b> isNegative:</b> (BOOL)isNegative;<br /> <div class="availability"> <b>Availability:</b> MacOS-X 10.0.0</div> <br /> <div class="desc"> New instance by component. Note that the precision of this initializer is limited. </div> <hr width="25%" align="left" /> </div> <div class="method"> <h3><a name="method$NSDecimalNumber+decimalNumberWithString$">decimalNumberWithString: </a></h3> + (<a rel="gsdoc" href="#class$NSDecimalNumber">NSDecimalNumber</a>*) <b>decimalNumberWithString:</b> (<a rel="gsdoc" href="NSString.html#class$NSString">NSString</a>*)numericString;<br /> <div class="availability"> <b>Availability:</b> MacOS-X 10.0.0</div> <br /> <div class="desc"> New instance from string. Arbitrary precision is preserved, though calling one of the <code>decimalNumberBy...</code> methods will return a result constrained by the current <em><code>scale</code></em>. Number format is parsed according to current default locale. </div> <hr width="25%" align="left" /> </div> <div class="method"> <h3><a name="method$NSDecimalNumber+decimalNumberWithString$locale$">decimalNumberWithString: locale: </a></h3> + (<a rel="gsdoc" href="#class$NSDecimalNumber">NSDecimalNumber</a>*) <b>decimalNumberWithString:</b> (<a rel="gsdoc" href="NSString.html#class$NSString">NSString</a>*)numericString<b> locale:</b> (<a rel="gsdoc" href="NSDictionary.html#class$NSDictionary">NSDictionary</a>*)locale;<br /> <div class="availability"> <b>Availability:</b> MacOS-X 10.0.0</div> <br /> <div class="desc"> New instance from string. Arbitrary precision is preserved, though calling one of the <code>decimalNumberBy...</code> methods will return a result constrained by the current <em><code>scale</code></em>. Number format is parsed according to given <var>locale</var>. </div> <hr width="25%" align="left" /> </div> <div class="method"> <h3><a name="method$NSDecimalNumber+defaultBehavior">defaultBehavior </a></h3> + (id<<a rel="gsdoc" href="#protocol$(NSDecimalNumberBehaviors)">NSDecimalNumberBehaviors</a>>) <b>defaultBehavior</b>;<br /> <div class="availability"> <b>Availability:</b> MacOS-X 10.0.0</div> <br /> <div class="desc"> Returns the default rounding/precision/exception handling behavior, which is same as <a rel="gsdoc" href="#method$NSDecimalNumberHandler+defaultDecimalNumberHandler">[NSDecimalNumberHandler +defaultDecimalNumberHandler]</a> unless it has been explicitly set otherwise. </div> <hr width="25%" align="left" /> </div> <div class="method"> <h3><a name="method$NSDecimalNumber+maximumDecimalNumber">maximumDecimalNumber </a></h3> + (<a rel="gsdoc" href="#class$NSDecimalNumber">NSDecimalNumber</a>*) <b>maximumDecimalNumber</b>;<br /> <div class="availability"> <b>Availability:</b> MacOS-X 10.0.0</div> <br /> <div class="desc"> Return maximum positive value that can be represented. </div> <hr width="25%" align="left" /> </div> <div class="method"> <h3><a name="method$NSDecimalNumber+minimumDecimalNumber">minimumDecimalNumber </a></h3> + (<a rel="gsdoc" href="#class$NSDecimalNumber">NSDecimalNumber</a>*) <b>minimumDecimalNumber</b>;<br /> <div class="availability"> <b>Availability:</b> MacOS-X 10.0.0</div> <br /> <div class="desc"> Return minimum negative value (<em>not</em> the smallest positive value) that can be represented. </div> <hr width="25%" align="left" /> </div> <div class="method"> <h3><a name="method$NSDecimalNumber+notANumber">notANumber </a></h3> + (<a rel="gsdoc" href="#class$NSDecimalNumber">NSDecimalNumber</a>*) <b>notANumber</b>;<br /> <div class="availability"> <b>Availability:</b> MacOS-X 10.0.0</div> <br /> <div class="desc"> Return a fixed value representing an NaN. </div> <hr width="25%" align="left" /> </div> <div class="method"> <h3><a name="method$NSDecimalNumber+one">one </a></h3> + (<a rel="gsdoc" href="#class$NSDecimalNumber">NSDecimalNumber</a>*) <b>one</b>;<br /> <div class="availability"> <b>Availability:</b> MacOS-X 10.0.0</div> <br /> <div class="desc"> Return a constant object with a value of one. </div> <hr width="25%" align="left" /> </div> <div class="method"> <h3><a name="method$NSDecimalNumber+setDefaultBehavior$">setDefaultBehavior: </a></h3> + (void) <b>setDefaultBehavior:</b> (id<<a rel="gsdoc" href="#protocol$(NSDecimalNumberBehaviors)">NSDecimalNumberBehaviors</a>>)behavior;<br /> <div class="availability"> <b>Availability:</b> MacOS-X 10.0.0</div> <br /> <div class="desc"> Sets the default rounding/precision/exception handling <var>behavior</var> to the given <var>behavior</var>. If this is not called, <var>behavior</var> defaults to <a rel="gsdoc" href="#method$NSDecimalNumberHandler+defaultDecimalNumberHandler">[NSDecimalNumberHandler +defaultDecimalNumberHandler]</a> . </div> <hr width="25%" align="left" /> </div> <div class="method"> <h3><a name="method$NSDecimalNumber+zero">zero </a></h3> + (<a rel="gsdoc" href="#class$NSDecimalNumber">NSDecimalNumber</a>*) <b>zero</b>;<br /> <div class="availability"> <b>Availability:</b> MacOS-X 10.0.0</div> <br /> <div class="desc"> Return a constant object with a value of zero. </div> <hr width="25%" align="left" /> </div> <div class="method"> <h3><a name="method$NSDecimalNumber-compare$">compare: </a></h3> - (<a rel="gsdoc" href="TypesAndConstants.html#type$NSComparisonResult">NSComparisonResult</a>) <b>compare:</b> (<a rel="gsdoc" href="NSValue.html#class$NSNumber">NSNumber</a>*)decimalNumber;<br /> <div class="availability"> <b>Availability:</b> MacOS-X 10.0.0</div> <br /> <div class="desc"> Compares with other number, returning less, greater, or equal. </div> <hr width="25%" align="left" /> </div> <div class="method"> <h3><a name="method$NSDecimalNumber-decimalNumberByAdding$">decimalNumberByAdding: </a></h3> - (<a rel="gsdoc" href="#class$NSDecimalNumber">NSDecimalNumber</a>*) <b>decimalNumberByAdding:</b> (<a rel="gsdoc" href="#class$NSDecimalNumber">NSDecimalNumber</a>*)decimalNumber;<br /> <div class="availability"> <b>Availability:</b> MacOS-X 10.0.0</div> <br /> <div class="desc"> Adds self to <var>decimalNumber</var> and returns new result, using <a rel="gsdoc" href="#method$NSDecimalNumber+defaultBehavior"> +defaultBehavior </a> for rounding/precision/error handling. </div> <hr width="25%" align="left" /> </div> <div class="method"> <h3><a name="method$NSDecimalNumber-decimalNumberByAdding$withBehavior$">decimalNumberByAdding: withBehavior: </a></h3> - (<a rel="gsdoc" href="#class$NSDecimalNumber">NSDecimalNumber</a>*) <b>decimalNumberByAdding:</b> (<a rel="gsdoc" href="#class$NSDecimalNumber">NSDecimalNumber</a>*)decimalNumber<b> withBehavior:</b> (id<<a rel="gsdoc" href="#protocol$(NSDecimalNumberBehaviors)">NSDecimalNumberBehaviors</a>>)behavior;<br /> <div class="availability"> <b>Availability:</b> MacOS-X 10.0.0</div> <br /> <div class="desc"> Adds self to <var>decimalNumber</var> and returns new result, using given <var>behavior</var> for rounding/precision/error handling. </div> <hr width="25%" align="left" /> </div> <div class="method"> <h3><a name="method$NSDecimalNumber-decimalNumberByDividingBy$">decimalNumberByDividingBy: </a></h3> - (<a rel="gsdoc" href="#class$NSDecimalNumber">NSDecimalNumber</a>*) <b>decimalNumberByDividingBy:</b> (<a rel="gsdoc" href="#class$NSDecimalNumber">NSDecimalNumber</a>*)decimalNumber;<br /> <div class="availability"> <b>Availability:</b> MacOS-X 10.0.0</div> <br /> <div class="desc"> Divides self by <var>decimalNumber</var> and returns new result, using <a rel="gsdoc" href="#method$NSDecimalNumber+defaultBehavior"> +defaultBehavior </a> for rounding/precision/error handling. </div> <hr width="25%" align="left" /> </div> <div class="method"> <h3><a name="method$NSDecimalNumber-decimalNumberByDividingBy$withBehavior$">decimalNumberByDividingBy: withBehavior: </a></h3> - (<a rel="gsdoc" href="#class$NSDecimalNumber">NSDecimalNumber</a>*) <b>decimalNumberByDividingBy:</b> (<a rel="gsdoc" href="#class$NSDecimalNumber">NSDecimalNumber</a>*)decimalNumber<b> withBehavior:</b> (id<<a rel="gsdoc" href="#protocol$(NSDecimalNumberBehaviors)">NSDecimalNumberBehaviors</a>>)behavior;<br /> <div class="availability"> <b>Availability:</b> MacOS-X 10.0.0</div> <br /> <div class="desc"> Divides self by <var>decimalNumber</var> and returns new result, using given <var>behavior</var> for rounding/precision/error handling. </div> <hr width="25%" align="left" /> </div> <div class="method"> <h3><a name="method$NSDecimalNumber-decimalNumberByMultiplyingBy$">decimalNumberByMultiplyingBy: </a></h3> - (<a rel="gsdoc" href="#class$NSDecimalNumber">NSDecimalNumber</a>*) <b>decimalNumberByMultiplyingBy:</b> (<a rel="gsdoc" href="#class$NSDecimalNumber">NSDecimalNumber</a>*)decimalNumber;<br /> <div class="availability"> <b>Availability:</b> MacOS-X 10.0.0</div> <br /> <div class="desc"> Multiplies self by <var>decimalNumber</var> and returns new result, using <a rel="gsdoc" href="#method$NSDecimalNumber+defaultBehavior"> +defaultBehavior </a> for rounding/precision/error handling. </div> <hr width="25%" align="left" /> </div> <div class="method"> <h3><a name="method$NSDecimalNumber-decimalNumberByMultiplyingBy$withBehavior$">decimalNumberByMultiplyingBy: withBehavior: </a></h3> - (<a rel="gsdoc" href="#class$NSDecimalNumber">NSDecimalNumber</a>*) <b>decimalNumberByMultiplyingBy:</b> (<a rel="gsdoc" href="#class$NSDecimalNumber">NSDecimalNumber</a>*)decimalNumber<b> withBehavior:</b> (id<<a rel="gsdoc" href="#protocol$(NSDecimalNumberBehaviors)">NSDecimalNumberBehaviors</a>>)behavior;<br /> <div class="availability"> <b>Availability:</b> MacOS-X 10.0.0</div> <br /> <div class="desc"> Multiplies self by <var>decimalNumber</var> and returns new result, using given <var>behavior</var> for rounding/precision/error handling. </div> <hr width="25%" align="left" /> </div> <div class="method"> <h3><a name="method$NSDecimalNumber-decimalNumberByMultiplyingByPowerOf10$">decimalNumberByMultiplyingByPowerOf10: </a></h3> - (<a rel="gsdoc" href="#class$NSDecimalNumber">NSDecimalNumber</a>*) <b>decimalNumberByMultiplyingByPowerOf10:</b> (short)power;<br /> <div class="availability"> <b>Availability:</b> MacOS-X 10.0.0</div> <br /> <div class="desc"> Multiplies self by given <var>power</var> of 10 and returns new result, using <a rel="gsdoc" href="#method$NSDecimalNumber+defaultBehavior"> +defaultBehavior </a> for rounding/precision/error handling. </div> <hr width="25%" align="left" /> </div> <div class="method"> <h3><a name="method$NSDecimalNumber-decimalNumberByMultiplyingByPowerOf10$withBehavior$">decimalNumberByMultiplyingByPowerOf10: withBehavior: </a></h3> - (<a rel="gsdoc" href="#class$NSDecimalNumber">NSDecimalNumber</a>*) <b>decimalNumberByMultiplyingByPowerOf10:</b> (short)power<b> withBehavior:</b> (id<<a rel="gsdoc" href="#protocol$(NSDecimalNumberBehaviors)">NSDecimalNumberBehaviors</a>>)behavior;<br /> <div class="availability"> <b>Availability:</b> MacOS-X 10.0.0</div> <br /> <div class="desc"> Multiplies self by given <var>power</var> of 10 and returns new result, using given <var>behavior</var> for rounding/precision/error handling. </div> <hr width="25%" align="left" /> </div> <div class="method"> <h3><a name="method$NSDecimalNumber-decimalNumberByRaisingToPower$">decimalNumberByRaisingToPower: </a></h3> - (<a rel="gsdoc" href="#class$NSDecimalNumber">NSDecimalNumber</a>*) <b>decimalNumberByRaisingToPower:</b> (<a rel="gsdoc" href="TypesAndConstants.html#type$NSUInteger">NSUInteger</a>)power;<br /> <div class="availability"> <b>Availability:</b> MacOS-X 10.0.0</div> <br /> <div class="desc"> Raises self to given positive integer <var>power</var> and returns new result, using <a rel="gsdoc" href="#method$NSDecimalNumber+defaultBehavior"> +defaultBehavior </a> for rounding/precision/error handling. </div> <hr width="25%" align="left" /> </div> <div class="method"> <h3><a name="method$NSDecimalNumber-decimalNumberByRaisingToPower$withBehavior$">decimalNumberByRaisingToPower: withBehavior: </a></h3> - (<a rel="gsdoc" href="#class$NSDecimalNumber">NSDecimalNumber</a>*) <b>decimalNumberByRaisingToPower:</b> (<a rel="gsdoc" href="TypesAndConstants.html#type$NSUInteger">NSUInteger</a>)power<b> withBehavior:</b> (id<<a rel="gsdoc" href="#protocol$(NSDecimalNumberBehaviors)">NSDecimalNumberBehaviors</a>>)behavior;<br /> <div class="availability"> <b>Availability:</b> MacOS-X 10.0.0</div> <br /> <div class="desc"> Raises self to given positive integer <var>power</var> and returns new result, using given <var>behavior</var> for rounding/precision/error handling. </div> <hr width="25%" align="left" /> </div> <div class="method"> <h3><a name="method$NSDecimalNumber-decimalNumberByRoundingAccordingToBehavior$">decimalNumberByRoundingAccordingToBehavior: </a></h3> - (<a rel="gsdoc" href="#class$NSDecimalNumber">NSDecimalNumber</a>*) <b>decimalNumberByRoundingAccordingToBehavior:</b> (id<<a rel="gsdoc" href="#protocol$(NSDecimalNumberBehaviors)">NSDecimalNumberBehaviors</a>>)behavior;<br /> <div class="availability"> <b>Availability:</b> MacOS-X 10.0.0</div> <br /> <div class="desc"> Returns rounded version of underlying decimal. </div> <hr width="25%" align="left" /> </div> <div class="method"> <h3><a name="method$NSDecimalNumber-decimalNumberBySubtracting$">decimalNumberBySubtracting: </a></h3> - (<a rel="gsdoc" href="#class$NSDecimalNumber">NSDecimalNumber</a>*) <b>decimalNumberBySubtracting:</b> (<a rel="gsdoc" href="#class$NSDecimalNumber">NSDecimalNumber</a>*)decimalNumber;<br /> <div class="availability"> <b>Availability:</b> MacOS-X 10.0.0</div> <br /> <div class="desc"> Subtracts <var>decimalNumber</var> from self and returns new result, using <a rel="gsdoc" href="#method$NSDecimalNumber+defaultBehavior"> +defaultBehavior </a> for rounding/precision/error handling. </div> <hr width="25%" align="left" /> </div> <div class="method"> <h3><a name="method$NSDecimalNumber-decimalNumberBySubtracting$withBehavior$">decimalNumberBySubtracting: withBehavior: </a></h3> - (<a rel="gsdoc" href="#class$NSDecimalNumber">NSDecimalNumber</a>*) <b>decimalNumberBySubtracting:</b> (<a rel="gsdoc" href="#class$NSDecimalNumber">NSDecimalNumber</a>*)decimalNumber<b> withBehavior:</b> (id<<a rel="gsdoc" href="#protocol$(NSDecimalNumberBehaviors)">NSDecimalNumberBehaviors</a>>)behavior;<br /> <div class="availability"> <b>Availability:</b> MacOS-X 10.0.0</div> <br /> <div class="desc"> Subtracts <var>decimalNumber</var> from self and returns new result, using given <var>behavior</var> for rounding/precision/error handling. </div> <hr width="25%" align="left" /> </div> <div class="method"> <h3><a name="method$NSDecimalNumber-decimalValue">decimalValue </a></h3> - (NSDecimal) <b>decimalValue</b>;<br /> <div class="availability"> <b>Availability:</b> MacOS-X 10.0.0</div> <br /> <div class="desc"> Return underlying value as an <code>NSDecimal</code> structure. </div> <hr width="25%" align="left" /> </div> <div class="method"> <h3><a name="method$NSDecimalNumber-descriptionWithLocale$">descriptionWithLocale: </a></h3> - (<a rel="gsdoc" href="NSString.html#class$NSString">NSString</a>*) <b>descriptionWithLocale:</b> (id)locale;<br /> <div class="availability"> <b>Availability:</b> MacOS-X 10.0.0</div> <br /> <div class="desc"> Returns string version of number formatted according to <var>locale</var>. </div> <hr width="25%" align="left" /> </div> <div class="method"> <h3><a name="method$NSDecimalNumber-doubleValue">doubleValue </a></h3> - (double) <b>doubleValue</b>;<br /> <div class="availability"> <b>Availability:</b> MacOS-X 10.0.0</div> <br /> <div class="desc"> Returns underlying value as a <code><strong>double</strong></code>, which may be an approximation if precision greater than the default of 38. </div> <hr width="25%" align="left" /> </div> <div class="method"> <h3><a name="method$NSDecimalNumber-initWithDecimal$">initWithDecimal: </a></h3> - (id) <b>initWithDecimal:</b> (NSDecimal)decimal;<br /> <div class="availability"> <b>Availability:</b> MacOS-X 10.0.0</div> <br /> <div class="desc"> Initialize with given value. Note an NSDecimal may be created using the function <a rel="gsdoc" href="Functions.html#function$NSDecimalFromString"> NSDecimalFromString() </a> . </div> <hr width="25%" align="left" /> </div> <div class="method"> <h3><a name="method$NSDecimalNumber-initWithMantissa$exponent$isNegative$">initWithMantissa: exponent: isNegative: </a></h3> - (id) <b>initWithMantissa:</b> (unsigned long long)mantissa<b> exponent:</b> (short)exponent<b> isNegative:</b> (BOOL)flag;<br /> <div class="availability"> <b>Availability:</b> MacOS-X 10.0.0</div> <br /> <div class="desc"> Initialize by component. Note that the precision of this initializer is limited. </div> <hr width="25%" align="left" /> </div> <div class="method"> <h3><a name="method$NSDecimalNumber-initWithString$">initWithString: </a></h3> - (id) <b>initWithString:</b> (<a rel="gsdoc" href="NSString.html#class$NSString">NSString</a>*)numberValue;<br /> <div class="availability"> <b>Availability:</b> MacOS-X 10.0.0</div> <br /> <div class="desc"> Initialize from string. Arbitrary precision is preserved, though calling one of the <code>decimalNumberBy...</code> methods will return a result constrained by the current <em><code>scale</code></em>. Number format is parsed according to current default locale. </div> <hr width="25%" align="left" /> </div> <div class="method"> <h3><a name="method$NSDecimalNumber-initWithString$locale$">initWithString: locale: </a></h3> - (id) <b>initWithString:</b> (<a rel="gsdoc" href="NSString.html#class$NSString">NSString</a>*)numberValue<b> locale:</b> (<a rel="gsdoc" href="NSDictionary.html#class$NSDictionary">NSDictionary</a>*)locale;<br /> <div class="availability"> <b>Availability:</b> MacOS-X 10.0.0</div> <br /> <div class="desc"> Initialize from string. Arbitrary precision is preserved, though calling one of the <code>decimalNumberBy...</code> methods will return a result constrained by the current <em><code>scale</code></em>. Number format is parsed according to given <var>locale</var>. </div> <hr width="25%" align="left" /> </div> <div class="method"> <h3><a name="method$NSDecimalNumber-objCType">objCType </a></h3> - (const char*) <b>objCType</b>;<br /> <div class="availability"> <b>Availability:</b> MacOS-X 10.0.0</div> <br /> <div class="desc"> Returns the Objective-C type ( <code>@encode(...)</code> compatible) of the data contained <code>NSDecimalNumber</code>, which is by convention "d" (for <strong>double</strong>), even though this is not strictly accurate. </div> <hr width="25%" align="left" /> </div> <a name="_NSDecimalNumber_ivars"/> <br/><hr width="50%" align="left" /> <h2>Instance Variables for NSDecimalNumber Class</h2> <h3><a name="ivariable$NSDecimalNumber*data">data</a></h3> @protected NSDecimal <b>data</b>;<br /> <div class="availability"> <b>Availability:</b> MacOS-X 10.0.0</div> <br /> <div class="desc"> <em>Description forthcoming.</em> </div> <hr width="25%" align="left" /> <br/><hr width="50%" align="left" /><br/> <h1><a name="002000000000"> Software documentation for the NSDecimalNumberHandler class </a></h1> <h2><a name="class$NSDecimalNumberHandler">NSDecimalNumberHandler</a> : <a rel="gsdoc" href="NSObject.html#class$NSObject">NSObject</a></h2> <blockquote class="declared"> <dl> <dt><b>Declared in:</b></dt> <dd>Foundation/NSDecimalNumber.h</dd> </dl> </blockquote> <blockquote> <dl> <dt><b>Conforms to:</b></dt> <dd><a rel="gsdoc" href="#protocol$(NSDecimalNumberBehaviors)">NSDecimalNumberBehaviors</a></dd> </dl> </blockquote> <div class="availability"> <b>Availability:</b> MacOS-X 10.0.0</div> <br /> <div class="desc"> A utility class adopting <a rel="gsdoc" href="#protocol$(NSDecimalNumberBehaviors)"><NSDecimalNumberBehaviors></a> protocol. Can be used to control <a rel="gsdoc" href="#class$NSDecimalNumber">NSDecimalNumber</a> rounding and exception-handling behavior, by passing an instance as an argument to any <a rel="gsdoc" href="#class$NSDecimalNumber">NSDecimalNumber</a> method ending with <code>...Behavior:</code>. </div> <hr width="50%" align="left" /> <a href="#_NSDecimalNumberHandler_ivars">Instance Variables</a> <br/><br/> <b>Method summary</b> <ul> <li><a rel="gsdoc" href="NSDecimalNumber.html#method$NSDecimalNumberHandler+decimalNumberHandlerWithRoundingMode$scale$raiseOnExactness$raiseOnOverflow$raiseOnUnderflow$raiseOnDivideByZero$">+decimalNumberHandlerWithRoundingMode:scale:raiseOnExactness:raiseOnOverflow:raiseOnUnderflow:raiseOnDivideByZero:</a></li> <li><a rel="gsdoc" href="NSDecimalNumber.html#method$NSDecimalNumberHandler+defaultDecimalNumberHandler">+defaultDecimalNumberHandler</a></li> <li><a rel="gsdoc" href="NSDecimalNumber.html#method$NSDecimalNumberHandler-initWithRoundingMode$scale$raiseOnExactness$raiseOnOverflow$raiseOnUnderflow$raiseOnDivideByZero$">-initWithRoundingMode:scale:raiseOnExactness:raiseOnOverflow:raiseOnUnderflow:raiseOnDivideByZero:</a></li> </ul> <hr width="50%" align="left" /> <div class="method"> <h3><a name="method$NSDecimalNumberHandler+decimalNumberHandlerWithRoundingMode$scale$raiseOnExactness$raiseOnOverflow$raiseOnUnderflow$raiseOnDivideByZero$">decimalNumberHandlerWithRoundingMode: scale: raiseOnExactness: raiseOnOverflow: raiseOnUnderflow: raiseOnDivideByZero: </a></h3> + (id) <b>decimalNumberHandlerWithRoundingMode:</b> (<a rel="gsdoc" href="TypesAndConstants.html#type$NSRoundingMode">NSRoundingMode</a>)roundingMode<b> scale:</b> (short)scale<b> raiseOnExactness:</b> (BOOL)raiseOnExactness<b> raiseOnOverflow:</b> (BOOL)raiseOnOverflow<b> raiseOnUnderflow:</b> (BOOL)raiseOnUnderflow<b> raiseOnDivideByZero:</b> (BOOL)raiseOnDivideByZero;<br /> <div class="availability"> <b>Availability:</b> MacOS-X 10.0.0</div> <br /> <div class="desc"> Constructor setting all behavior. (For more precise control over error handling, create your own class implementing the <a rel="gsdoc" href="#protocol$(NSDecimalNumberBehaviors)"><NSDecimalNumberBehaviors></a> protocol.) </div> <hr width="25%" align="left" /> </div> <div class="method"> <h3><a name="method$NSDecimalNumberHandler+defaultDecimalNumberHandler">defaultDecimalNumberHandler </a></h3> + (id) <b>defaultDecimalNumberHandler</b>;<br /> <div class="availability"> <b>Availability:</b> MacOS-X 10.0.0</div> <br /> <div class="desc"> Provides an instance implementing the default behavior for the <a rel="gsdoc" href="#class$NSDecimalNumber">NSDecimalNumber</a> class. 38 decimal digits, rounded to closest return value (<code>NSRoundPlain</code>). Exceptions raised on overflow, underflow, and divide by zero. </div> <hr width="25%" align="left" /> </div> <div class="method"> <h3><a name="method$NSDecimalNumberHandler-initWithRoundingMode$scale$raiseOnExactness$raiseOnOverflow$raiseOnUnderflow$raiseOnDivideByZero$">initWithRoundingMode: scale: raiseOnExactness: raiseOnOverflow: raiseOnUnderflow: raiseOnDivideByZero: </a></h3> - (id) <b>initWithRoundingMode:</b> (<a rel="gsdoc" href="TypesAndConstants.html#type$NSRoundingMode">NSRoundingMode</a>)roundingMode<b> scale:</b> (short)scale<b> raiseOnExactness:</b> (BOOL)raiseOnExactness<b> raiseOnOverflow:</b> (BOOL)raiseOnOverflow<b> raiseOnUnderflow:</b> (BOOL)raiseOnUnderflow<b> raiseOnDivideByZero:</b> (BOOL)raiseOnDivideByZero;<br /> <div class="availability"> <b>Availability:</b> MacOS-X 10.0.0</div> <br /> <div class="desc"> Initializer setting all behavior. (For more precise control over error handling, create your own class implementing the <a rel="gsdoc" href="#protocol$(NSDecimalNumberBehaviors)"><NSDecimalNumberBehaviors></a> protocol.) </div> <hr width="25%" align="left" /> </div> <a name="_NSDecimalNumberHandler_ivars"/> <br/><hr width="50%" align="left" /> <h2>Instance Variables for NSDecimalNumberHandler Class</h2> <h3><a name="ivariable$NSDecimalNumberHandler*_raiseOnDivideByZero">_raiseOnDivideByZero</a></h3> @protected BOOL <b>_raiseOnDivideByZero</b>;<br /> <div class="availability"> <b>Availability:</b> MacOS-X 10.0.0</div> <br /> <div class="desc"> <em>Warning</em> the underscore at the start of the name of this instance variable indicates that, even though it is not technically <em>private</em>, it is intended for internal use within the package, and you should not use the variable in other code. </div> <hr width="25%" align="left" /> <h3><a name="ivariable$NSDecimalNumberHandler*_raiseOnExactness">_raiseOnExactness</a></h3> @protected BOOL <b>_raiseOnExactness</b>;<br /> <div class="availability"> <b>Availability:</b> MacOS-X 10.0.0</div> <br /> <div class="desc"> <em>Warning</em> the underscore at the start of the name of this instance variable indicates that, even though it is not technically <em>private</em>, it is intended for internal use within the package, and you should not use the variable in other code. </div> <hr width="25%" align="left" /> <h3><a name="ivariable$NSDecimalNumberHandler*_raiseOnOverflow">_raiseOnOverflow</a></h3> @protected BOOL <b>_raiseOnOverflow</b>;<br /> <div class="availability"> <b>Availability:</b> MacOS-X 10.0.0</div> <br /> <div class="desc"> <em>Warning</em> the underscore at the start of the name of this instance variable indicates that, even though it is not technically <em>private</em>, it is intended for internal use within the package, and you should not use the variable in other code. </div> <hr width="25%" align="left" /> <h3><a name="ivariable$NSDecimalNumberHandler*_raiseOnUnderflow">_raiseOnUnderflow</a></h3> @protected BOOL <b>_raiseOnUnderflow</b>;<br /> <div class="availability"> <b>Availability:</b> MacOS-X 10.0.0</div> <br /> <div class="desc"> <em>Warning</em> the underscore at the start of the name of this instance variable indicates that, even though it is not technically <em>private</em>, it is intended for internal use within the package, and you should not use the variable in other code. </div> <hr width="25%" align="left" /> <h3><a name="ivariable$NSDecimalNumberHandler*_roundingMode">_roundingMode</a></h3> @protected NSRoundingMode <b>_roundingMode</b>;<br /> <div class="availability"> <b>Availability:</b> MacOS-X 10.0.0</div> <br /> <div class="desc"> <em>Warning</em> the underscore at the start of the name of this instance variable indicates that, even though it is not technically <em>private</em>, it is intended for internal use within the package, and you should not use the variable in other code. </div> <hr width="25%" align="left" /> <h3><a name="ivariable$NSDecimalNumberHandler*_scale">_scale</a></h3> @protected short int <b>_scale</b>;<br /> <div class="availability"> <b>Availability:</b> MacOS-X 10.0.0</div> <br /> <div class="desc"> <em>Warning</em> the underscore at the start of the name of this instance variable indicates that, even though it is not technically <em>private</em>, it is intended for internal use within the package, and you should not use the variable in other code. </div> <hr width="25%" align="left" /> <br/><hr width="50%" align="left" /><br/> <h1><a name="003000000000"> Software documentation for the NSNumber(NSDecimalNumber) category </a></h1> <h2><a rel="gsdoc" href="NSValue.html#class$NSNumber">NSNumber</a>(<a name="category$NSNumber(NSDecimalNumber)">NSDecimalNumber</a>)</h2> <blockquote class="declared"> <dl> <dt><b>Declared in:</b></dt> <dd>Foundation/NSDecimalNumber.h</dd> </dl> </blockquote> <div class="availability"> <b>Availability:</b> MacOS-X 10.0.0</div> <br /> <div class="desc"> Interface for obtaining an NSDecimalNumber value from an ordinary NSNumber. </div> <b>Method summary</b> <ul> <li><a rel="gsdoc" href="NSDecimalNumber.html#method$NSNumber(NSDecimalNumber)-decimalValue">-decimalValue</a></li> </ul> <hr width="50%" align="left" /> <div class="method"> <h3><a name="method$NSNumber(NSDecimalNumber)-decimalValue">decimalValue </a></h3> - (NSDecimal) <b>decimalValue</b>;<br /> <div class="availability"> <b>Availability:</b> MacOS-X 10.0.0</div> <br /> <div class="desc"> Obtaining an NSDecimalNumber version of an ordinary NSNumber. <br /> Returns an NSDecimal representation of the number. Float and <strong>double</strong> values may not be converted exactly </div> <hr width="25%" align="left" /> </div> <h1><a name="004000000000"> Software documentation for the NSDecimalNumberBehaviors protocol </a></h1> <h2><a name="protocol$(NSDecimalNumberBehaviors)">NSDecimalNumberBehaviors</a></h2> <blockquote class="declared"> <dl> <dt><b>Declared in:</b></dt> <dd>Foundation/NSDecimalNumber.h</dd> </dl> </blockquote> <div class="availability"> <b>Availability:</b> MacOS-X 10.0.0</div> <br /> <div class="desc"> This protocol encapsulates information about how an <a rel="gsdoc" href="#class$NSDecimalNumber">NSDecimalNumber</a> should round and process exceptions. Usually you can just create objects of the <a rel="gsdoc" href="#class$NSDecimalNumberHandler">NSDecimalNumberHandler</a> class, which implements this protocol, but if you don't want to use that class you can create your own implementing it. </div> <b>Method summary</b> <ul> <li><a rel="gsdoc" href="NSDecimalNumber.html#method$(NSDecimalNumberBehaviors)-exceptionDuringOperation$error$leftOperand$rightOperand$">-exceptionDuringOperation:error:leftOperand:rightOperand:</a></li> <li><a rel="gsdoc" href="NSDecimalNumber.html#method$(NSDecimalNumberBehaviors)-roundingMode">-roundingMode</a></li> <li><a rel="gsdoc" href="NSDecimalNumber.html#method$(NSDecimalNumberBehaviors)-scale">-scale</a></li> </ul> <hr width="50%" align="left" /> <div class="method"> <h3><a name="method$(NSDecimalNumberBehaviors)-exceptionDuringOperation$error$leftOperand$rightOperand$">exceptionDuringOperation: error: leftOperand: rightOperand: </a></h3> - (<a rel="gsdoc" href="#class$NSDecimalNumber">NSDecimalNumber</a>*) <b>exceptionDuringOperation:</b> (SEL)method<b> error:</b> (<a rel="gsdoc" href="TypesAndConstants.html#type$NSCalculationError">NSCalculationError</a>)error<b> leftOperand:</b> (<a rel="gsdoc" href="#class$NSDecimalNumber">NSDecimalNumber</a>*)leftOperand<b> rightOperand:</b> (<a rel="gsdoc" href="#class$NSDecimalNumber">NSDecimalNumber</a>*)rightOperand;<br /> <div class="availability"> <b>Availability:</b> MacOS-X 10.0.0</div> <br /> <div class="desc"> </p> <p> Specifies behavior when, in the course of applying <var>method</var> to <var>leftOperand</var> and <var>rightOperand</var>, an <a rel="gsdoc" href="#class$NSDecimalNumber">NSDecimalNumber</a> instance encounters given <var>error</var>. </p> <p> </p> <p> <var>error</var> has four possible constant values: </p> <p> <dl> <dt> <code>NSCalculationLossOfPrecision</code> </dt> <dd> The number can't be represented in 38 significant digits. </dd> <dt><code>NSCalculationOverflow</code></dt> <dd> The number is too large to represent. </dd> <dt><code>NSCalculationUnderflow</code></dt> <dd> The number is too small to represent. </dd> <dt> <code>NSCalculationDivideByZero</code> </dt> <dd> The caller tried to divide by 0. </dd> </dl> </p> <p> Behavior on <var>error</var> can be one of the following: </p> <p> <ul> <li> Raise an exception. </li> <li> Return <code>nil</code>. The calling <var>method</var> will return its value as though no <var>error</var> had occurred. If <var>error</var> is <code>NSCalculationLossOfPrecision</code>, <var>method</var> will return an imprecise value, constrained to 38 significant digits. If <var>error</var> is <code>NSCalculationUnderflow</code> or <code>NSCalculationOverflow</code>, <var>method</var> will return <code>NSDecimalNumber</code> 's <code>notANumber</code>. You shouldn't return <code>nil</code> if <var>error</var> is <code>NSDivideByZero</code>. </li> <li> Correct the <var>error</var> and return a valid <code>NSDecimalNumber</code>. The calling <var>method</var> will use this as its own return value. </li> </ul> </div> <hr width="25%" align="left" /> </div> <div class="method"> <h3><a name="method$(NSDecimalNumberBehaviors)-roundingMode">roundingMode </a></h3> - (<a rel="gsdoc" href="TypesAndConstants.html#type$NSRoundingMode">NSRoundingMode</a>) <b>roundingMode</b>;<br /> <div class="availability"> <b>Availability:</b> MacOS-X 10.0.0</div> <br /> <div class="desc"> Specifies how <a rel="gsdoc" href="#class$NSDecimalNumber">NSDecimalNumber</a> 's <code>decimalNumberBy...</code> methods round their return values. This should be set to one of the following constants: <dl> <dt><code>NSRoundDown</code></dt> <dd> Always round down. </dd> <dt><code>NSRoundUp</code></dt> <dd> Always round up. </dd> <dt><code>NSRoundPlain</code></dt> <dd> Round to the closest possible return value. Halfway (e.g..5) rounds up for positive numbers, down for negative (towards larger absolute value). </dd> <dt><code>NSRoundBankers</code></dt> <dd> Round to the closest possible return value, but halfway (e.g..5) rounds towards possibility whose last digit is even. </dd> </dl> </div> <hr width="25%" align="left" /> </div> <div class="method"> <h3><a name="method$(NSDecimalNumberBehaviors)-scale">scale </a></h3> - (short) <b>scale</b>;<br /> <div class="availability"> <b>Availability:</b> MacOS-X 10.0.0</div> <br /> <div class="desc"> Specifies the precision of the values returned by <a rel="gsdoc" href="#class$NSDecimalNumber">NSDecimalNumber</a> 's <code>decimalNumberBy...</code> methods, in terms of the number of digits allowed after the decimal point. This can be negative, implying that the precision should be, e.g., 100's, 1000's, etc.. For unlimited precision, set to <code>NSDecimalNoScale</code>. </div> <hr width="25%" align="left" /> </div> <br /> <a href="Base.html">Up</a> </font> </body> </html>