astropy/astropy — pull request #1407 by mhvk (2013-09-04 19:58:54+00:00)
Title: Treat scales as unity if they are offset from unity at machine precision - solves #748

Catch unit scales that are not exactly unity in formatting and in `Unit._is_unity()` by replacing the equivalent of `value == 1.` with a function `is_effectively_unity(value)` (which returns `_JUST_BELOW_UNITY <= value <= _JUST_ABOVE_UNITY`, where the two values are derived from `numpy.finfo()`). This solves #748, where `(3. * u.N).cgs` gave a non-unity scale.

Note: am somewhat unsure about nomenclature/location; happy to change.