In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-22 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains the "Java mathematical function Math class how to use", the article explains the content is simple and clear, easy to learn and understand, the following please follow the editor's train of thought slowly in depth, together to study and learn "Java mathematical function Math class how to use" it!
1. Abs (x) returns the absolute value of the number x.
Math.abs (11.3); / / 11.3Math.abs (- 11.3)
2. CopySign (xQuery y) returns the value of the first parameter and the symbol of the second parameter.
Math.copySign (1.25,11.3); / /-1.25Math.copySign (- 11.3,1.25); / / 11.3
3. Signum (x) returns 1.0 if x is greater than 0,-1.0 if less than 0, and 0.0 if equal to 0
Math.signum; / / 1.0Math.signum (- 10.3); / /-1.0Math.signum (0); / / 0.0
4. Exp (x) returns the x power of e.
5. Expm1 (x) returns the x power of e-1.
6. Ceil (x) returns the nearest integer greater than x.
Math.ceil; / / 16Math.ceil (- 15.5); / /-15
7. Floor (x) returns the nearest integer less than x.
Math.floor; / / 15Math.floor (- 15.5); / /-16
8. Hypot (xQuery y) returns the quadratic root of x ²+ y ².
Math.hypot (x, y); / / √ (x ²+ y ²) Math.hypot (3,4); / / 5
9. Sqrt (x) returns the quadratic root of x.
Math.sqrt (9); / / 3.0Math.sqrt (- 25); / /-5.0
10. Cbrt (x) returns the cube root of x.
Math.cbrt (27.0) / / 3Math.cbrt (- 125.0); / /-5
11. Log (x) returns the logarithm with the base e.
Math.log (e); / / 1
12. Log10 (x) returns the logarithm with a base of 10.
Math.log10; / / 10
13. Log1p (x)
Math.log1p (x); / / ln (Xero1)
14. Max (xQuery y) returns a larger value.
Math.max (3,10); / / 10Math.max (- 3,-10); / /-3
15. Min (xQuery y) returns a smaller value.
Math.min (3,10); / / 3Math.max (- 3,-10); / /-10
16. Rint (x) is rounded to return the double value. If it is centered at 0.5, an even number is taken.
Math.rint (11.3) / / 11Math.rint (- 11.3); / /-11Math.rint (23.9); / / 23Math.rint (- 23.9); / /-23Math.rint (32.5); / / 32Math.rint (33.5); / / 34
17. Round (x) is the same as rint, and the return value of float is int,double. The return value is long.
Thank you for your reading, the above is the content of "how to use Java mathematical function Math class". After the study of this article, I believe you have a deeper understanding of how to use Java mathematical function Math class, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.