Java Tut 49: Phương thức toán học Java ( Java Math)

0
(0)

Lớp Toán Java có nhiều phương thức cho phép bạn thực hiện các nhiệm vụ toán học trên các con số.


Tất cả các phương pháp toán học

Danh sách tất cả các phương pháp Toán học có thể được tìm thấy trong bảng dưới đây:

MethodDescriptionReturn Type
abs(x)Returns the absolute value of xdouble|float|int|long
acos(x)Returns the arccosine of x, in radiansdouble
asin(x)Returns the arcsine of x, in radiansdouble
atan(x)Returns the arctangent of x as a numeric value between -PI/2 and PI/2 radiansdouble
atan2(y,x)Returns the angle theta from the conversion of rectangular coordinates (x, y) to polar coordinates (r, theta).double
cbrt(x)Returns the cube root of xdouble
ceil(x)Returns the value of x rounded up to its nearest integerdouble
copySign(x, y)Returns the first floating point x with the sign of the second floating point ydouble
cos(x)Returns the cosine of x (x is in radians)double
cosh(x)Returns the hyperbolic cosine of a double valuedouble
exp(x)Returns the value of Exdouble
expm1(x)Returns ex -1double
floor(x)Returns the value of x rounded down to its nearest integerdouble
getExponent(x)Returns the unbiased exponent used in xint
hypot(x, y)Returns sqrt(x2 +y2) without intermediate overflow or underflowdouble
IEEEremainder(x, y)Computes the remainder operation on x and y as prescribed by the IEEE 754 standarddouble
log(x)Returns the natural logarithm (base E) of xdouble
log10(x)Returns the base 10 logarithm of xdouble
log1p(x)Returns the natural logarithm (base E) of the sum of x and 1double
max(x, y)Returns the number with the highest valuedouble|float|int|long
min(x, y)Returns the number with the lowest valuedouble|float|int|long
nextAfter(x, y)Returns the floating point number adjacent to x in the direction of ydouble|float
nextUp(x)Returns the floating point value adjacent to x in the direction of positive infinitydouble|float
pow(x, y)Returns the value of x to the power of ydouble
random()Returns a random number between 0 and 1double
round(x)Returns the value of x rounded to its nearest integerint
rint()Returns the double value that is closest to x and equal to a mathematical integerdouble
signum(x)Returns the sign of xdouble
sin(x)Returns the sine of x (x is in radians)double
sinh(x)Returns the hyperbolic sine of a double valuedouble
sqrt(x)Returns the square root of xdouble
tan(x)Returns the tangent of an angledouble
tanh(x)Returns the hyperbolic tangent of a double valuedouble
toDegrees(x)Converts an angle measured in radians to an approx. equivalent angle measured in degreesdouble
toRadians(x)Converts an angle measured in degrees to an approx. angle measured in radiansdouble
ulp(x)Returns the size of the unit of least precision (ulp) of xdouble|float

Lưu ý: Tất cả các phương pháp Toán học đều được static.

How useful was this post?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate this post.

Related posts

Java Tut 48: String Methods

Java Tut 47: Từ khóa Java

Java Tut 46 : Thêm 2 số