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

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

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.

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function