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 skymvc 一款轻量、简单的php

改框架主要用于实现多个程序员之间的协同开发以及mvc开发模式的实现.skymvc采用mvc开发方式,框架本身易扩展。skymvc作为天网计划的基础框架,秉承易用、易学、共同开发的优良传统...

php简单图像创建入门实例

php简单图像创建入门实例

本文实例讲述了php简单图像创建方法。分享给大家供大家参考。具体实现方法如下: <?php $image = imagecreatetruecolor(200,100...

PHP中检索字符串的方法分析【strstr与substr_count方法】

本文实例分析了PHP中检索字符串的方法。分享给大家供大家参考,具体如下: 在PHP中,提供了很多用于查找字符串的函数,PHP也可以像Word那样实现对字符串的查找功能。 应用strstr...

php中base64_decode与base64_encode加密解密函数实例

本文实例讲述了php中base64_decode与base64_encode加密解密函数。分享给大家供大家参考。具体分析如下: 这两个函数在php中是用得对php代码进行加密与解密码的b...

本地机apache配置基于域名的虚拟主机详解

1.打开apache的httpd.conf文件,找到# Virtual hosts#Include conf/extra/httpd-vhosts.conf这一段把Include con...