• 技术文章 >后端开发 >php教程

    PHP中的float类型使用说明_PHP

    2016-06-01 12:17:58原创313
    float类型的表示可以有以下几种:
    复制代码 代码如下:
    $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.

    不翻译了。呵呵
    声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn核实处理。
    专题推荐:PHP float类型
    上一篇:php cookie的操作实现代码(登录)_PHP 下一篇:PHP三层结构(下) PHP实现AOP_PHP

    相关文章推荐

    • 聊聊有关declare(strict_types=1)的有效范围• 一文详解IIS10是怎么配置PHP的• PHP header()函数使用详细(301、404等错误设置)_PHP• 投票管理程序_PHP• 挑战最棒的留言本的源码(二)_PHP

    全部评论我要评论

  • 取消发布评论发送
  • 1/1

    PHP中文网