<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                企業??AI智能體構建引擎,智能編排和調試,一鍵部署,支持知識庫和私有化部署方案 廣告
                # 浮點型 [TOC] ## 概述 浮點型就是常說的小數,浮點數的字長跟平臺相關精度有限。由于內部表達方式的原因,浮點數的精度有限,而我們永遠不能相信浮點數精確到了哪一位,也永遠不要比較兩個浮點數是否相等,想要使用更大精度的浮點數,[任意精度數學函數](http://php.net/manual/en/ref.bc.php)和[gmp](http://php.net/manual/en/ref.gmp.php) 函數。 ## 其他數據類型轉換為浮點型 字符串類型轉換為浮點型,請查看[String conversion to numbers](http://php.net/manual/en/language.types.string.php#language.types.string.conversion),而其他數據類型轉換為浮點型,會先轉換為整型,然后再轉換為浮點型。 ## 浮點型比較 要測試浮點型是否相等,要使用一個僅比該數值大一丁點的最小誤差值。 Example #1 $a 和 $b 在小數點后五位精度內都是相等的。 ~~~ <?php $a = 1.23456789; $b = 1.23456780; $epsilon = 0.00001; if(abs($a-$b) < $epsilon) { echo "true"; } ?> ~~~ ## NAN 某些數學運算會產生NAN,代表未定義或者一個不可描述的數,不應該將NAN與其他值作比較,包括NAN自身,應該用[is_nan()](http://php.net/manual/en/function.is-nan.php)函數檢查。 Example #2 is_nan()函數的使用 ~~~ <?php // Invalid calculation, will return a // NaN value $nan = acos(8); var_dump($nan, is_nan($nan)); ?> ~~~
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看