/pre>

<p>If the number is encoded first into something like a float, it makes
unpacking <a href='https://compilade.net/blog/ternary-packing'
target='_blank'>possible without division</a>:</p>
<pre>
uint8_t q = (((uint16_t) i) * 256 + (243 - 1)) / 243;
for (int j = 0; j < 5; ++j) {
	uint16_t m = q * 3;
	s2[j] = (m >> 8) + '0';
	q = m & 0xFF;
}
</pre>

<q>Perhaps the prettiest number system of all is the balanced ternary notation.</q>
<cite>Donald E. Knuth, The Art of Computer Programming</cite>

<img src='.