I've searched a bit, and still can't find an answer for this.
I am computing a formula for distances between tree nodes, and in my test case, my formula takes the number of leaves in node i, and divides it by the number of leaves in node i + the number of leaves in node j.
These give me 1 and 2 respectively, since both i and j have one leaf each.
My issue is that when I divide 1 by 2, I get zero.
All these numbers are doubles, so I don't see what the problem is. . .
Here is my code:
formula1 = ((newNode.getLeftChild().getNumLeafs()) / (newNode.getLeftChild().getNumLeafs() + newNode.getRightChild().getNumLeafs()));