[Scipy-tickets] [SciPy] #876: scipy.spatial.distance.sokalsneath raises a ZeroDivisionError

SciPy Trac scipy-tickets@scipy....
Fri Nov 26 18:34:51 CST 2010


#876: scipy.spatial.distance.sokalsneath raises a ZeroDivisionError
----------------------------+-----------------------------------------------
  Reporter:  jpaalasm       |       Owner:  peridot       
      Type:  defect         |      Status:  closed        
  Priority:  normal         |   Milestone:  0.9.0         
 Component:  scipy.spatial  |     Version:  devel         
Resolution:  fixed          |    Keywords:  version: 0.7.0
----------------------------+-----------------------------------------------
Changes (by warren.weckesser):

  * status:  new => closed
  * resolution:  => fixed


Old description:

> {{{
> In [107]: scipy.spatial.distance.sokalsneath((False, False), (False,
> False))
> ---------------------------------------------------------------------------
> ZeroDivisionError                         Traceback (most recent call
> last)
>
> /home/jpaalasm/<ipython console> in <module>()
>
> /usr/lib/python2.5/site-packages/scipy/spatial/distance.pyc in
> sokalsneath(u, v)
>     825         ntt = (u * v).sum()
>     826     (nft, ntf) = _nbool_correspond_ft_tf(u, v)
> --> 827     return float(2.0 * (ntf + nft))/float(ntt + 2.0 * (ntf +
> nft))
>     828
>     829
>
> ZeroDivisionError: float division
>
> }}}

New description:

 {{{
 In [107]: scipy.spatial.distance.sokalsneath((False, False), (False,
 False))
 ---------------------------------------------------------------------------
 ZeroDivisionError                         Traceback (most recent call
 last)

 /home/jpaalasm/<ipython console> in <module>()

 /usr/lib/python2.5/site-packages/scipy/spatial/distance.pyc in
 sokalsneath(u, v)
     825         ntt = (u * v).sum()
     826     (nft, ntf) = _nbool_correspond_ft_tf(u, v)
 --> 827     return float(2.0 * (ntf + nft))/float(ntt + 2.0 * (ntf + nft))
     828
     829

 ZeroDivisionError: float division

 }}}

--

Comment:

 Fixed in r6945--it will now raise a ValueError if both vectors are
 entirely False.

-- 
Ticket URL: <http://projects.scipy.org/scipy/ticket/876#comment:1>
SciPy <http://www.scipy.org>
SciPy is open-source software for mathematics, science, and engineering.


More information about the Scipy-tickets mailing list