Show 80 post(s) from this thread on one page
Page 4 of 4 First 1234
• 12-19-2004
Thantos
Unless of course you wanted to write the number out in base 5 :)
• 12-19-2004
Prelude
I must have missed something. Was that a requirement, or do you just work with base 5 a lot? ;)
• 12-19-2004
Thantos
Yeah its for when I work with pennies, nickles, and quarters. One of my professors just loves base conversions. I had to do it in pascal and in assembly. The "Read in a base 9 number and output it as a base 7 number." Fun stuff
• 12-19-2004
CornedBee
Oh, I had to do that in Haskell. Any base between 2 and 36, and then base -2 for good measure. (Now THAT's a weird number system.)
• 12-19-2004
Thantos
How do you have a negative base? The base is suppose to represent the number of different symbols that are used.

In pascal I once did a base (26*2 + 10) 62 system :)
• 12-19-2004
CornedBee
No, in the definition my professor used, a number system is done like so:
number = SUM[i = 0 to digit-count](base^i * digit-value)

So base can be any integer except -1, 0 and 1, as long as you have enough digit signs.

In base -2, with four digits you get these numbers:
0000 = 0
0001 = 1
0010 = -2
0011 = -1
0100 = 4
0101 = 5
0110 = 2
0111 = 3
1000 = -8
1001 = -7
1010 = -10
1011 = -9
1100 = -4
1101 = -3
1110 = -6
1111 = -5
etc. etc.
• 12-19-2004
Thantos
I think your professor had to dig deep in his arse to find that defination :)
• 12-19-2004
CornedBee
Well...

The "negabinary" system is listed at Wikipedia as a "positional-like system with non-standard base". The German Wikipedia states in a paragraph that as a generalization of numbering systems, the base need not be a natural number as longas the absolute value of the base is greater than 1.
http://en.wikipedia.org/wiki/Negabinary

• 12-19-2004
Thantos
Hmm interesting. Though something doesn't seem right
Quote:

unusual property that negative and positive numbers can be represented without a sign bit
but it still takes 1 extra bit.
• 12-19-2004
Salem
This has gone way too off-topic.

Sportsmaniac, if you're still stuck, start a new thread with your latest code and question(s).
Show 80 post(s) from this thread on one page
Page 4 of 4 First 1234