Today's Question:  What does your personal desk look like?        GIVE A SHOUT

 ALL


  Why 0.1+0.2 != 0.3

In programming languages such as JavaScript, c/c++, Java and Matlab, you will find that you will get unexpected result when doing float point calculation. For example, when calculating 0.1 + 0.1, you will not get 0.3:> 0.1 + 0.2 == 0.3false> 0.1 + 0.20.30000000000000004Don't be surprised of this result, this is the end result of IEEE 754 standard, float point number cannot be accurately represented according to IEEE 754 because:No enough memory is allocated for representing the numberIt needs a range to ensure the accuracyJavaScript uses 64-bit floating point representation, which is the...

9,687 0       JAVASCRIPT FLOAT POINT COMPARISON