Java tip 04 -- math Tool

Source: Internet
Author: User
Tags natural logarithm

Math is a mathematical class in Java, which records many of them.ProgramMathematical aspects to be used, such as two constants:

The circumference rate of the math. Pi record

Math. E records the constant of E.

Math has some similar constants, which are commonly used in Engineering Mathematics.

Math. Abs evaluate absolute value

Math. Sin sine function & nbsp; math. asin arcsin Function

Math. Cos cosine function & nbsp; math. ACOs arccosine Function

Math. Tan tangent function & nbsp; math. atan arc tangent function

The arctangent function of math. atan2

Math. todegrees converts radians to degrees

Math. toradians angle conversion to radians

Math. Ceil returns the maximum integer not less than a certain number.

Math. Floor returns the maximum integer not greater than a certain number.

Math. ieeeremainder evaluate the remainder

Math. MAX: calculate the maximum of two numbers.

Math. Min: Calculate the minimum of two numbers.

Math. SQRT

Math. Pow calculates the arbitrary power of a number and throws an arithmeticexception to handle an overflow exception.

Math. Exp: Evaluate the arbitrary power of e

Math. log10 base-10 logarithm

Math. Log natural logarithm

Math. RINT: Calculate the integer closest to a certain number (which may be larger or smaller than a certain number)

Math. Round is the same as above. Int or long type is returned (double type is returned for the previous function)

Math. Random returns a random number between 0 and 1.

Note: Although math. RINT and math. round is very similar, but it is still different, not as good as math. RINT (-5.5) =-6.0 while math. round (-5.5) =-5. This is another difference between RINT and round.

Related Article

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.