backpack.numanip

Useful functions for everyday use —> int and floats

brixs.backpack.numanip.is_integer(n)

Returns True if number is integer.

brixs.backpack.numanip.is_number(n)

Returns True if variable is number.

brixs.backpack.numanip.round_to_1(x)

return the most significant digit

brixs.backpack.numanip.n_decimal_places(number, count_zero=False)

Return the number of decimal places of a number.

Parameters:
  • number (float or int) – number.

  • count_zero (bool, optional) – if an integer is type float, it will came out with a zero after the decimal point, eg, 145.0 instead of 145. count_zero == False will not count zeros after the decimal point. Default is False.

Returns:

number of decimal places in number.

brixs.backpack.numanip.n_digits(number, count_zero=False)

Return the number of digits of a number.

Parameters:
  • number (float or int) – number.

  • count_zero (bool, optional) – if number is type float, it will came out with a zero after the decimal point, eg, 145.0 instead of 145. count_zero == False will not count zeros after the decimal point. Default is False

Returns:

number of digits

brixs.backpack.numanip.factors(n)

Return a tuple with all the factors of a number.