Search   Memberlist   Usergroups
 Page 1 of 1 [4 Posts]
Author Message
jasen
science forum beginner

Joined: 28 Jun 2006
Posts: 16

Posted: Fri Jul 14, 2006 12:03 pm    Post subject: Re: Please help - convert to negative base

On 2006-07-13, remlaps <remlaps@gmail.com> wrote:
 Quote: Can anyone please provide me with a link to an online description of an algorithm for converting a numeric representation from a positive radix to a negative one? I don't have convenient access to a copy of "The Art of Computer Programming", so suggestions other than "try Knuth" would be greatly appreciated.

use the normal base conversion algortithm (repeated division recording the
remainders)

to cobvert 74 to base -3

74/-3 = -24 r 2

-24/-3 = 8 r 0

8/-3 = -2 r 2

-2/-3 = 1 r 1

1/-3 = 0 r 1

1 * 81 + 1 * -27 + 2 * 9 + 0 * -3 + 2 * 1

Bye.
Jasen
remlaps
science forum beginner

Joined: 13 Jul 2006
Posts: 2

Posted: Fri Jul 14, 2006 12:28 am    Post subject: Re: Please help - convert to negative base

 Quote: http://en.wikipedia.org/wiki/Negabinary --- Christopher Heckman

Perfect. Thank you!

Steve
Proginoskes
science forum Guru

Joined: 29 Apr 2005
Posts: 2593

Posted: Thu Jul 13, 2006 11:27 pm    Post subject: Re: Please help - convert to negative base

remlaps wrote:
 Quote: Can anyone please provide me with a link to an online description of an algorithm for converting a numeric representation from a positive radix to a negative one? I don't have convenient access to a copy of "The Art of Computer Programming", so suggestions other than "try Knuth" would be greatly appreciated.

Try MathWorld.

http://mathworld.wolfram.com/Negabinary.html

Or Wikipedia (which works an example in negabinary).

http://en.wikipedia.org/wiki/Negabinary

Or HAKMEM (lots of useful math stuff, at
http://www.inwap.com/pdp10/hbaker/hakmem/hakmem.html ):

http://www.inwap.com/pdp10/hbaker/hakmem/flows.html#item128

--- Christopher Heckman
remlaps
science forum beginner

Joined: 13 Jul 2006
Posts: 2

 Posted: Thu Jul 13, 2006 9:20 pm    Post subject: Please help - convert to negative base Can anyone please provide me with a link to an online description of an algorithm for converting a numeric representation from a positive radix to a negative one? I don't have convenient access to a copy of "The Art of Computer Programming", so suggestions other than "try Knuth" would be greatly appreciated. Thanks in advance, Steve PS- Not homework. Just for fun.

 Display posts from previous: All Posts1 Day7 Days2 Weeks1 Month3 Months6 Months1 Year Oldest FirstNewest First
 Page 1 of 1 [4 Posts]
 The time now is Sun Nov 18, 2018 4:06 pm | All times are GMT
 Jump to: Select a forum-------------------Forum index|___Science and Technology    |___Math    |   |___Research    |   |___num-analysis    |   |___Symbolic    |   |___Combinatorics    |   |___Probability    |   |   |___Prediction    |   |       |   |___Undergraduate    |   |___Recreational    |       |___Physics    |   |___Research    |   |___New Theories    |   |___Acoustics    |   |___Electromagnetics    |   |___Strings    |   |___Particle    |   |___Fusion    |   |___Relativity    |       |___Chem    |   |___Analytical    |   |___Electrochem    |   |   |___Battery    |   |       |   |___Coatings    |       |___Engineering        |___Control        |___Mechanics        |___Chemical

 Topic Author Forum Replies Last Post Similar Topics Base Conversion - Negative Base Tapas Bose num-analysis 0 Tue Aug 03, 2010 8:47 pm Power Method and negative eigenvalues Skunk num-analysis 7 Wed Jul 19, 2006 10:19 pm Change of base bertieboo num-analysis 5 Wed Jul 12, 2006 11:50 pm Percentages from/to negative integers WhytheQ Math 3 Fri Jul 07, 2006 8:55 am Is there a Universal Law of Conservation of Acid and Base... a_plutonium@hotmail.com Chem 19 Mon Jul 03, 2006 10:38 am