calculating float numbers
publicstaticvoid main(String args[]){
System.out.println(0.1);// 0.1
System.out.println(0.7);// 0.7
System.out.println(0.1 + 0.7);// 0.7999999999999999
}
I expect 0.1, 0.7 and 0.8
why this happens?
thanks.
publicstaticvoid main(String args[]){
System.out.println(0.1);// 0.1
System.out.println(0.7);// 0.7
System.out.println(0.1 + 0.7);// 0.7999999999999999
}
I expect 0.1, 0.7 and 0.8
why this happens?
thanks.