PHP中的float类型使用说明
作者:bea
float类型的表示可以有以下几种: 代码如下: <?php $a = 1.234; $b = 1.2e3; $c = 7E-10; ?> 使用PHP的float类型需要注意的是:PHP的float类型的精度有点问题。如果需要高精度的数学计算,可以使用php提供的专用的数学函数 arbitrary precision math functions系列和gmp系列函数。还有就是不要试图进行比较float类型的变量。 Converting to fl
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
$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中实现Javascript的escape()函数代码
- PHP下escape解码函数的实现方法
- ubuntu 编译安装php 5.3.3+memcache的方法
- PHP MemCached高级缓存配置图文教程
- PHP Array交叉表实现代码
- php垃圾代码优化操作代码
- PHP MemCached 高级缓存应用代码
- phpMyAdmin 链接表的附加功能尚未激活的问题
- PHP合并数组+与array_merge的区别分析
- PHP自定义函数收代码
- 无法在发生错误时创建会话,请检查 PHP 或网站服务器日志,并正确配置 PHP 安装最快的解决办法
- PHP5中使用PDO连接数据库的方法
- PHP网站安装程序制作的原理、步骤、注意事项和示例代码
- PHP Stream_*系列函数
- php下目前为目最全的CURL中文说明
- php feof用来识别文件末尾字符的方法
- apache+php+mysql安装配置方法小结
- PHP 作用域解析运算符(::)
- PHP中的integer类型使用分析