Php hypot () Cartesian triangle Oblique Edge length is_infinite () is unlimited Value

Source: Internet
Author: User
Tags hypot

Definition and usage
Is_infinite () determines whether it is an infinite value.

Is_infinite (x) parameter description
X is required. Specifies the value to be checked.

If x is infinite (positive or negative), for example, log (0) results or any value beyond the floating point range of the platform, true is returned.


Function is_w_x_z ($ number) // customize the function Extension judgment function
If (is_infinite ($ number) // determines the value.
Echo $ number. "is an infinite value! "; // Output content based on the judgment result
Else // if the result is not true
Echo $ number. "is a finite value! "; // Output the corresponding content


Is_w_x_z (9999999999999999999999999999999999); // call the function. The return value of 1e + 034 is limited!
Echo "<br> ";
Is_w_x_z (log (0); // call the function and return-1. # inf is an infinite value!
Echo "<br> ";
Is_w_x_z (130); // call the function. The return value of 130 is finite!

Hypot () function is used to calculate the length of the Oblique Edge of the angular triangle.

Hypot (x, y) parameter description
X is required. The length of edge x.
Y is required. The length of edge y.

The hypot () function calculates the length of the Oblique Edge Based on the two straight side lengths x and y of the right triangle. Or the distance from the Punctuation Point (x, y) to the origin point. The algorithm of this function is equivalent to sqrt (x * x + y * y ).

Echo "if the right-angle triangle's right-angle side is 3 or 4, the oblique side is :";
Echo "<br> ";
Echo hypot (3, 4); // returns 5
Echo "<br> ";
Echo "the oblique side of a right triangle is 5 or 13 :";
Echo "<br> ";
Echo hypot (5, 12); // return 13

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: 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.