inicio mail me! sindicaci;ón

Number Systems & Bases

A while back, i writ a program in which one could convert any number from any base to and from base 10. So for example, if i had the number “10” in base 3, it would churn out “3” in base 10, and vice versa.

Initially all i got it converting was base 62. However i was not just satisfied with base 62, i wanted it to convert any possible base, defined by any set of symbols. To top it all off, i also made it possible to use unicode symbols via UTF-8.

So for example if i could conjure up the following hideous system:

Symbol A B C
Value 0 1 2

…and start saying thing’s like “C + C = AB”.

For the final touch, i added the ability to specify numbers with numerals. Although i didn’t quite get the conversion algorithm from base10 to numerals right.

Safe to say, i ended up with this rather hideous looking app programmed in C. But on the plus side i could:

  • Feed in a file containing a sequential list of UTF-8 formatted symbols to make my own number base system.
  • Feed in a file containing a list of “SYMBOL=VALUE” pair’s ordered by value to make my own numeral system.
  • Convert the output of either the previous examples back to base10.

In any case, one can grab the code here. It’s not pretty, nor is it quite the next killer app – but i had some fun writing it.

 

Trackbacks

(Trackback URL)

close Reblog this comment
blog comments powered by Disqus