summaryrefslogtreecommitdiff
path: root/gnuradio-runtime/python/gnuradio/gru/mathmisc.py
blob: d4619d4a28f1b0f05aa7b74087c49e48cb87bc48 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
from __future__ import division
from __future__ import unicode_literals
#
# 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)