flopscope.

flopscope.numpy.base_repr

flopscope.numpy.base_repr(number, base=2, padding=0)[flopscope source]

Return a string representation of a number in the given base system.

Parameters

number:int

The value to convert. Positive and negative values are handled.

base:int, optional

Convert number to the base number system. The valid range is 2-36, the default value is 2.

padding:int, optional

Number of zeros padded on the left. Default is 0 (no padding).

Returns

out:str

String representation of number in base system.

See also

Examples

>>> import flopscope.numpy as fnp
>>> flops.base_repr(5)
    '101'
>>> flops.base_repr(6, 5)
    '11'
>>> flops.base_repr(7, base=5, padding=3)
    '00012'
>>> flops.base_repr(10, base=16)
'A'
>>> flops.base_repr(32, base=16)
'20'