Hexadecimal To Gray Code
How This Converter Works
Converts an unsigned hexadecimal integer to reflected binary Gray code; spaces and underscores are ignored and redundant leading zero bits are omitted.
Formula or rule
Expand each hex digit to four bits, strip leading zeroes (or retain 0), then form Gray bits as the leading binary bit followed by adjacent-bit XORs.
Example
- Input
- 2D
- Calculation
- 2Dāā=101101ā; leading bit and adjacent XORs give 1,1,1,0,1,1.
- Result
- 111011