Utility functions for strings of binary digits
Project description
Binstr - A collection of utility functions for creating and operating on
strings of binary digits. It is compatible with Python versions >2.6
including 3.x.
It is useful to use these functions to make small bugs in your code
easier to find since all inputs are checked thoroughly for errors
using assertions.
Includes:
int_to_b() - Convert a positive integer to a sting of binary
e.g. int_to_b(5) -> '00000101'
frac_to_b() - Convert a positive fraction to a string of binary
e.g. frac_to_b(0.5) -> '10000000'
b_and() - Perform a bitwise AND
b_or() - Perform a bitwise OR
b_xor() - Perform a bitwise XOR
b_nand() - Perform a bitwise NAND
b_nor() - Perform a bitwise NOR
b_nxor() - Perform a bitwise NXOR
b_not() - Perform a bitwise NOT (inversion)
b_add() - Perform an ADD operation
b_mul() - Perform a MUL operation (multiply)
strings of binary digits. It is compatible with Python versions >2.6
including 3.x.
It is useful to use these functions to make small bugs in your code
easier to find since all inputs are checked thoroughly for errors
using assertions.
Includes:
int_to_b() - Convert a positive integer to a sting of binary
e.g. int_to_b(5) -> '00000101'
frac_to_b() - Convert a positive fraction to a string of binary
e.g. frac_to_b(0.5) -> '10000000'
b_and() - Perform a bitwise AND
b_or() - Perform a bitwise OR
b_xor() - Perform a bitwise XOR
b_nand() - Perform a bitwise NAND
b_nor() - Perform a bitwise NOR
b_nxor() - Perform a bitwise NXOR
b_not() - Perform a bitwise NOT (inversion)
b_add() - Perform an ADD operation
b_mul() - Perform a MUL operation (multiply)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
binstr-1.0.tar.gz
(4.9 kB
view details)
File details
Details for the file binstr-1.0.tar.gz
.
File metadata
- Download URL: binstr-1.0.tar.gz
- Upload date:
- Size: 4.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 024c32494747685bd20faef3488f90bb42dc83b50f531f9b87dfab2ecd34b086 |
|
MD5 | 92bcee89b57edf0c5b28fe51836a9874 |
|
BLAKE2b-256 | 8af1920598b82860b3bbf09ea216b25487abc7b304d871afb668226e6884f742 |