lcm

in lib/twitter_cldr/formatters/numbers/rbnf/rule_set.rb [139:163]


        def lcm(x, y)
          
          
          x1 = x
          y1 = y
          p2 = 0

          while (x1 & 1) == 0 && (y1 & 1) == 0
            p2 += 1
            x1 >>= 1
            y1 >>= 1
          end

          t = (x1 & 1) == 1 ? -y1 : x1

          while t != 0
            t >>= 1 while (t & 1) == 0
            t > 0 ? x1 = t : y1 = -t
            t = x1 - y1
          end

          gcd = x1 << p2
          x / gcd * y
        end