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.

不翻译了。呵呵

相关文章

给apache2.2加上mod_encoding模块後 php5.2.0 处理url出现bug

这个问题是mod_encoding已经先一步处理了url ,而PHP又解了一次 例如 x.php?s=%252B%2F%2B%2F 那么$_GET['s']得到的是 +/&nb...

php文件操作相关类实例

本文实例讲述了php文件操作相关类。分享给大家供大家参考。具体如下: <?php class file_dir { function check_exist($...

php不用内置函数对数组排序的两个算法代码

一朋友找工作遇到的试题,备注一下。 极有可能今后我也会遇到的。 问题:php不用内置函数对数组排序,可能是降序或者升序 第一种方法:传说中的冒泡法 复制代码 代码如下: function...

paypal即时到账php实现代码

http://paypal.ebay.cn/integrationcenter/list__resource_2.html 中文php开发简介:http://www.paypal-chi...

PHP常用的类封装小结【4个工具类】

本文实例讲述了PHP常用的类封装。分享给大家供大家参考,具体如下: 这4个类分别是Mysql类、 分页类、缩略图类、上传类。 Mysql类 <?php /** * M...