title: biopython (python3) phylo, how does the distance function works?
body: <p>Using the Phylo package in Python3, I am trying to compute distances between two terminal nodes (leaves) of a neighbour-joining tree. To do this, the package implements a distance function. However, the distance function gives me a different result from what is in my newick file (the difference is very light but quite important in my work). Here is my code: </p>
  
  <pre><code>#Libraries  
  
  import os
  from Bio import Phylo
  from io import StringIO
  
  # Tree
  handleD = StringIO("((E:0.2,D:0.1,C:0.1,B:0.3)2:0.3,A:0.5)1;")
  treeD = Phylo.read(handleD,"newick")
  
  # Distance
  treeD.distance("E","D")
  </code></pre>
  
  <p><strong>The distance returns 0.30000000000000004 and not 0.3 as describe in the newick format.</strong></p>
  
  <p>I tried to look at the source code: <a href="http://biopython.org/DIST/docs/api/Bio.Phylo.BaseTree.TreeMixin-class.html#distance" rel="nofollow noreferrer">http://biopython.org/DIST/docs/api/Bio.Phylo.BaseTree.TreeMixin-class.html#distance</a>
  that leads to that function : <a href="http://biopython.org/DIST/docs/api/Bio.Nexus.Trees-pysrc.html#Tree.sum_branchlength" rel="nofollow noreferrer">http://biopython.org/DIST/docs/api/Bio.Nexus.Trees-pysrc.html#Tree.sum_branchlength</a>
  but it doesn't explain why there is a difference in the values.</p>
  
  <p>Have you got an explanation why the function returns 0.30000000000000004 instead of 0.3 as described in the newick format?</p>
  
  <p>Thanks in advance.</p>