Click to See Complete Forum and Search --> : Writing a Number System


Mikenell
02-12-2001, 01:01 PM
Is it possible/probable to write a new number system like hexadecimal, decimal or binary in C?
Thanks
Mikenell

YaRness
02-12-2001, 01:32 PM
would you like to clarify or restate that question?

Mikenell
02-12-2001, 03:04 PM
Ok, you know in C theres the four number systems binary, hexidecimal, decimal and oxydecimal (Or something like that). Well where did they come from? Who came up with them? Would it be possible to design a new number system that has different values for the ascii 255 extended characters? This idea may be totally absurd as I dont really know much about number systems other than what I read in Sam's Advanced C Book but I was just wondering.
Thanks
Mikenell

Strike
02-12-2001, 03:22 PM
Sure you could, but why would you? It's just a matter of understanding numeric systems. I mean, there's a general template for each of them (in terms of decimal). Starting from the right you take (base number)^0, multiply it by the digit value, and then add the value of the stuff that is left, increasing the exponent by one for each digit. It could easily be implemented as a recursive call.

But, I still don't see why you'd want/need to do this.

PS - it's octal not oxydecimal

Mikenell
02-12-2001, 03:45 PM
Ok thanks. I just wondered really...

Sterling
02-12-2001, 05:57 PM
Well, sometimes it can be useful to do stuff like this for binary math. But in terms of most computer stuff, you can do almost everything you need to in one of those four bases. All of which eventually get represented as binary.