pyhobdcalc is a Python module written in C which implements conversion and calculating functions in bases 2, 8, 10, 16, which Python doesn't implement, such as:
- Signed binary, octal, hexadecimal conversion in integers;
- Signed float conversion from decimal to base 2, 8, 16 or from bases 2, 8, 16 to decimal base;
- Addition, subtraction, multiplication and division on integers and float strings in bases 2, 8, and 16.
bintoint:
Convert a binary string, optionally prefixed with the binary identifier "0b". The function accepts signed values in the C type long long int value range:
- Maximum value: 9223372036854775807.
- Minimum value: -9223372036854775808.
And returns the converted value as an integer string.
octtoint:
Convert an octal string, optionally prefixed with the octal identifier "0". The function accepts signed values in the C type long long int value range:
- Maximum value: 9223372036854775807.
- Minimum value: -9223372036854775808.
And returns the converted value as an integer string.
hextoint:
Convert a hexadecimal string, optionally prefixed with the hexadecimal identifier "0x". The function accepts signed values in the C type long long int value range:
- Maximum value: 9223372036854775807.
- Minimum value: -9223372036854775808.
And returns the converted value as an integer string.
binfloattofloat:
Convert a binary string with optional binary identifier "0b" representing a floating-point value into a float with maximum precision of 15 digits.
And return the converted value as a float string.
note: The returned value is limited to the C type double (15 digits precision) but internally the module uses the C type long double (19 digits precision) for getting an exact value. octfloattofloat:
Convert an octal string with optional octal identifier "0" representing a floating-point value into a float with maximum precision of 15 digits.
And return the converted value as a float string.
note: The returned value is limited to the C type double (15 digits precision) but internally the module uses the C type long double (19 digits precision) for getting an exact value. hexfloattofloat:
Convert a hexadecimal string with optional hexadecimal identifier "0x" representing a floating-point value into a float with maximum precision of 15 digits.
And return the converted value as a float string.
note: The returned value is limited to the C type double (15 digits precision) but internally the module uses the C type long double (19 digits precision) for getting an exact value.
floattobinfloat:
Convert a float given as a string into a floating-point binary string with a maximum length of 16 binary digits. The given float integer part has a maximum length of 8 bytes.
And return the floating-point binary string corresponding to the given float with the given limitations.
floattooctfloat:
Convert a float given as a string into a floating-point octal string with a maximum length of 16 octal digits. The given float integer part has a maximum length of 8 bytes.
And return the floating-point octal string corresponding to the given float with the given limitations.
floattohexfloat:
Convert a float given as a string into a floating-point hexadecimal string with a maximum length of 16 hexadecimal digits. The given float integer part has a maximum length of 8 bytes.
And return the floating-point hexadecimal string corresponding to the given float with the given limitations.
binaddbin:
Add 2 binary strings, optionally prefixed with the binary identifier "0b". The function accepts signed values in the C type long long int value range:
- Maximum value: 9223372036854775807.
- Minimum value: -9223372036854775808.
And return the addition result as an integer string.
note: The addition result cannot overflow the same maximum and minimal range as for the given arguments values. binsubbin:
Subtract 2 binary strings, optionally prefixed with the binary identifier "0b". The function accepts signed values in the C type long long int value range:
- Maximum value: 9223372036854775807.
- Minimum value: -9223372036854775808.
And return the subtraction result as an integer string.
note: The subtraction result cannot overflow the same maximum and minimal range as for the given arguments values. binmultbin:
Multiply 2 binary strings, optionally prefixed with the binary identifier "0b". The function accepts signed values in the C type long long int value range:
- Maximum value: 9223372036854775807.
- Minimum value: -9223372036854775808.
And return the multiplication result as an integer string.
note: The multiplication result cannot overflow the same maximum and minimal range as for the given arguments values. bindivbin:
Divide 2 binary strings, optionally prefixed with the binary identifier "0b". The function accepts signed values in the C type long long int value range:
- Maximum value: 9223372036854775807.
- Minimum value: -9223372036854775808.
And return the division result as an integer string.
note: The returned value is limited to the C type double (15 digits precision) but internally the module uses the C type long double (19 digits precision) for getting an exact value.
octaddoct:
Add 2 octal strings, optionally prefixed with the octal identifier "0". The function accepts signed values in the C type long long int value range:
- Maximum value: 9223372036854775807.
- Minimum value: -9223372036854775808.
And return the addition result as an integer string.
note: The addition result cannot overflow the same maximum and minimal range as for the given arguments values. octsuboct:
Subtract 2 octal strings, optionally prefixed with the octal identifier "0". The function accepts signed values in the C type long long int value range:
- Maximum value: 9223372036854775807.
- Minimum value: -9223372036854775808.
And return the subtraction result as an integer string.
note: The subtraction result cannot overflow the same maximum and minimal range as for the given arguments values. octmultoct:
Multiply 2 octal strings, optionally prefixed with the octal identifier "0". The function accepts signed values in the C type long long int value range:
- Maximum value: 9223372036854775807.
- Minimum value: -9223372036854775808.
And return the multiplication result as an integer string.
note: The multiplication result cannot overflow the same maximum and minimal range as for the given arguments values. octdivoct:
Divide 2 octal strings, optionally prefixed with the octal identifier "0". The function accepts signed values in the C type long long int value range:
- Maximum value: 9223372036854775807.
- Minimum value: -9223372036854775808.
And return the division result as an integer string.
note: The returned value is limited to the C type double (15 digits precision) but internally the module uses the C type long double (19 digits precision) for getting an exact value.
hexaddhex:
Add 2 hexadecimal strings, optionally prefixed with the hexadecimal identifier "0x". The function accepts signed values in the C type long long int value range:
- Maximum value: 9223372036854775807.
- Minimum value: -9223372036854775808.
And return the addition result as an integer string.
note: The addition result cannot overflow the same maximum and minimal range as for the given arguments values. hexsubhex:
Subtract 2 hexadecimal strings, optionally prefixed with the hexadecimal identifier "0x". The function accepts signed values in the C type long long int value range:
- Maximum value: 9223372036854775807.
- Minimum value: -9223372036854775808.
And return the subtraction result as an integer string.
note: The subtraction result cannot overflow the same maximum and minimal range as for the given arguments values. hexmulthex:
Multiply 2 hexadecimal strings, optionally prefixed with the hexadecimal identifier "0x". The function accepts signed values in the C type long long int value range:
- Maximum value: 9223372036854775807.
- Minimum value: -9223372036854775808.
And return the multiplication result as an integer string.
note: The multiplication result cannot overflow the same maximum and minimal range as for the given arguments values. hexdivhex:
Divide 2 hexadecimal strings, optionally prefixed with the hexadecimal identifier "0x". The function accepts signed values in the C type long long int value range:
- Maximum value: 9223372036854775807.
- Minimum value: -9223372036854775808.
And return the division result as an integer string.
note: The returned value is limited to the C type double (15 digits precision) but internally the module uses the C type long double (19 digits precision) for getting an exact value.
binfloataddbinfloat:
Add 2 binary strings, optionally prefixed with the binary identifier "0b". The function accepts 8 bytes values for the integer part from the float, in the C type long long int value range:
- Maximum integer part value: 9223372036854775807.
- Minimum integer part value: -9223372036854775808.
The entire binary string can contains 128 binary digits (without identifier, sign and comma.).
And return the result value as a float string.
note: The returned value is limited to the C type double (15 digits precision) but internally the module uses the C type long double (19 digits precision) for getting an exact value. binfloatsubbinfloat:
Subtract 2 binary strings, optionally prefixed with the binary identifier "0b". The function accepts 8 bytes values for the integer part from the float, in the C type long long int value range:
- Maximum integer part value: 9223372036854775807.
- Minimum integer part value: -9223372036854775808.
The entire binary string can contains 128 binary digits (without identifier, sign and comma.).
And return the result value as a float string.
note: The returned value is limited to the C type double (15 digits precision) but internally the module uses the C type long double (19 digits precision) for getting an exact value. binfloatmultbinfloat:
Multiply 2 binary strings, optionally prefixed with the binary identifier "0b". The function accepts 8 bytes values for the integer part from the float, in the C type long long int value range:
- Maximum integer part value: 9223372036854775807.
- Minimum integer part value: -9223372036854775808.
The entire binary string can contains 128 binary digits (without identifier, sign and comma.).
And return the result value as a float string.
note: The returned value is limited to the C type double (15 digits precision) but internally the module uses the C type long double (19 digits precision) for getting an exact value. binfloatdivbinfloat:
Divide 2 binary strings, optionally prefixed with the binary identifier "0b". The function accepts 8 bytes values for the integer part from the float, in the C type long long int value range:
- Maximum integer part value: 9223372036854775807.
- Minimum integer part value: -9223372036854775808.
The entire binary string can contains 128 binary digits (without identifier, sign and comma.).
And return the result value as a float string.
note: The returned value is limited to the C type double (15 digits precision) but internally the module uses the C type long double (19 digits precision) for getting an exact value.
octfloataddoctfloat:
Add 2 octal strings, optionally prefixed with the octal identifier "0". The function accepts 8 bytes values for the integer part from the float, in the C type long long int value range:
- Maximum integer part value: 9223372036854775807.
- Minimum integer part value: -9223372036854775808.
The entire octal string can contains 48 octal digits (without identifier, sign and comma.).
And return the result value as a float string.
note: The returned value is limited to the C type double (15 digits precision) but internally the module uses the C type long double (19 digits precision) for getting an exact value. octfloatsuboctfloat:
Subtract 2 octal strings, optionally prefixed with the octal identifier "0". The function accepts 8 bytes values for the integer part from the float, in the C type long long int value range:
- Maximum integer part value: 9223372036854775807.
- Minimum integer part value: -9223372036854775808.
The entire octal string can contains 48 octal digits (without identifier, sign and comma.).
And return the result value as a float string.
note: The returned value is limited to the C type double (15 digits precision) but internally the module uses the C type long double (19 digits precision) for getting an exact value. octfloatmultoctfloat:
Multiply 2 octal strings, optionally prefixed with the octal identifier "0". The function accepts 8 bytes values for the integer part from the float, in the C type long long int value range:
- Maximum integer part value: 9223372036854775807.
- Minimum integer part value: -9223372036854775808.
The entire octal string can contains 48 octal digits (without identifier, sign and comma.).
And return the result value as a float string.
note: The returned value is limited to the C type double (15 digits precision) but internally the module uses the C type long double (19 digits precision) for getting an exact value. octfloatdivoctfloat:
Divide 2 octal strings, optionally prefixed with the octal identifier "0". The function accepts 8 bytes values for the integer part from the float, in the C type long long int value range:
- Maximum integer part value: 9223372036854775807.
- Minimum integer part value: -9223372036854775808.
The entire octal string can contains 48 octal digits (without identifier, sign and comma.).
And return the result value as a float string.
note: The returned value is limited to the C type double (15 digits precision) but internally the module uses the C type long double (19 digits precision) for getting an exact value.
hexfloataddhexfloat:
Add 2 hexadecimal strings, optionally prefixed with the hexadecimal identifier "0x". The function accepts 8 bytes values for the integer part from the float, in the C type long long int value range:
- Maximum integer part value: 9223372036854775807.
- Minimum integer part value: -9223372036854775808.
The entire hexadecimal string can contains 16 hexadecimal digits (without identifier, sign and comma.).
And return the result value as a float string.
note: The returned value is limited to the C type double (15 digits precision) but internally the module uses the C type long double (19 digits precision) for getting an exact value. hexfloatsubhexfloat:
Subtract 2 hexadecimal strings, optionally prefixed with the hexadecimal identifier "0x". The function accepts 8 bytes values for the integer part from the float, in the C type long long int value range:
- Maximum integer part value: 9223372036854775807.
- Minimum integer part value: -9223372036854775808.
The entire hexadecimal string can contains 16 hexadecimal digits (without identifier, sign and comma.).
And return the result value as a float string.
note: The returned value is limited to the C type double (15 digits precision) but internally the module uses the C type long double (19 digits precision) for getting an exact value. hexfloatmulthexfloat:
Multiply 2 hexadecimal strings, optionally prefixed with the hexadecimal identifier "0x". The function accepts 8 bytes values for the integer part from the float, in the C type long long int value range:
- Maximum integer part value: 9223372036854775807.
- Minimum integer part value: -9223372036854775808.
The entire hexadecimal string can contains 16 hexadecimal digits (without identifier, sign and comma.).
And return the result value as a float string.
note: The returned value is limited to the C type double (15 digits precision) but internally the module uses the C type long double (19 digits precision) for getting an exact value. hexfloatdivhexfloat:
Divide 2 hexadecimal strings, optionally prefixed with the hexadecimal identifier "0x". The function accepts 8 bytes values for the integer part from the float, in the C type long long int value range:
- Maximum integer part value: 9223372036854775807.
- Minimum integer part value: -9223372036854775808.
The entire hexadecimal string can contains 16 hexadecimal digits (without identifier, sign and comma.).
And return the result value as a float string.
note: The returned value is limited to the C type double (15 digits precision) but internally the module uses the C type long double (19 digits precision) for getting an exact value.