In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
Editor to share with you what is the use of the keyword strictfp in the Java language, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!
Since Java2, the Java language has added a keyword strictfp, which is rarely used in most situations, but it's important to know about it.
Strictfp means FP-strict, which means precise floating point. When the Java virtual machine performs floating-point operations, if the strictfp keyword is not specified, the compiler and running environment of Java take an approximate behavior to complete these operations on floating-point expressions, so that the results are often not satisfactory to you. Once strictfp is used to declare a class, interface, or method, the declared scope of the Java compiler and runtime environment will be executed in full accordance with the floating-point specification IEEE-754. So if you want to make your floating-point operations more accurate and not because the results performed on different hardware platforms are inconsistent, use the keyword strictfp.
You can declare a class, interface, and method as strictfp, but do not allow methods and constructors in the interface to declare the strictfp keyword, such as the following code:
1. Legal use of the keyword strictfp
Strictfp interface A {} public strictfp class FpDemo1 {strictfp void f () {}}
two。 The wrong way to use
Interface A {strictfp void f ();} public class FpDemo2 {strictfp FpDemo2 () {}}
Once the keyword strictfp is used to declare a class, interface, or method, all floating-point operations within the scope declared by this keyword are accurate and conform to the IEEE-754 specification. For example, if a class is declared as strictfp, then all methods in that class are strictfp.
The above is all the content of the article "what is the use of the keyword strictfp in Java language". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.