Whether the is_infinite () length of the oblique side of the right triangle is infinite

Source: Internet
Author: User
Tags hypot
Definition and usage: is_infinite () determines whether it is an infinite value. Syntax: the is_infinite (x) parameter description x is required and specifies the value to be checked. Note: If x is positive or negative, for example, log (... definition and usage: is_infinite () determines whether it is an infinite value.

Syntax:Is_infinite (x)

Parameter description

X is required, which specifies the value to be checked.

Note:If x is infinite (positive or negative), for example, the result of log (0) or any value beyond the floating point range of the platform, true is returned. the instance code is as follows:

Function is_w_x_z ($ number) // custom function extension judgment function {if (is_infinite ($ number) // judge the value {echo $ number. "is an infinite value! "; // Output content based on the judgment result} else // if the judgment result is not true {echo $ number." is a finite value! "; // Output the corresponding content} is_w_x_z (9999999999999999999999999999999999); // call the function, and the return value of 1e + 034 is limited! Echo"
"; Is_w_x_z (log (0); // call the function and return-1. # inf is an infinite value! Echo"
"; Is_w_x_z (130); // call the function. The return value of 130 is a finite value!

Hypot () function is used to calculate the length of the oblique edge of the angular triangle.

Syntax:Hypot (x, y)

Parameter description

X is required. the length of Edge x.

Y required. length of edge y.

Note:The hypot () function calculates the length of the oblique side of x and y based on the two straight side lengths of the right triangle, or the distance from the coordinate point (x, y) to the origin, the algorithm of this function is equivalent to sqrt (x * x + y * y ).

Echo "if the right corner side of a triangle is 3 or 4, the oblique side is:"; echo"
"; Echo hypot (3, 4); // return 5 echo"
"; Echo" if the right corner side of a triangle is 5 or 13, the oblique side is: "; echo"
"; Echo hypot (5, 12); // return 13

Permanent address:

Reprint at will ~ Please bring the tutorial URL ^

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.