astropy/astropy — pull request #2315 by keflavich (2014-04-12 15:13:12+00:00)
Title: u.deg.is_equivalent(0*u.deg) results in div-by-zero

```
u.deg.is_equivalent(0*u.deg)

---------------------------------------------------------------------------
ZeroDivisionError Traceback (most recent call last)
in ()
----> 1 u.deg.is_equivalent(0*u.deg)

/Users/adam/repos/astropy/astropy/units/core.pyc in is_equivalent(self, other, equivalencies)
727 for u in other)
728 else:
--> 729 other = Unit(other, parse_strict='silent')
730
731 return self._is_equivalent(other, equivalencies)

/Users/adam/repos/astropy/astropy/units/core.pyc in __call__(self, s, represents, format, namespace, doc, parse_strict)
1683 s = CompositeUnit(s.value * s.unit.scale,
1684 bases=s.unit.bases,
-> 1685 powers=s.unit.powers)
1686
1687 # now decide what we really need to do; define derived Unit?

/Users/adam/repos/astropy/astropy/units/core.pyc in __init__(self, scale, bases, powers, decompose, decompose_bases, _error_check)
1889 # off.
1890 if _error_check:
-> 1891 scale = sanitize_scale(scale)
1892 for base in bases:
1893 if not isinstance(base, UnitBase):

/Users/adam/repos/astropy/astropy/units/utils.pyc in sanitize_scale(scale)
143 scale = scale.real
144 else:
--> 145 if is_effectively_unity(scale.real/scale.imag + 1):
146 scale = complex(0., scale.imag)
147

ZeroDivisionError: float division by zero
```