Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Author
Message
tubeular cube face
19
Years of Service
User Offline
Joined: 14th Jul 2005
Location:
Posted: 21st Mar 2006 20:30
The DB pro book tells you how to put things into binary and octal etc. is there any way to put stuff in in other bases particularly base 5.

Tubeularcubeface
x1bwork
19
Years of Service
User Offline
Joined: 9th Nov 2005
Location:
Posted: 21st Mar 2006 20:39 Edited at: 21st Mar 2006 21:03
are you after an Octal with base 5 as opposed to base 8? and why ?

Tinkergirl
21
Years of Service
User Offline
Joined: 1st Jul 2003
Location: United Kingdom
Posted: 21st Mar 2006 20:48 Edited at: 21st Mar 2006 20:49
Base 5?? Now that is a very peculiar base to be working in. Binary, octal and hex I can understand. I even have a liking for base 12 and balanced ternary - but base 5? Never seen it used in anything.

Anyway, to your question. If you have a number in base 10 (say, 14) and you want it in base 5, then you need to work out how many multiples of 5 it has in it.

14/5 = 2 (integer, ignoring fractions). There is a remainder of 4.

As 2 is less than 5, you don't need to divide it any more.

Thinking in terms of columns then, the righthand column is your remainders (in this case 4) and your factor is your 5's column (in this case 2).

So 14(b10) in b5 = 24. That's 2 in the 5's column (2*5 = 10) and 4 in the units (4*1 = 4).

If it were a bigger number, like 114, then you'd have to divide your factor again, to work out the other columns.

114/5 = 22 r4. 22/5 = 4 r2.

114 in base 5 = 424 (4 in the 25's column, 2 in the 5's, and 4 in the units).

There may well be easier ways of working it out (the example above would need to be a recursive function (a function that calls itself)) but I don't know of one, and I've never needed it
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 23rd Mar 2006 05:20 Edited at: 23rd Mar 2006 05:26
Quote: "are you after an Octal with base 5 as opposed to base 8"

if its a base 5 then its not Octal, it'd be... hectal?

Isn't base conversion just basically like this?


This won't display binary like you'd usually see, but technically it will convert it base 10 to any base below 10



Tinkergirl
21
Years of Service
User Offline
Joined: 1st Jul 2003
Location: United Kingdom
Posted: 24th Mar 2006 17:36
Um, I'm not sure that'd work, Phaelax. If you did the 12 in base 3, you'd get (from your function) - 40. Now 40 is not a 'legal' number in base 3 - because base 3 only goes up to 2.

Real 12 in base 3 would be 110, not 40.
x1bwork
19
Years of Service
User Offline
Joined: 9th Nov 2005
Location:
Posted: 24th Mar 2006 18:38 Edited at: 24th Mar 2006 18:52
Phaelex: Indeed you're right,base 5 does not work as Octal, though I was not suggesting it would. I was and still am curious as to why and what he wants to use a Base 5 for. He made a mention of Binary and Octal then inquired about using Base 5, thus my question, not suggestion of
Quote: "are you after an Octal with base 5 as opposed to base 8? and why ?
"


Though admitedly, my first reply was a laugh then I got thinking, *maybe* he was on to something.

Now,listening to Tinker,go off? Is interesting.

Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 25th Mar 2006 06:22
eh, i know how to do binary and hex, thats all im really concerned about understanding.


Login to post a reply

Server time is: 2024-11-27 01:41:17
Your offset time is: 2024-11-27 01:41:17