Radix Conversion (MB, MO, MX)

Top  Previous  Next

 

The radix conversion codes convert a number to/from binary (MB), octal (MO) or hexadecimal (MX).

 

 

Input Conversion

 

The MB, MO and MX conversions take a number represented by a character string of binary, octal or hexadecimal digits and converts it to an internal integer value.

 

Addition of the 0C suffix to these codes (MB0C, MO0C, MX0C) takes a character string holding a series of binary, octal or hexadecimal digits and translates each group of 8, 3 or 2 digits to the corresponding ASCII character. If the source data is not an exact multiple of 8, 3 or 2 digits in length, as appropriate to the conversion type, implied leading zeros are added.

 

 

Output Conversion

 

The MB, MO and MX conversions convert a number to binary, octal or hexadecimal form as a character string. Non-integer values are truncated towards zero.  Negative values are treated as unsigned 32 bit values. Leading zeros are suppressed.

 

The addition of the 0C suffix to any of these conversion codes treats the source data as a character string and converts each character to its binary, octal or hexadecimal representation.

 

 

Examples

 

Input conversion:

Source data

Conversion

Result

1110

MB

14

37777777762

MO

-14

31342E36

MX

14.6

010000010100001001000011

MB0C

ABC

101102103

MO0C

ABC

414243

MX0C

ABC




Output conversion:

Source data

Conversion

Result

19

MB

10011

19

MO

23

19

MX

13

ABC

MB0C

010000010100001001000011

ABC

MO0C

101102103

ABC

MX0C

414243