java - precision error in output -
this question has answer here:
- division of integers in java 7 answers
double x = 9/2 //x == 4.0? the output should 4.5, 4.0 mistake made?
9/2 <- without decimal specify int
9.0 / 2.0 <- double , should able 4.5
Comments
Post a Comment