conv subcommand
The conv subcommand converts an arbitrary base number to a decimal, binary, octal, or hexadecimal number.
Format
conv [ -b | -d | -o | -x | -a base ] [ -s ] value
Parameters
| Item | Description |
|---|---|
| -b | Specifies that the number to convert specified by the value parameter is a binary number. |
| -d | Specifies that the number to convert specified by the value parameter is a decimal number. |
| -o | Specifies that the number to convert specified by the value parameter is an octal number. |
| -x | Specifies that the number to convert specified by the value parameter is a hexadecimal number. |
| -a base | Specifies that the number to convert specified by the value parameter is a number with the arbitrary base of base. The number must be between 2 and 36 inclusive. |
| -s | Extends the left-most, one-bit sign of the number to convert specified by the value parameter. |
| value | Specifies the number to convert. |
Other
No aliases.
Examples
The following is an example of how to use the conv subcommand:
KDB(0)> conv 1101
Binary : 0000000000000000000000000000000000000000000000000000010001001101
Octal : 0000000000000000002115
Decimal: 1101
Hex : 000000000000044D
KDB(0)> conv -b 1101
Binary : 0000000000000000000000000000000000000000000000000000000000001101
Octal : 0000000000000000000015
Decimal: 13
Hex : 000000000000000D
KDB(0)> conv -b -s 1101
Binary : 1111111111111111111111111111111111111111111111111111111111111101
Octal : 1777777777777777777775
Decimal: -3
Hex : FFFFFFFFFFFFFFFD
KDB(0)>