Java Datatypes

  • + 4 comments

    why is

    if(x>=-32768 && x<=32768)
    

    Different from:

    if(x >= -Math.pow(2, 15) && x <= Math.pow(2, 15) - 1)
    

    I tried the first one since its the value given by java documentation but it doesn't work on the last two test cases. can anyone please tell me..