Difference between revisions of "Manuals/calci/BIN2HEX"
Jump to navigation
Jump to search
Line 25: | Line 25: | ||
*If the 'number' is invalid, Calci returns an #ERROR message. | *If the 'number' is invalid, Calci returns an #ERROR message. | ||
− | |||
<!--*Calci returns an error, if 'padding' is nonnumeric or negative.--> | <!--*Calci returns an error, if 'padding' is nonnumeric or negative.--> | ||
− | |||
*If 'padding' is not an integer, Calci truncates the value and uses integer part. | *If 'padding' is not an integer, Calci truncates the value and uses integer part. | ||
Revision as of 15:30, 15 November 2013
BIN2HEX(number,padding)
- Where 'number' is the binary number to be converted and
- 'padding' is the number of characters to display the output.
BIN2HEX() converts a binary number to its hexadecimal equivalent.
Description
BIN2HEX(number, padding)
This function is used to convert a binary number to its hexadecimal equivalent.
- 'number' must be a binary number. Binary number is represented using digits 1 or 0 only. The number can also be entered in text format (e.g "101").
- The most significant bit represents the 'sign' of the number (0=positive, 1=negative). Negative numbers are represented using 2's complement notation.
- Positive numbers may be from 0 (000000000) to 130046 (11111111111111110) and negative numbers from -1 (1111111111) to -512 (1000000000).
- A number preceding with '0' (e.g 01111111111) should be written in text format ("01111111111") to avoid confusion with octal numbers.
- If the 'number' exceeds the limit, Calci returns an #ERROR message.
- If the 'number' is negative, Calci ignores the padding and displays 10 digit hexadecimal number.
- If the 'number' is invalid, Calci returns an #ERROR message.
- If 'padding' is not an integer, Calci truncates the value and uses integer part.
For Example,
BIN2HEX(11111011, 3) returns 0FB
BIN2HEX(1110) returns E
BIN2HEX(11001100,6.6) returns 00000CC
Examples
Formula | Hex Output |
BIN2HEX(100) | 4 |
BIN2HEX(110011,4) | 0033 |
BIN2HEX(11001100,6) | 0000CC |
BIN2HEX(11110000) | F0 |