- Published on
- Fri Jan 24, 2014
EPI 5.7 - Generalized conversion between bases
Problem ¶
Continuing on from EPI 5.6, this problem is to convert an integer encoded as S1 in base b1, to S2 in base b2:
Solution ¶
The easiest way is to use the techniques in EPI 5.6 and simply do:
1base1ToBase2 b1 s1 b2 = intToString b2 (stringToInt b1 s1)
Anybody looking for a version without the intermediate conversion to base 10?