PHP中的float類型使用說明
更新時間:2010年07月27日 19:41:04 作者:
使用PHP的float類型需要注意的是:PHP的float類型的精度有點問題。如果需要高精度的數(shù)學計算,可以使用php提供的專用的數(shù)學函數(shù) arbitrary precision math functions系列和gmp系列函數(shù)。
float類型的表示可以有以下幾種:
<?php
$a = 1.234;
$b = 1.2e3;
$c = 7E-10;
?>
使用PHP的float類型需要注意的是:PHP的float類型的精度有點問題。如果需要高精度的數(shù)學計算,可以使用php提供的專用的數(shù)學函數(shù) arbitrary precision math functions系列和gmp系列函數(shù)。還有就是不要試圖進行比較float類型的變量。
Converting to float
For information on converting strings to float, see String conversion to numbers. For values of other types, the conversion is performed by converting the value to integer first and then to float. See Converting to integer for more information. As of PHP 5, a notice is thrown if an object is converted to float.
不翻譯了。呵呵
復制代碼 代碼如下:
<?php
$a = 1.234;
$b = 1.2e3;
$c = 7E-10;
?>
使用PHP的float類型需要注意的是:PHP的float類型的精度有點問題。如果需要高精度的數(shù)學計算,可以使用php提供的專用的數(shù)學函數(shù) arbitrary precision math functions系列和gmp系列函數(shù)。還有就是不要試圖進行比較float類型的變量。
Converting to float
For information on converting strings to float, see String conversion to numbers. For values of other types, the conversion is performed by converting the value to integer first and then to float. See Converting to integer for more information. As of PHP 5, a notice is thrown if an object is converted to float.
不翻譯了。呵呵
相關文章
PHP5全版本繞過open_basedir讀文件腳本漏洞詳細介紹
這篇文章主要介紹了PHP5全版本繞過open_basedir讀文件腳本漏洞詳細介紹,這個漏洞很久之前(大概5年前)被提出來了,到現(xiàn)在的最新版本中依然存在,需要的朋友可以參考下2015-01-01PHPExcel在linux環(huán)境下導出報500錯誤的解決方法
下面小編就為大家?guī)硪黄狿HPExcel在linux環(huán)境下導出報500錯誤的解決方法。小編覺得挺不錯的,現(xiàn)在就分享給大家,也給大家做個參考。一起跟隨小編過來看看吧2017-01-01php中json_encode UTF-8中文亂碼的更好解決方法
網(wǎng)上找到說json_encode編碼設置為UTF-8中文就不會亂碼,在用過一段時間之后就不太管用了,下面與大家分享更好的方法2014-09-09