BinaryDecimalConversion

Converts decimal to and from binary.
to_binary(number) convert integer to binary string
Parameters:
- number: int, value to convert.
Returns: string
to_decimal(binary) Converts a binary in a string to decimal.
Parameters:
- binary: string, binary number in a string.
Returns: int
Added:
leftshift_logical(x, n)
Shift the bits of an integer to the left.
Parameters:
x: int . Value to shift.
n: int . Number of zeros to append to x.
Returns: int.
Added:
rightshift_logical(x, n)
Shift the bits of an integer to the right.
Parameters:
x: int . Value to shift.
n: int . Number of bits to remove at the right of x.
Returns: int.
leftshift_arithmetic(x, n)
Shift the bits of an integer to the left.
Parameters:
x: int . Value to shift.
n: int . Number of zeros to append to x.
Returns: int.
leftshift_arithmetic () {
reference:
stackoverflow.com/questions/5832982/how-to-get-the-logical-right-binary-shift-in-python
rightshift_arithmetic(x, n)
Shift the bits of an integer to the right.
Parameters:
x: int . Value to shift.
n: int . Number of bits to remove at the right of x.
Returns: int.
Updated:
leftshift_arithmetic(x, n)
Shift the bits of an integer to the left.
Parameters:
x: int . Value to shift.
n: int . Number of zeros to append to x.
Returns: int.
Pine Bibliothek
Ganz im Sinne von TradingView hat dieser Autor seinen/ihren Pine Code als Open-Source-Bibliothek veröffentlicht. Auf diese Weise können nun auch andere Pine-Programmierer aus unserer Community den Code verwenden. Vielen Dank an den Autor! Sie können diese Bibliothek privat oder in anderen Open-Source-Veröffentlichungen verwenden. Die Nutzung dieses Codes in einer Veröffentlichung wird in unseren Hausregeln reguliert.
Haftungsausschluss
Pine Bibliothek
Ganz im Sinne von TradingView hat dieser Autor seinen/ihren Pine Code als Open-Source-Bibliothek veröffentlicht. Auf diese Weise können nun auch andere Pine-Programmierer aus unserer Community den Code verwenden. Vielen Dank an den Autor! Sie können diese Bibliothek privat oder in anderen Open-Source-Veröffentlichungen verwenden. Die Nutzung dieses Codes in einer Veröffentlichung wird in unseren Hausregeln reguliert.