1. Why to get the sign bitMany times, we need to judge the value of the positive and negative, to do the corresponding logical processing. The conditional judgment statement can be a good completion of this requirement. Sometimes there is the
Original URL: http://blog.sina.com.cn/s/blog_827d041701017ctm.htmlQuestions raised: 12.0f-11.9f=0.10000038, "Lose The Endless" why?An explanation from MSDN:Http://msdn.microsoft.com/zh-cn/c151dt3s.aspxWhy floating-point numbers may lose precision
Turn from pencilWhy can floating point numbers lose precision?Floating-point decimal values typically do not have the exact same binary representation. This is a side effect of the floating-point data representation used by the CPU. For this reason,
In Java programs, most of the reasons for performance problems lie not in the Java language, but in the program itself. It is important to develop good coding habits, such as using the Java.lang.String class and the Java.util.Vector class correctly
Questions raised: 12.0f-11.9f=0.10000038, "Lose The Endless" why?Now let's analyze in detail why a floating point operation causes loss of precision.1, Decimal binary representation problemFirst of all, we need to figure out the following two
One, Java bit operation1. Presentation method:In the Java language, the binary number is represented by a complement, the highest bit is the sign bit, the sign bit for positive numbers is 0, and the negative is 1. The complement representation needs
Bitwise moving OPERATOR:
Example: 3 1) Convert 3 to a binary number 0000 0000 0000 0000 0000 0000 0000 0011,2) Remove the two zeros at the upper (left) of the number. All the other digits are shifted to the left,3) Fill in the two vacant positions
Original Author: Rosen Jiang Source:Http://www.blogjava.net/rosen
Shift Operator
Including:"> Right shift"; ">> unsigned right shift"
Example:-5> 3 =-11111 1111 1111 1111 1111 1111 11111111 1111 1111 1111 1111 1111 1111The result is exactly the same
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.