<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/book.bc.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'de',
  ),
  'this' => 
  array (
    0 => 'class.bcmath-number.php',
    1 => 'BcMath\\Number',
    2 => 'The BcMath\\Number class',
  ),
  'up' => 
  array (
    0 => 'book.bc.php',
    1 => 'BC Math',
  ),
  'prev' => 
  array (
    0 => 'function.bcsub.php',
    1 => 'bcsub',
  ),
  'next' => 
  array (
    0 => 'bcmath-number.add.php',
    1 => 'BcMath\\Number::add',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/bc/bcmath.number.xml',
  ),
  'history' => 
  array (
  ),
  'extra_header_links' => 
  array (
    'rel' => 'alternate',
    'href' => '/manual/en/feeds/class.bcmath-number.atom',
    'type' => 'application/atom+xml',
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="class.bcmath-number" class="reference">

 <h1 class="title">The BcMath\Number class</h1>
 

 <div class="partintro"><p class="verinfo">(PHP 8 &gt;= 8.4.0)</p>
  <div class="section" id="bcmath-number.intro">
   <h2 class="title">Einführung</h2>
   <p class="simpara">
    A class for an arbitrary precision number.
    These objects support overloaded
    <a href="language.operators.arithmetic.php" class="link">arithmetic</a> and
    <a href="language.operators.comparison.php" class="link">comparison</a> operators.
   </p>

   <blockquote class="note"><p><strong class="note">Hinweis</strong>: 
    <span class="simpara">
     This class is not affected by the
     <a href="bc.configuration.php#ini.bcmath.scale" class="link">bcmath.scale</a>
     INI directive set in <var class="filename">php.ini</var>.
    </span>
   </p></blockquote>

   <blockquote class="note"><p><strong class="note">Hinweis</strong>: 
    <span class="simpara">
     The behavior of an overloaded operator is the same as specifying <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong> for the
     <code class="parameter">scale</code> parameter on the corresponding method.
    </span>
   </p></blockquote>
  </div>

  <div class="section" id="bcmath-number.synopsis">
   <h2 class="title">Klassenbeschreibung</h2>

   <div class="classsynopsis"><div class="classsynopsisinfo">
    <span class="modifier">namespace</span> <strong class="package">BcMath</strong>;</div>

    <div class="classsynopsisinfo">
     
      <span class="modifier">final</span>
      <span class="modifier">readonly</span>
      <span class="modifier">class</span> <strong class="classname"><strong class="classname">Number</strong></strong>
     

     
      <span class="modifier">implements</span>
       <a href="class.stringable.php" class="interfacename">Stringable</a> {</div>

     <div class="classsynopsisinfo classsynopsisinfo_comment">/* Eigenschaften */</div>
     <div class="fieldsynopsis">
      <span class="modifier">public</span>
      <span class="type"><a href="language.types.string.php" class="type string">string</a></span>
       <var class="varname"><a href="class.bcmath-number.php#bcmath-number.props.value">$<var class="varname">value</var></a></var>;</div>

     <div class="fieldsynopsis"><span class="modifier">public</span>
      <span class="type"><a href="language.types.integer.php" class="type int">int</a></span>
       <var class="varname"><a href="class.bcmath-number.php#bcmath-number.props.scale">$<var class="varname">scale</var></a></var>;</div>


     <div class="classsynopsisinfo classsynopsisinfo_comment">/* Methoden */</div>
     <div class="constructorsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><a href="bcmath-number.construct.php" class="methodname">__construct</a></span>(<span class="methodparam"><span class="type"><span class="type"><a href="language.types.string.php" class="type string">string</a></span>|<span class="type"><a href="language.types.integer.php" class="type int">int</a></span></span> <code class="parameter">$num</code></span>)</div>

     <div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="bcmath-number.add.php" class="methodname">add</a></span>(<span class="methodparam"><span class="type"><span class="type"><a href="class.bcmath-number.php" class="type BcMath\Number">BcMath\Number</a></span>|<span class="type"><a href="language.types.string.php" class="type string">string</a></span>|<span class="type"><a href="language.types.integer.php" class="type int">int</a></span></span> <code class="parameter">$num</code></span>, <span class="methodparam"><span class="type"><span class="type"><a href="language.types.null.php" class="type null">?</a></span><span class="type"><a href="language.types.integer.php" class="type int">int</a></span></span> <code class="parameter">$scale</code><span class="initializer"> = <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong></span></span>): <span class="type"><a href="class.bcmath-number.php" class="type BcMath\Number">BcMath\Number</a></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="bcmath-number.ceil.php" class="methodname">ceil</a></span>(): <span class="type"><a href="class.bcmath-number.php" class="type BcMath\Number">BcMath\Number</a></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="bcmath-number.compare.php" class="methodname">compare</a></span>(<span class="methodparam"><span class="type"><span class="type"><a href="class.bcmath-number.php" class="type BcMath\Number">BcMath\Number</a></span>|<span class="type"><a href="language.types.string.php" class="type string">string</a></span>|<span class="type"><a href="language.types.integer.php" class="type int">int</a></span></span> <code class="parameter">$num</code></span>, <span class="methodparam"><span class="type"><span class="type"><a href="language.types.null.php" class="type null">?</a></span><span class="type"><a href="language.types.integer.php" class="type int">int</a></span></span> <code class="parameter">$scale</code><span class="initializer"> = <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong></span></span>): <span class="type"><a href="language.types.integer.php" class="type int">int</a></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="bcmath-number.div.php" class="methodname">div</a></span>(<span class="methodparam"><span class="type"><span class="type"><a href="class.bcmath-number.php" class="type BcMath\Number">BcMath\Number</a></span>|<span class="type"><a href="language.types.string.php" class="type string">string</a></span>|<span class="type"><a href="language.types.integer.php" class="type int">int</a></span></span> <code class="parameter">$num</code></span>, <span class="methodparam"><span class="type"><span class="type"><a href="language.types.null.php" class="type null">?</a></span><span class="type"><a href="language.types.integer.php" class="type int">int</a></span></span> <code class="parameter">$scale</code><span class="initializer"> = <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong></span></span>): <span class="type"><a href="class.bcmath-number.php" class="type BcMath\Number">BcMath\Number</a></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="bcmath-number.divmod.php" class="methodname">divmod</a></span>(<span class="methodparam"><span class="type"><span class="type"><a href="class.bcmath-number.php" class="type BcMath\Number">BcMath\Number</a></span>|<span class="type"><a href="language.types.string.php" class="type string">string</a></span>|<span class="type"><a href="language.types.integer.php" class="type int">int</a></span></span> <code class="parameter">$num</code></span>, <span class="methodparam"><span class="type"><span class="type"><a href="language.types.null.php" class="type null">?</a></span><span class="type"><a href="language.types.integer.php" class="type int">int</a></span></span> <code class="parameter">$scale</code><span class="initializer"> = <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong></span></span>): <span class="type"><a href="language.types.array.php" class="type array">array</a></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="bcmath-number.floor.php" class="methodname">floor</a></span>(): <span class="type"><a href="class.bcmath-number.php" class="type BcMath\Number">BcMath\Number</a></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="bcmath-number.mod.php" class="methodname">mod</a></span>(<span class="methodparam"><span class="type"><span class="type"><a href="class.bcmath-number.php" class="type BcMath\Number">BcMath\Number</a></span>|<span class="type"><a href="language.types.string.php" class="type string">string</a></span>|<span class="type"><a href="language.types.integer.php" class="type int">int</a></span></span> <code class="parameter">$num</code></span>, <span class="methodparam"><span class="type"><span class="type"><a href="language.types.null.php" class="type null">?</a></span><span class="type"><a href="language.types.integer.php" class="type int">int</a></span></span> <code class="parameter">$scale</code><span class="initializer"> = <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong></span></span>): <span class="type"><a href="class.bcmath-number.php" class="type BcMath\Number">BcMath\Number</a></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="bcmath-number.mul.php" class="methodname">mul</a></span>(<span class="methodparam"><span class="type"><span class="type"><a href="class.bcmath-number.php" class="type BcMath\Number">BcMath\Number</a></span>|<span class="type"><a href="language.types.string.php" class="type string">string</a></span>|<span class="type"><a href="language.types.integer.php" class="type int">int</a></span></span> <code class="parameter">$num</code></span>, <span class="methodparam"><span class="type"><span class="type"><a href="language.types.null.php" class="type null">?</a></span><span class="type"><a href="language.types.integer.php" class="type int">int</a></span></span> <code class="parameter">$scale</code><span class="initializer"> = <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong></span></span>): <span class="type"><a href="class.bcmath-number.php" class="type BcMath\Number">BcMath\Number</a></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="bcmath-number.pow.php" class="methodname">pow</a></span>(<span class="methodparam"><span class="type"><span class="type"><a href="class.bcmath-number.php" class="type BcMath\Number">BcMath\Number</a></span>|<span class="type"><a href="language.types.string.php" class="type string">string</a></span>|<span class="type"><a href="language.types.integer.php" class="type int">int</a></span></span> <code class="parameter">$exponent</code></span>, <span class="methodparam"><span class="type"><span class="type"><a href="language.types.null.php" class="type null">?</a></span><span class="type"><a href="language.types.integer.php" class="type int">int</a></span></span> <code class="parameter">$scale</code><span class="initializer"> = <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong></span></span>): <span class="type"><a href="class.bcmath-number.php" class="type BcMath\Number">BcMath\Number</a></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="bcmath-number.powmod.php" class="methodname">powmod</a></span>(<span class="methodparam"><span class="type"><span class="type"><a href="class.bcmath-number.php" class="type BcMath\Number">BcMath\Number</a></span>|<span class="type"><a href="language.types.string.php" class="type string">string</a></span>|<span class="type"><a href="language.types.integer.php" class="type int">int</a></span></span> <code class="parameter">$exponent</code></span>, <span class="methodparam"><span class="type"><span class="type"><a href="class.bcmath-number.php" class="type BcMath\Number">BcMath\Number</a></span>|<span class="type"><a href="language.types.string.php" class="type string">string</a></span>|<span class="type"><a href="language.types.integer.php" class="type int">int</a></span></span> <code class="parameter">$modulus</code></span>, <span class="methodparam"><span class="type"><span class="type"><a href="language.types.null.php" class="type null">?</a></span><span class="type"><a href="language.types.integer.php" class="type int">int</a></span></span> <code class="parameter">$scale</code><span class="initializer"> = <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong></span></span>): <span class="type"><a href="class.bcmath-number.php" class="type BcMath\Number">BcMath\Number</a></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="bcmath-number.round.php" class="methodname">round</a></span>(<span class="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$precision</code><span class="initializer"> = 0</span></span>, <span class="methodparam"><span class="type"><a href="enum.roundingmode.php" class="type RoundingMode">RoundingMode</a></span> <code class="parameter">$mode</code><span class="initializer"> = <strong><code>RoundingMode::HalfAwayFromZero</code></strong></span></span>): <span class="type"><a href="class.bcmath-number.php" class="type BcMath\Number">BcMath\Number</a></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="bcmath-number.serialize.php" class="methodname">__serialize</a></span>(): <span class="type"><a href="language.types.array.php" class="type array">array</a></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="bcmath-number.sqrt.php" class="methodname">sqrt</a></span>(<span class="methodparam"><span class="type"><span class="type"><a href="language.types.null.php" class="type null">?</a></span><span class="type"><a href="language.types.integer.php" class="type int">int</a></span></span> <code class="parameter">$scale</code><span class="initializer"> = <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong></span></span>): <span class="type"><a href="class.bcmath-number.php" class="type BcMath\Number">BcMath\Number</a></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="bcmath-number.sub.php" class="methodname">sub</a></span>(<span class="methodparam"><span class="type"><span class="type"><a href="class.bcmath-number.php" class="type BcMath\Number">BcMath\Number</a></span>|<span class="type"><a href="language.types.string.php" class="type string">string</a></span>|<span class="type"><a href="language.types.integer.php" class="type int">int</a></span></span> <code class="parameter">$num</code></span>, <span class="methodparam"><span class="type"><span class="type"><a href="language.types.null.php" class="type null">?</a></span><span class="type"><a href="language.types.integer.php" class="type int">int</a></span></span> <code class="parameter">$scale</code><span class="initializer"> = <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong></span></span>): <span class="type"><a href="class.bcmath-number.php" class="type BcMath\Number">BcMath\Number</a></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="bcmath-number.tostring.php" class="methodname">__toString</a></span>(): <span class="type"><a href="language.types.string.php" class="type string">string</a></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="bcmath-number.unserialize.php" class="methodname">__unserialize</a></span>(<span class="methodparam"><span class="type"><a href="language.types.array.php" class="type array">array</a></span> <code class="parameter">$data</code></span>): <span class="type"><a href="language.types.void.php" class="type void">void</a></span></div>

    }
   </div>
  </div>

  <div class="section" id="bcmath-number.props">
   <h2 class="title">Eigenschaften</h2>
   <dl>
    
     <dt id="bcmath-number.props.value"><var class="varname">value</var></dt>
     <dd>
      <span class="simpara">
       A string representation of an arbitrary precision number.
      </span>
     </dd>
    
    
     <dt id="bcmath-number.props.scale"><var class="varname">scale</var></dt>
     <dd>
      <span class="simpara">
       The scale value currently set on the object.
       For objects resulting from calculations, this value is automatically computed and set,
       unless the <code class="parameter">scale</code> parameter was set in the calculation method.
      </span>
     </dd>
    
   </dl>
  </div>

 </div>

 




































































<h2>Inhaltsverzeichnis</h2><ul class="chunklist chunklist_reference"><li><a href="bcmath-number.add.php">BcMath\Number::add</a> — Adds an arbitrary precision number</li><li><a href="bcmath-number.ceil.php">BcMath\Number::ceil</a> — Rounds up an arbitrary precision number</li><li><a href="bcmath-number.compare.php">BcMath\Number::compare</a> — Compares two arbitrary precision numbers</li><li><a href="bcmath-number.construct.php">BcMath\Number::__construct</a> — Creates a BcMath\Number object</li><li><a href="bcmath-number.div.php">BcMath\Number::div</a> — Divides by an arbitrary precision number</li><li><a href="bcmath-number.divmod.php">BcMath\Number::divmod</a> — Gets the quotient and modulus of an arbitrary precision number</li><li><a href="bcmath-number.floor.php">BcMath\Number::floor</a> — Rounds down an arbitrary precision number</li><li><a href="bcmath-number.mod.php">BcMath\Number::mod</a> — Gets the modulus of an arbitrary precision number</li><li><a href="bcmath-number.mul.php">BcMath\Number::mul</a> — Multiplies an arbitrary precision number</li><li><a href="bcmath-number.pow.php">BcMath\Number::pow</a> — Raises an arbitrary precision number</li><li><a href="bcmath-number.powmod.php">BcMath\Number::powmod</a> — Raises an arbitrary precision number, reduced by a specified modulus</li><li><a href="bcmath-number.round.php">BcMath\Number::round</a> — Rounds an arbitrary precision number</li><li><a href="bcmath-number.serialize.php">BcMath\Number::__serialize</a> — Serializes a BcMath\Number object</li><li><a href="bcmath-number.sqrt.php">BcMath\Number::sqrt</a> — Gets the square root of an arbitrary precision number</li><li><a href="bcmath-number.sub.php">BcMath\Number::sub</a> — Subtracts an arbitrary precision number</li><li><a href="bcmath-number.tostring.php">BcMath\Number::__toString</a> — Converts BcMath\Number to string</li><li><a href="bcmath-number.unserialize.php">BcMath\Number::__unserialize</a> — Deserializes a data parameter into a BcMath\Number object</li></ul>
</div>
<?php manual_footer($setup); ?>