FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups 
 ProfileProfile   PreferencesPreferences   Log in to check your private messagesLog in to check your private messages   Log inLog in 
Forum index » Science and Technology » Math » Recreational
Please help - convert to negative base
Post new topic   Reply to topic Page 1 of 1 [4 Posts] View previous topic :: View next topic
Author Message
remlaps
science forum beginner


Joined: 13 Jul 2006
Posts: 2

PostPosted: Thu Jul 13, 2006 9:20 pm    Post subject: Please help - convert to negative base Reply with 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.

Thanks in advance,
Steve

PS- Not homework. Just for fun. Smile
Back to top
Proginoskes
science forum Guru


Joined: 29 Apr 2005
Posts: 2593

PostPosted: Thu Jul 13, 2006 11:27 pm    Post subject: Re: Please help - convert to negative base Reply with quote

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
http://mathworld.wolfram.com/Negadecimal.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
Back to top
remlaps
science forum beginner


Joined: 13 Jul 2006
Posts: 2

PostPosted: Fri Jul 14, 2006 12:28 am    Post subject: Re: Please help - convert to negative base Reply with quote

Quote:

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

--- Christopher Heckman

Perfect. Thank you!

Steve
Back to top
jasen
science forum beginner


Joined: 28 Jun 2006
Posts: 16

PostPosted: Fri Jul 14, 2006 12:03 pm    Post subject: Re: Please help - convert to negative base Reply with quote

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

answer is 11202


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





Bye.
Jasen
Back to top
Google

Back to top
Display posts from previous:   
Post new topic   Reply to topic Page 1 of 1 [4 Posts] View previous topic :: View next topic
The time now is Tue Aug 22, 2017 4:42 pm | All times are GMT
Forum index » Science and Technology » Math » Recreational
Jump to:  

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

Copyright © 2004-2005 DeniX Solutions SRL
Other DeniX Solutions sites: Electronics forum |  Medicine forum |  Unix/Linux blog |  Unix/Linux documentation |  Unix/Linux forums  |  send newsletters
 


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0304s ][ Queries: 16 (0.0054s) ][ GZIP on - Debug on ]