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向浏览器输出内容的4个函数总结

复制代码 代码如下: <!DOCTYPE unspecified PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://w...

对PHP新手的一些建议(PHP学习经验总结)

这些建议都是我自身亲历成长过程中积累的一些看法,仅作参考,相信百分之八十对你都有帮助! 刚学习PHP的时候不要纠结使用哪个环境?appserv、wamp集成环境都不错 编辑器很...

非常实用的php验证码类

本文实例为大家分享了php验证码类,供大家参考,具体内容如下 <?php /** * * @author Administrator * */ cl...

PHP 5.3 下载时 VC9、VC6、Thread Safe、Non Thread Safe的区别分析

一共给了四个版本,VC9 x86 Non Thread Safe、VC9 x86 Thread Safe、VC6 x86 Non Thread Safe、VC6 x86 Thread S...

PHP5.5在windows安装使用memcached服务端的方法

PHP5.5在windows安装使用memcached服务端的方法

  PHP5.5 在windows下安装 memcached 的方法   下载服务端资源   http://download.csdn.net/detail/zsjangel/71047...