import math


def round_units(number, significant):
    """Round-off a number to a given number of significant digits.

    :param number: given number
    :param significant: significant digits
    """
    number_integer_part = math.floor(number)
    number_decimal_part = number - number_integer_part
    if number == 0:
        return 0
    int_precision = 0
    while number_integer_part >= 1:
        int_precision += 1
        number_integer_part /= 10
    digits = significant - int_precision
    if digits <= 0:
        # result is integer > 0
        return int(round(number * pow(10, digits)) / pow(10, digits))
    elif digits == significant:
        # float < 0
        float_precision = significant
        while number_decimal_part <= 0.1:
            float_precision += 1
            number_decimal_part *= 10
        return round(number, float_precision)
    # float > 0 but with decimal part
    return round(number, digits)