Home php教程 php手册 php hypot()直角三角形斜边长度 is_infinite()是否为无限值

php hypot()直角三角形斜边长度 is_infinite()是否为无限值

Jun 02, 2016 am 09:14 AM

定义和用法:is_infinite() 判断是否为无限值。

语法:is_infinite(x)

参数 描述 

x 必需,规定要检查的值。

说明:如果 x 为无穷大(正的或负的),例如 log(0) 的结果或者任何超出本平台的浮点数范围的值,则返回 true,实例代码如下:

function is_w_x_z($number)      //自定义函数扩展判断功能 
{ 
    if(is_infinite($number))       //对数值进行判断 
    { 
        echo $number."是无限值!";     //根据判断结果输出内容 
    } 
    else          //如果判断结果非真 
    { 
        echo $number."是有限值!";     //输出相应内容 
    }
} 
 
 
is_w_x_z(9999999999999999999999999999999999); //调用函数,返回1e+034是有限值! 
echo "<br>"; 
is_w_x_z(log(0));        //调用函数,返回-1.#inf是无限值! 
echo "<br>"; 
is_w_x_z(130);         //调用函数,返回130是有限值!
Copy after login

hypot() 函数计算一直角三角形的斜边长度.

语法:hypot(x,y)

参数 描述

x 必需,边 x 的长度.

y 必需,边 y 的长度.

说明:hypot() 函数将会跟据直角三角形的两直解边长度 x 和 y 计算其斜边的长度,或者是从标点 (x , y) 到原点的距离,该函数的算法等同于 sqrt(x*x + y*y).

echo "直角三角形的直角边为3,4则斜边为:"; 
echo "<br>"; 
echo hypot(3,4);       //返回5 
echo "<br>"; 
echo "直角三角形的直角边为5,13则斜边为:"; 
echo "<br>"; 
echo hypot(5,12);       //返回13
Copy after login

               
               

永久地址:

转载随意~请带上教程地址吧^^

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)