summaryrefslogtreecommitdiff
path: root/gnuradio-runtime/python/gnuradio/gru/mathmisc.py
blob: 2f6d97df31676f61b062c88de71ce9d521ac35cb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#
# Copyright 2005 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
#

import math

def gcd(a,b):
    while b:
        a,b = b, a % b
    return a

def lcm(a,b):
    return a * b / gcd(a, b)

def log2(x):
    return math.log(x) / math.log(2)