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基于dom实现的图书xml格式数据示例

本文实例讲述了php基于dom实现的图书xml格式数据。分享给大家供大家参考,具体如下: <?php $books = array(); $books [] = a...

用PHP的ob_start();控制您的浏览器cache!

【转载】原文地址:http://www.itbbs.cn/index.php?showtopic=1074    Output Control 函数可以让你自由控制脚...

redirect_uri参数错误的解决方法(必看)

redirect_uri参数错误的解决方法(必看)

今天做微信开发时候出现了redirect uri 参数错误。百度了一下。原来是Oauth授权域名没有填写 再授权域名中,填写自己用到的域名即可。   以上这篇redirect...

关于Sphinx创建全文检索的索引介绍

全文检索的索引创建过程一般有以下几步:1、一些需要创建索引的文档(Documents)。 2、将原文档传给分词组件(Tokenizer)。 3、将得到的词元(Token)传给语言处理组件...

PHP文件操作详解

本文实例为大家分享了PHP文件操作的具体代码,供大家参考,具体内容如下 (1)文件读取 file_get_contents( ) 实例: <?php // 文件部分...