PHP中的float类型使用说明

yipeiwu_com6年前PHP代码库
float类型的表示可以有以下几种:
复制代码 代码如下:

<?php
$a = 1.234;
$b = 1.2e3;
$c = 7E-10;
?>

使用PHP的float类型需要注意的是:PHP的float类型的精度有点问题。如果需要高精度的数学计算,可以使用php提供的专用的数学函数 arbitrary precision math functions系列和gmp系列函数。还有就是不要试图进行比较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的一个登录的类 [推荐]

PHP代码: <? /* * 名称:CnkknD PHP Login Class * 描述:PHP用于登录的类,基于MySQL *...

PHP简单获取网站百度搜索和搜狗搜索收录量的方法

PHP简单获取网站百度搜索和搜狗搜索收录量的方法

本文实例讲述了PHP简单获取网站百度搜索和搜狗搜索收录量的方法。分享给大家供大家参考,具体如下: 获取网站百度搜索和搜狗搜索的收录量代码,可以用于获取网站域名在搜索引擎的收录数量,一直想...

PHP判断上传文件类型的解决办法

分享给大家php判断上传文件类型的方法,大家一起学习学习。 /** * 读取文件前几个字节 判断文件类型 * @return String */ function check...

php 结果集的分页实现代码

复制代码 代码如下:<?php @mysql_connect("localhost", "root","1981427") //连接数据库服务器 or die("数据库服务器连接失...

php中array_column函数简单实现方法

本文实例讲述了php中array_column函数简单实现方法。分享给大家供大家参考,具体如下: php中的array_column()可返回输入数组中某个单一列的值。 示例: &l...