Difference between revisions of "Manuals/calci/HEX2OCT"
Jump to navigation
Jump to search
(8 intermediate revisions by one other user not shown) | |||
Line 1: | Line 1: | ||
=HEX2OCT(number,places)= | =HEX2OCT(number,places)= | ||
− | *Where | + | *Where <math>number</math> is a hexadecimal number to be converted and |
− | * | + | *<math>places</math> is the number of characters to be used to display the output. |
HEX2OCT converts a hexadecimal number to its octal equivalent. | HEX2OCT converts a hexadecimal number to its octal equivalent. | ||
Line 12: | Line 12: | ||
For Example, | For Example, | ||
− | HEX2OCT("A",4) ''returns ' | + | HEX2OCT("A",4) ''returns 0012'' |
− | HEX2OCT("") ''returns '' | + | HEX2OCT("FA",6) ''returns 000372'' |
− | HEX2OCT("") ''returns '' | + | HEX2OCT("09") ''returns 0000000011'' |
− | + | *<math>number</math> must be a hexadecimal number. Hexadecimal number uses digits 0 to 9 and characters A to F. The number can also be entered in text format (e.g "1F"). | |
− | * | ||
*The most significant bit represents the 'sign' of the number. Negative numbers are represented using 2's complement notation. | *The most significant bit represents the 'sign' of the number. Negative numbers are represented using 2's complement notation. | ||
Line 25: | Line 24: | ||
*A number preceding with '0' (e.g 013) should be written in text format ("013") to avoid confusion with octal numbers. | *A number preceding with '0' (e.g 013) should be written in text format ("013") to avoid confusion with octal numbers. | ||
− | *Calci returns an #ERROR message if | + | *Calci returns an #ERROR message if <math>number</math> is greater than 'FFFFFFF'. |
− | < | ||
− | *If | + | *If <math>number</math> is negative, Calci ignores the places and displays 10 digit octal output. |
− | *If | + | *If <math>places</math> is not an integer, it is truncated. |
− | *If | + | *If <math>places</math> are non-numeric, Calci returns an #ERROR message. |
− | *If | + | *If <math>places</math> is negative, Calci displays #NUM! error message. |
+ | |||
+ | *If <math>places</math> is omitted, Calci displays the 10 digit octal output by adding the leading zeros (if required). | ||
+ | |||
+ | *If <math>places</math> is less than the digits required by the output, Calci ignores the places and uses the minimum number of digits required to display the octal output. | ||
== Examples == | == Examples == | ||
Line 44: | Line 46: | ||
|- class="odd" | |- class="odd" | ||
− | | class="sshl_f" | | + | | class="sshl_f" | HEX2OCT("44F",5) |
− | | class="sshl_f" | | + | | class="sshl_f" | 02117 |
|- class="even" | |- class="even" | ||
− | | class="ssh1_f" | | + | | class="ssh1_f" | HEX2OCT("17") |
− | | class="sshl_f" | | + | | class="sshl_f" | 0000000027 |
|- class="odd" | |- class="odd" | ||
− | | class="ssh1_f" | | + | | class="ssh1_f" | HEX2OCT("D1C",-3) |
− | | class="sshl_f" | | + | | class="sshl_f" | #NUM! |
|- class="even" | |- class="even" | ||
− | | class="ssh1_f" | | + | | class="ssh1_f" | HEX2OCT("FFFFFFF") |
− | | class="sshl_f" | | + | | class="sshl_f" | 1777777777 |
|} | |} | ||
+ | |||
+ | ==Related Videos== | ||
+ | |||
+ | {{#ev:youtube|KgYrP4m4jPM|280|center|HEX2OCT}} | ||
== See Also == | == See Also == |
Latest revision as of 00:12, 26 October 2015
HEX2OCT(number,places)
- Where is a hexadecimal number to be converted and
- is the number of characters to be used to display the output.
HEX2OCT converts a hexadecimal number to its octal equivalent.
Description
HEX2OCT(number,places)
For Example,
HEX2OCT("A",4) returns 0012
HEX2OCT("FA",6) returns 000372
HEX2OCT("09") returns 0000000011
- must be a hexadecimal number. Hexadecimal number uses digits 0 to 9 and characters A to F. The number can also be entered in text format (e.g "1F").
- The most significant bit represents the 'sign' of the number. Negative numbers are represented using 2's complement notation.
- A number preceding with '0' (e.g 013) should be written in text format ("013") to avoid confusion with octal numbers.
- Calci returns an #ERROR message if is greater than 'FFFFFFF'.
- If is negative, Calci ignores the places and displays 10 digit octal output.
- If is not an integer, it is truncated.
- If are non-numeric, Calci returns an #ERROR message.
- If is negative, Calci displays #NUM! error message.
- If is omitted, Calci displays the 10 digit octal output by adding the leading zeros (if required).
- If is less than the digits required by the output, Calci ignores the places and uses the minimum number of digits required to display the octal output.
Examples
HEX Input | Octal Output |
HEX2OCT("44F",5) | 02117 |
HEX2OCT("17") | 0000000027 |
HEX2OCT("D1C",-3) | #NUM! |
HEX2OCT("FFFFFFF") | 1777777777 |