- 1

How come does the division operation 1/3 in eclipse results in 0.0

9th Dec 2016, 8:02 PM
Henrique Machado
Henrique Machado - avatar
2 odpowiedzi
+ 2
... Well, Eclipse, from what I can gather is a Development Environment for Java. One Third equals to Zero point Zero ? This would be True if Eclipse Rounded the result to the closest Whole Integer. And, as it displays Outputed Numbers as Floats... there you go? In all Honesty, I am a bit stumped by this too. So don't take my words for granted. It was a mere suggestion :) Good Luck.
9th Dec 2016, 8:06 PM
ghostwalker13
ghostwalker13 - avatar
0
The answer comes out to be 0.0 because 1 and 3 are int values. U have to typecast them to float or double to get the correct output.
11th Dec 2016, 11:40 AM
Syed Saqib Ali
Syed Saqib Ali - avatar