Binary and Hex Conversion in Julia
✓ Published0🌍 Public
CCliffordAnderson
Last edited Mar 1, 2017
Created on Feb 26, 2017
This example defines two recursive Julia functions, `tobin` and `tohex`, that manually convert a decimal integer into its binary and hexadecimal string representations. The code demonstrates pattern matching with the `Match` package: `tobin` handles base 2, while `tohex` maps digits 0–9 and letters A–F for base 16, using the `div` and `mod` functions to decompose the input. The functions are intended to be compared against Julia’s built-in `bits()` and `hex()` utilities, though no visualization or data source is included.
AI-generated description