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.

不翻译了。呵呵

相关文章

重新封装zend_soap实现http连接安全认证的php代码

复制代码 代码如下: <?php class MyFramework_Soap_server extends Zend_Soap_Server { protected $_logi...

PHP模拟asp.net的StringBuilder类实现方法

本文实例讲述了PHP模拟asp.net的StringBuilder类实现方法。分享给大家供大家参考。具体如下: 在asp.net开发开发环境中,有一个StringBuilder类是比较常...

phpmyadmin中配置文件现在需要绝密的短语密码的解决方法

'blowfish_secret'用一个任意字符串作为cookie的加密字符串,如果没有加密钥匙,系统会显示"配置文件现在需要绝密的短语密码(blowfish_secret) ...

php下载远程文件类(支持断点续传)

简易使用方法: 复制代码 代码如下:$object = new httpdownload(); $object->set_byfile($file)%N#H#%;//服务...

php数组使用规则分析

本文实例分析了php中数组的使用规则。分享给大家供大家参考。具体分析如下: 数组在php中处于灰常重要的地位。字符串、图片、数码、视频等值都以数组的形式存在,所以了解清楚数组的各种规则十...