Bit Fiddle
Help
What does this application do?
- Conversion of arbitrarily large Integer-Numbers in the decimal-, hexadecimal- and binary system and in ASCII-Characters.
- Computation of Ones and Twos Complement.
- Exchange of bytes of the input to convert between little and big endian.
- Display of a simple ASCII table with additional information to each character.
UI elements of the main window
The main window exists in two variants: A large and a mini version. To switch between the two versions, press the green button in the title bar or select the appropriate command in the window menu.
The main window is divided in to the entry fields above, the output fields in the middle and the settings below.
The input and output fields are arrangen in a table, whereas the columns represent the different bases and the rows represent the differen byte sizes: 8, 16, 32, 64 and n Bytes. With n Bytes, the result will automatically use as many bytes as neede for an unsigned number.
When inputting numbers, only very specific digits are parsed. Any character which is not an allowed digit will simply be ignored (as well as the negativ sign! See below).
- Dec: Decimal numbers. Numbers with base 10, like those, humans normally work with. Digits: 0123456789
- Hex: Hexadecimal numbers. Numbers with base 16, often seen in computer programs. Digits: 0123456789abcdef as well as ABCDEF
- Bin: Binary numbers. Numbers with base 2, only two values are allowed. Digits 01. Additionally, also the characters oO, iI and L are allowed.
- Asc: ASCII-Characters. Numbers are assumed to be a sequence of 8-Bit-Characters and are displayed as ASCII-7 with leading 0. Any character of the ASCII charset is available. Numbers which do not correspond to a valid ASCII character will be displayed with a question mark ?
In the large window, there are additional sessings which can be selected directly or by using the appropriate menu command:
- Little ↔︎ Big: Exchange of bytes of the input field to convert between little- and big-endian. Beware: Only use this if you know what it is for.
- Unsigned: The input is interpreted as an unsigned number and will be converted directly into all output numbers.
- Ones complement: The input will be interpreted as an unsigned number, will be converted using the ones complement and will then be converted to all output numbers.
- Twos complement: The input will be interpreted as an unsigned number, will be converted using the twos complement and will then be converted to all output numbers.
- ASCII: Displays a simple ASCII table in a separate window with additional information to each character
- Menu Settings: Different settings concerning showing and hiding the different windows.
UI elements of the ASCII window
The window is divided into the ASCII characters above and the settings below.
By hovering over the differen characters, additional informations will be displayed in the section below.
- Escape / Code In programming languages with C syntax, certain characters can be displayed using Escape codes. Use this control to switch between the escape codes or the official ISO codes of the first 32 Characters.
- Hex / Dec: Switch between hexadecimal or decimal numbering of the characters.
Preferences
At application start:
- hide ASCII window: The window with the ASCII characters will be hidden upon application start.
- Reset conversion: The conversion settings will be reset to unsigned computation without endianness switch at each application restart.
Keep windows in foreground:
- Extensive Window: The large window will be kept in front of all applications.
- Mini-Version: The mini window will be kept in front of all applications.
Why isn't the twos complement negative?
There is a large confusion about what exactly the twos complement is. Many people think the twos complement inside a computer is the same as a negative number. This is not true.
We humans compute numbers using the decimal system with the digits 0 to 9. To express a negative number, we have an additional character> The negativ sign. A computer though can only express numbers with two digits 0 and 1 and has no additional character for negative numbers. Therefore, he must somehow encode a negative number with 0 and 1 such that both positive as well as negative numbers can be stored. Nowadays, the most common way to do this is using the twos complement. of the absolute value.
The twos complement therefore depicts the conversion of an absolute value, stored as a binary value. How to finally interpret such a binary value though can not be predicted. One can not distinguish between signed or unsigned values. For computing the twos complement, such interpretation is irrelevant as it simply converts the binary digits using a clearly specified method.
There are rather a lot of different possibilities to convert binary values, interpret them, shorten or extend them as well as display them. If all possibilities would have been implemented in Bit Fiddle, the UI would have become very complex. The developer decided to provide only the most common conversions. Some cases are therefore hard to achieve but these cases are usually the trivial cases which no developer bothers to enter digits into a program. To understand, what is going on in Bit Fiddle, here is a complete description of the conversion process:
The exact process of converting numbers
- First, the input values (Dec, Hex, Bin or Asc) are converted into an internal format consisting of multiple bits. Only the characters listed above will be used, all the rest will be discarded. A negative decimal number as input therefore will never be interpreted as negative as the negative sign is ignored. Internally, the number of bits to store the input is arbitrary high but always consist of the exact number of bytes which would be required to store the entered value as an unsigned value. This means the number of bits resulting is always divisible by 8.
- After that, if the
Little ↔︎ Big
option is activated, the bytes are reversed. - Then the selected conversion takes place, meaning
Unsigned
(Which does nothing),Ones complement
orTwos complement
. - After that, the RESULTING bits are packed into the different output format widths.
- If the internal bitcount is higher than the number of bits available in the output format, the higher-order bits are cut off. For example the internal number 0b00110011 10101010 results in the 8-bit output 0b10101010. This corresponds exactly to the implicit integer conversion mechanism of many programming languages.
- If the internal bitcount uses less bits than the output format, the internal bits will be extended ARITHMETICALLY. This means, that any internal number which apperas to be SIGNED, will be interpreted as such. For example the internal number 0b10101010 will result in the 16 bit output 0b11111111 10101010. This has been designed in Bit Fiddle this way because the non-arithmetical conversion (the logical conversion by simply adding zeros as high order bits) is trivial and will not result in any more insight. It is assumed that an user knows that and that he will see immediately if the numer was extended arithmetically.
- After that, the different output widths will be converted into the differen base systems. This results in decimal numbers, hexadecimal numbers, binary numbers and ASCII strings.
- Decimal numbers will be displayed as groups of 3 using the decimal digits 0 to 9 separated by a space. In case of conversion using the ones complement, no output will be generated. In case the conversion of the twos complement is active, the number will be interpreted as signed and hence will be expressed with a negative sign, if applicable.
- Hexadecimal numbers will be displayed using pairwise hexadecimal digits, separated by a space. The letters will be printed in lower case.
- Binary numbers will be displayed using groups of 8, consisting of 0 and 1 and separated by a space.
- ASCII strings will be expressed as pure 7 bit ASCII characters whereas the highes order bit is set to 0. Bytes which do not result in a valid ASCII character will be displayed with a questionmark ?
This conversion should cover all non-trivial conversions of your everyday work with integer numbers.
Beware, as the input will always be assumed to be unsigned, it is not possible to enter a signed number using hexadecimal numbers and read out the negative value as a decimal number. For those interesten in that, they should convert the number using the twos complement and add a negative sign to the resulting number.