<?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 => 'ru',
  ),
  'this' => 
  array (
    0 => 'class.bcmath-number.php',
    1 => 'BcMath\\Number',
    2 => 'Класс BcMath\\Number',
  ),
  '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' => 'ru',
    '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">Класс BcMath\Number</h1>
 

 <div class="partintro"><p class="verinfo">(PHP 8 &gt;= 8.4.0)</p>
  <div class="section" id="bcmath-number.intro">
   <h2 class="title">Введение</h2>
   <p class="simpara">
    Класс выполняет математические операции с числами произвольной точности.
    Объекты класса поддерживают перегруженные
    <a href="language.operators.arithmetic.php" class="link">арифметические операторы</a>
    и <a href="language.operators.comparison.php" class="link">операторы сравнения</a>.
   </p>

   <blockquote class="note"><p><strong class="note">Замечание</strong>: 
    <span class="simpara">
     На класс не влияет
     INI-директива <a href="bc.configuration.php#ini.bcmath.scale" class="link">bcmath.scale</a>,
     которую устанавливают в файле <var class="filename">php.ini</var>.
    </span>
   </p></blockquote>

   <blockquote class="note"><p><strong class="note">Замечание</strong>: 
    <span class="simpara">
     Перегруженные операторы ведут себя так же, как параметр <code class="parameter">scale</code>
     со значением <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong> в методах с поддержкой такого параметра.
    </span>
   </p></blockquote>
  </div>

  <div class="section" id="bcmath-number.synopsis">
   <h2 class="title">Обзор класса</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">/* Свойства */</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">/* Методы */</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">Свойства</h2>
   <dl>
    
     <dt id="bcmath-number.props.value"><var class="varname">value</var></dt>
     <dd>
      <span class="simpara">
       Строковое представление числа произвольной точности.
      </span>
     </dd>
    
    
     <dt id="bcmath-number.props.scale"><var class="varname">scale</var></dt>
     <dd>
      <span class="simpara">
       Текущее значение масштаба, которое устанавливается для объекта.
       Класс автоматически вычисляет и устанавливает это значение
       для объектов, которые получились в результате расчётов,
       если параметр <code class="parameter">scale</code> не установили в методе расчёта.
      </span>
     </dd>
    
   </dl>
  </div>

 </div>

 






































































































<h2>Содержание</h2><ul class="chunklist chunklist_reference"><li><a href="bcmath-number.add.php">BcMath\Number::add</a> — Складывает числа произвольной точности</li><li><a href="bcmath-number.ceil.php">BcMath\Number::ceil</a> — Округляет число произвольной точности в бо́льшую сторону</li><li><a href="bcmath-number.compare.php">BcMath\Number::compare</a> — Сравнивает два числа произвольной точности</li><li><a href="bcmath-number.construct.php">BcMath\Number::__construct</a> — Создаёт новый объект BcMath\Number</li><li><a href="bcmath-number.div.php">BcMath\Number::div</a> — Делит числа произвольной точности</li><li><a href="bcmath-number.divmod.php">BcMath\Number::divmod</a> — Получает неполное частное и остаток от деления числа произвольной точности</li><li><a href="bcmath-number.floor.php">BcMath\Number::floor</a> — Округляет число произвольной точности в меньшую сторону</li><li><a href="bcmath-number.mod.php">BcMath\Number::mod</a> — Получает остаток от деления числа произвольной точности</li><li><a href="bcmath-number.mul.php">BcMath\Number::mul</a> — Умножает число произвольной точности</li><li><a href="bcmath-number.pow.php">BcMath\Number::pow</a> — Возводит число произвольной точности в степень</li><li><a href="bcmath-number.powmod.php">BcMath\Number::powmod</a> — Возводит число произвольной точности в степень и делит результат возведения в степень на модуль числа</li><li><a href="bcmath-number.round.php">BcMath\Number::round</a> — Округляет число произвольной точности</li><li><a href="bcmath-number.serialize.php">BcMath\Number::__serialize</a> — Сериализует объект BcMath\Number</li><li><a href="bcmath-number.sqrt.php">BcMath\Number::sqrt</a> — Извлекает квадратный корень из числа произвольной точности</li><li><a href="bcmath-number.sub.php">BcMath\Number::sub</a> — Вычитает из числа произвольной точности</li><li><a href="bcmath-number.tostring.php">BcMath\Number::__toString</a> — Преобразовывет объект BcMath\Number в строку</li><li><a href="bcmath-number.unserialize.php">BcMath\Number::__unserialize</a> — Десериализует данные в объект BcMath\Number</li></ul>
</div>
<?php manual_footer($setup); ?>