14. Mathematical Operation class (trigonometric functions, integer function, exponential function, maximum, minimum, absolute value)

Source: Internet
Author: User
Tags square root

 PackageCom.lei.duixiang; Public classexponentfunction {/*** Mathematical Operations class * 1. Trigonometric functions * 2. Exponential function * 3. Rounding function * 4. Take maximum, minimum, absolute value function *@paramargs*/    //1. Trigonometric Methods    Static  Public voidSanjiao () {//take 90 degrees of sineSystem.out.println ("sinusoidal value of 90 degrees:" +math.sin (MATH.PI/2)); System.out.println ("Cosine of 0 Degrees:" +math.cos (0));//take the cosine of 0 degrees.//take the tangent of 60 degreesSystem.out.println ("Tangent of 60 Degrees:" +math.tan (MATH.PI/3)); //take 2 square root with 2 quotient of the inverse chordSystem.out.println ("2 square root with 2 quotient of the inverse chord:" +math.asin (MATH.SQRT (2)/2)); //take the square root of 2 and the inverse cosine of 2 quotientSystem.out.println ("The square root of 2 with 2 quotient of the inverse cosine:" +math.acos (MATH.SQRT (2)/2)); System.out.println ("1 of the inverse Tangent value:" +math.atan (1));//take 1 of the arc tangent//take the radian value of 120 degreesSystem.out.println ("Radian value of 120 degrees:" +math.toradians (120.0)); //take the angle of ∏/2System.out.println ("∏/2 angle Value:" +math.todegrees (MATH.PI/2)); System.out.println ("----------------------"); }        //2. Exponential function Method    Static  Public voidZhishu () {System.out.println ("E squared value:" +math.exp (2));//take E's two-time square//take the logarithm of the base 2 of eSystem.out.println ("Take a pair of values with the base 2 of E:" +math.log (2)); //take the logarithm of base 2 at 10System.out.println ("Take a pair of values at base 2 of 10:" +math.log10 (2)); System.out.println ("Square root value of 4:" +math.sqrt (4));//take the square root of 4System.out.println ("8 cubic Root value:" +MATH.CBRT (8));//take the cubic root of 8System.out.println ("2 of 2 square Values:" +math.pow (2,2));//take 2 of the 2 square rootSystem.out.println ("-------------------"); }        //3. Rounding Function Method    Static  Public voidQuzheng () {//returns an integer greater than the first argumentSystem.out.println ("Use Ceil () method rounding:" +math.ceil (5.2)); //returns an integer that is less than the first argumentSystem.out.println ("Use floor () method rounding:" +math.floor (2.5)); //returns the integer closest to the parameterSystem.out.println ("Use Rint () method rounding:" +math.rint (2.7)); //returns the integer closest to the parameterSystem.out.println ("Use Rint () method rounding:" +math.rint (2.5)); //returns the nearest integer after adding a parameter of 0.5SYSTEM.OUT.PRINTLN ("Use round () method rounding:" + Math.Round (3.4f)); //returns the nearest integer after adding a parameter of 0.5 and casts the result to a long integerSYSTEM.OUT.PRINTLN ("Use round () method rounding:" +math.round (2.5)); System.out.println ("--------------------------"); }    //4. Take maximum, minimum, absolute value function    Static  Public voidqumaxmin () {System.out.println ("4 and 8 larger:" +math.max (4, 8)); //take the minimum value of 2 parametersSystem.out.println ("4.4 and 4 Lesser:" +math.min (4.4, 4)); System.out.println ("-Absolute value of 7:" +math.abs (-7)); System.out.println ("--------------------"); }         Public Static voidMain (string[] args) {Sanjiao ();//1. Trigonometric MethodsZhishu ();//2. Exponential function MethodQuzheng ();//3. Rounding Function MethodQumaxmin ();//4. Take maximum, minimum, absolute value function    }}

14, Mathematical operations Class (trigonometric functions, rounding function, exponential function, maximum, minimum, absolute value)

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.