from typing import Union
import math


def discretize(statistic: Union[float, int]) -> int:
    """Convert to nearest power of 2 to discretize"""
    if statistic == 0:
        return 0
    else:
        return 2 ** int(math.log2(statistic))