<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/mongodb.bson.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'uk',
  ),
  'this' => 
  array (
    0 => 'class.mongodb-bson-decimal128.php',
    1 => 'MongoDB\\BSON\\Decimal128',
    2 => 'The MongoDB\\BSON\\Decimal128 class',
  ),
  'up' => 
  array (
    0 => 'mongodb.bson.php',
    1 => 'MongoDB\\BSON',
  ),
  'prev' => 
  array (
    0 => 'mongodb-bson-binary.tostring.php',
    1 => 'MongoDB\\BSON\\Binary::__toString',
  ),
  'next' => 
  array (
    0 => 'mongodb-bson-decimal128.construct.php',
    1 => 'MongoDB\\BSON\\Decimal128::__construct',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/mongodb/bson/decimal128.xml',
  ),
  'history' => 
  array (
  ),
  'extra_header_links' => 
  array (
    'rel' => 'alternate',
    'href' => '/manual/en/feeds/class.mongodb-bson-decimal128.atom',
    'type' => 'application/atom+xml',
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="class.mongodb-bson-decimal128" class="reference">

 <h1 class="title">The MongoDB\BSON\Decimal128 class</h1>
 

 <div class="partintro"><p class="verinfo">(mongodb &gt;=1.2.0)</p>


  <div class="section" id="mongodb-bson-decimal128.intro">
   <h2 class="title">Вступ</h2>
   <p class="para">
    BSON type for the
    <a href="https://en.wikipedia.org/wiki/Decimal128_floating-point_format" class="link external">&raquo;&nbsp;Decimal128 floating-point format</a>,
    which supports numbers with up to 34 decimal digits (i.e. significant
    digits) and an exponent range of −6143 to +6144.
   </p>
   <p class="para">
    Unlike the double BSON type (i.e. <span class="type"><a href="language.types.float.php" class="type float">float</a></span> in PHP), which only
    stores an approximation of the decimal values, the decimal data type stores
    the exact value. For example, <code class="literal">MongoDB\BSON\Decimal128(&#039;9.99&#039;)</code>
    has a precise value of 9.99 where as a double 9.99 would have an approximate
    value of 9.9900000000000002131628….
   </p>
   
   <blockquote class="note"><p><strong class="note">Зауваження</strong>: 
    <span class="simpara">
     Клас <span class="classname"><strong class="classname">MongoDB\BSON\Decimal128</strong></span> доступний в MongoDB
     3.4+. Спроба використати цей BSON-тип в старіших версіях MongoDB викличе
     помилку.
    </span>
   </p></blockquote>

  </div>


  <div class="section" id="mongodb-bson-decimal128.synopsis">
   <h2 class="title">Короткий огляд класу</h2>


   <div class="classsynopsis">
    <span class="ooclass"><strong class="classname"></strong></span>


    <div class="classsynopsisinfo">
     <span class="modifier">final</span>
     <span class="ooclass">
      <span class="modifier">class</span> <strong class="classname">MongoDB\BSON\Decimal128</strong>
     </span>

     <span class="oointerface"><span class="modifier">implements</span> 
       <a href="class.mongodb-bson-decimal128interface.php" class="interfacename">MongoDB\BSON\Decimal128Interface</a></span><span class="oointerface">,  <a href="class.mongodb-bson-type.php" class="interfacename">MongoDB\BSON\Type</a></span><span class="oointerface">,  <a href="class.jsonserializable.php" class="interfacename">JsonSerializable</a></span><span class="oointerface">,  <a href="class.stringable.php" class="interfacename">Stringable</a></span> {</div>


    <div class="classsynopsisinfo classsynopsisinfo_comment">/* Методи */</div>
    <div class="methodsynopsis dc-description">
   <span class="modifier">final</span> <span class="modifier">public</span> <span class="methodname"><a href="mongodb-bson-decimal128.construct.php" class="methodname">__construct</a></span>(<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$value</code></span>)</div>
<div class="methodsynopsis dc-description"><span class="modifier">final</span> <span class="modifier">public</span> <span class="methodname"><a href="mongodb-bson-decimal128.jsonserialize.php" class="methodname">jsonSerialize</a></span>(): <span class="type"><a href="language.types.mixed.php" class="type mixed">mixed</a></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">final</span> <span class="modifier">public</span> <span class="methodname"><a href="mongodb-bson-decimal128.tostring.php" class="methodname">__toString</a></span>(): <span class="type"><a href="language.types.string.php" class="type string">string</a></span></div>

   }</div>


  </div>

  <div class="section">
   <h2 class="title">Журнал змін</h2>
   <p class="para">
    <table class="doctable informaltable">
     
      <thead>
       <tr>
        <th>Версія</th>
        <th>Опис</th>
       </tr>

      </thead>

      <tbody class="tbody">
       
       <tr>
        <td>PECL mongodb 2.0.0</td>
        <td>
         <p class="para">
          This class no longer implements the
          <span class="interfacename"><a href="class.serializable.php" class="interfacename">Serializable</a></span> interface.
         </p>
        </td>
       </tr>


       <tr>
        <td>PECL mongodb 1.12.0</td>
        <td>
         Implements <span class="interfacename"><a href="class.stringable.php" class="interfacename">Stringable</a></span> for PHP 8.0+.
        </td>
       </tr>

       <tr>
        <td>PECL mongodb 1.3.0</td>
        <td>
         Implements <span class="interfacename"><a href="class.mongodb-bson-decimal128interface.php" class="interfacename">MongoDB\BSON\Decimal128Interface</a></span>.
        </td>
       </tr>

       <tr>
        <td>PECL mongodb 1.2.0</td>
        <td>
         Implements <span class="interfacename"><a href="class.serializable.php" class="interfacename">Serializable</a></span> and
         <span class="interfacename"><a href="class.jsonserializable.php" class="interfacename">JsonSerializable</a></span>.
        </td>
       </tr>

      </tbody>
     
    </table>

   </p>
  </div>

 </div>

 







 






 






<h2>Зміст</h2><ul class="chunklist chunklist_reference"><li><a href="mongodb-bson-decimal128.construct.php">MongoDB\BSON\Decimal128::__construct</a> — Construct a new Decimal128</li><li><a href="mongodb-bson-decimal128.jsonserialize.php">MongoDB\BSON\Decimal128::jsonSerialize</a> — Returns a representation that can be converted to JSON</li><li><a href="mongodb-bson-decimal128.tostring.php">MongoDB\BSON\Decimal128::__toString</a> — Returns the string representation of this Decimal128</li></ul>
</div>
<?php manual_footer($setup); ?>