加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > PHP教程 > 正文

PHP中的float类型使用说明

发布时间:2020-12-13 05:45:58 所属栏目:PHP教程 来源:网络整理
导读:float类型的表示可以有以下几种: div class="codetitle" a style="CURSOR: pointer" data="55276" class="copybut" id="copybut55276" onclick="doCopy('code55276')" 代码如下: div class="codebody" id="code55276" ?php $a = 1.234; $b = 1.2e3; $c = 7E

float类型的表示可以有以下几种:
<div class="codetitle"><a style="CURSOR: pointer" data="55276" class="copybut" id="copybut55276" onclick="doCopy('code55276')"> 代码如下:<div class="codebody" id="code55276">
<?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. 不翻译了。呵呵

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读