是double类型取舍的问题,不是程序的病

解决方案 »

  1.   

    first,I have to say sorry that I have no Chinese Input Methods here.
    So,i have to write in English.This problem will occured wherever the computer can't process the float to binary number.You must know that all of the numbers in computer must be stored in binary.
    All integers can be changed into binary forms(exp: 11 = 2^3 + 2^1 + 2^0)
    and so do some of decimel float( exp:0.75 = 2^(-1) + 2^(-2) )
    Now,you will find out that not all of floats can be changed into binary form.
    This means that some of float in decimel can't be stored in computer,
    it will give a value approximated to those floats.
    And java use 32-bit to present float.Now,i hope you know why these happened.
    :)
    give me point!!!
    :)