Java-math class

Source: Internet
Author: User

MathA class is a mathematical tool class that contains methods for performing basic mathematical operations, such as elementary exponents, logarithms, square roots, and trigonometric functions.

A tool class like this, all of its methods are static methods, and generally do not create objects. such as the System class

A tool class that represents a class that can perform a series of functions without creating an object when using them, and the method in that class is a static method

Common methods
Abs method, the result is positive double D1 = Math.Abs (-5); The value of D1 is 5double d2 = Math.Abs (5); The value of D2 is the 5ceil method, and the result is a double value of the smallest integer greater than the value of the parameter double D1 = Math.ceil (3.3); The value of D1 is 4.0double d2 = Math.ceil (-3.3); The value of D2 is -3.0double d3 = Math.ceil (5.1); The value of D3 is the 6.0floor method, and the result is a double value of the largest integer that is smaller than the value of the parameter double D1 = Math.floor (3.3); The value of D1 is 3.0double d2 = Math.floor (-3.3); The value of D2 is -4.0double d3 = Math.floor (5.1); The value of D3 is the 5.0max method, which returns a large value of two parameter values double d1 = Math.max (3.3, 5.5); The value of D1 is 5.5double d2 = Math.max (-3.3,-5.5); The value of D2 is the -3.3min method, which returns the lower value of two parameter values in double D1 = math.min (3.3, 5.5); The value of D1 is 3.3double d2 = Math.max (-3.3,-5.5); The value of D2 is the -5.5pow method, which returns the value of the second parameter of the first argument to the power of double D1 = Math.pow (2.0, 3.0); The value of D1 is 8.0double d2 = Math.pow (3.0, 3.0); The value of D2 is the 27.0round method, which returns the result of rounding the parameter value double d1 = Math.Round (5.5); The value of D1 is 6.0double d2 = Math.Round (5.4); The value of D2 is a 5.0random method that produces a double D1 = Math.random () that is greater than or equal to 0.0 and less than 1.0.

  

Java-math class

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.