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.

不翻译了。呵呵

相关文章

IStream与TStream之间的相互转换

   procedure TForm1.Button1Click(Sender: TObject);    ...

利用discuz自带通行证整合dedecms的方法以及文件下载

利用discuz自带通行证整合dedecms的方法以及文件下载

整合discuz的通行证:利用discuz自带通行证整合dede的方法以及文件下载首先感谢柏拉图提供这么好的免费程序在论坛上看到大家很多都想整合discuz。我想柏拉图肯定会弄一个非常完...

IIS+fastcgi下PHP运行超时问题的解决办法详解

每在页面中上传较大的文件时遇到FastCgi的错误:“The FastCGI process exceeded configured request timeout”,几经试验,明白了需...

十大使用PHP框架的理由

十大使用PHP框架的理由

PHP框架提供了一个用以构建web应用的基本框架,从而简化了用PHP编写web应用程序的流程。换言之,PHP框架有助于促进快速应用开发( RAD ),不但节省开发时间、有助于建立更稳定的...

php获取错误信息的方法

本文实例讲述了php获取错误信息的方法。分享给大家供大家参考。具体如下: function error_reg(){ $ar=array( E_ERROR => 'err...