def detailed_units(all_levels = false)
      mag = @magnitude
      prev_units = self.units
      units = {}
      loop do
        compound = false
        prev_units.each_pair do |dim, (unit,mul)|
          ud = Units.unit(unit)
          if ud.decomposition
            compound = true
            mag *= ud.decomposition.magnitude
            ud.decomposition.units.each_pair do |d, (u,m)|
              mag *= self.class.combine(units, d, u, m*mul)
            end
          else
            mag *= self.class.combine(units, dim, unit, mul)
          end
        end
        if all_levels && compound
          prev_units = units
          units = {}
        else
          break
        end
      end
      Measure.new mag, units
    end
def detailed_units(all_levels = false)
      mag = @magnitude
      prev_units = self.units
      units = {}
      loop do
        compound = false
        prev_units.each_pair do |dim, (unit,mul)|
          ud = Units.unit(unit)
          if ud.decomposition
            compound = true
            mag *= ud.decomposition.magnitude
            ud.decomposition.units.each_pair do |d, (u,m)|
              mag *= self.class.combine(units, d, u, m*mul)
            end
          else
            mag *= self.class.combine(units, dim, unit, mul)
          end
        end
        if all_levels && compound
          prev_units = units
          units = {}
        else
          break
        end
      end
      Measure.new mag, units
    end
decompose compound units