astropy/astropy — pull request #2249 by mhvk (2014-03-29 16:09:57+00:00)
Title: math functions don't decompose quantities correctly

When using math functions on astropy quantities, the units are not always correctly decomposed. For example, this code:
```
q=1*u.MHz * u.s
print(q)
print(q.decompose())
print(np.log(q))
print(math.log(q))
```
yields:
```
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
in ()
3 print(q.decompose())
4 print(np.log(q))
----> 5 print(math.log(q))

/usr/lib64/python2.7/site-packages/astropy/units/quantity.pyc in __float__(self)
719 def __float__(self):
720 if not self.isscalar or not self.unit.is_unity():
--> 721 raise TypeError('Only dimensionless scalar quantities can be '
722 'converted to Python scalars')
723 else:

TypeError: Only dimensionless scalar quantities can be converted to Python scalars

1 MHz s
1000000.0
13.815510558
```
The `` print(math.log(q)) `` should instead decompose MHz*s to a dimensionless unit, and perform the log operation on that.