In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
The main content of this article is to explain "what are the reasons for the inaccuracy of float and double calculation". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "what are the reasons for the inaccuracy of float and double calculations?"
Why is there a problem with floating-point precision operations?
Most of the programming languages we use usually have a problem-floating-point precision operations can be inaccurate. such as
Double num = 0. 1 + 0. 1 + 0. 1 umbrellas / output is 0.30000000000000004double num2 = 0. 65-0. 6; the output is 0. 050000000000004.
During the test, the author found that this kind of problem would not occur in CCompact +. At first, I thought it was compiler optimization to solve this problem. But if it can solve other languages, why not follow up? According to the cause of this problem, it is illogical for compiler optimization to solve this problem. It was later found that there was something wrong with the printing method, and the printout method would be rounded. Use printf ("% 0.17f\ n", num); and cout
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.