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

定义和用法: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是有限值!

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

               
               

永久地址:

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

Statement
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

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

Atom editor mac version download

Atom editor mac version download

The most popular open source editor