admin 发表于 2023-2-16 18:54:55

PHP中浮点型的应用Float

<div id="article_content" class="article_content clearfix">
      <link rel="stylesheet" href="https://csdnimg.cn/release/blogv2/dist/mdeditor/css/editerView/kdoc_html_views-1a98987dfd.css">
      <link rel="stylesheet" href="https://csdnimg.cn/release/blogv2/dist/mdeditor/css/editerView/ck_htmledit_views-6e43165c0a.css">
                <div id="content_views" class="htmledit_views">
                  <pre><code><?

    $a &#61; 1.234;
    $b &#61; 1.2e3;
    $c &#61; 7E-10;
    $d &#61; 1_234.678; //从PHP7.4.0 开始支持

?></code></pre>
<p>浮点数的精度有限。尽管取决于系统&#xff0c;PHP 通常使用 IEEE 754 双精度格式&#xff0c;则由于取整而导致的最大相对误差为 1.11e-16。非基本数学运算可能会给出更大误差&#xff0c;并且要考虑到进行复合运算时的误差传递。</p>
                </div>
      </div>
      <div id="treeSkill"></div>
页: [1]
查看完整版本: PHP中浮点型的应用Float