Re: [Tutor] Negative Signed Binary Conversion

2007-10-22 Thread Alan Gauld
<[EMAIL PROTECTED]> wrote > I'm trying to get this binary converter working, but I can't seem to > get the > negatives to work properly. I already sent a reply on this, but: > def conversion(n): >b = '' >while n > 0: This line means you only ever return an empty string for a negative

Re: [Tutor] Negative Signed Binary Conversion

2007-10-22 Thread Eric Brunson
No worries. I said it could be mailman, and apparently it was. :-) [EMAIL PROTECTED] wrote: > Hi, > I also got this email five times, and several rejection emails from the > moderator. I'm very sorry for this, but I swear I only sent the email once. > If this Apology email is also sent multiple

Re: [Tutor] Negative Signed Binary Conversion

2007-10-22 Thread Eric Brunson
So far I've gotten five copies of this. It could be mailman doing something wrong, but if you're resending because you don't see your reply, please be patient, this list is not always instantaneous. I think you're missing the gist of what I'm saying. Calculate the binary of the absolute. I'

Re: [Tutor] Negative Signed Binary Conversion

2007-10-22 Thread Eric Brunson
Why not find the sign, calculate the binary of the absolute value, then make the result negative (twos complement) if necessary? Just a thought. [EMAIL PROTECTED] wrote: > Hi, > I'm trying to get this binary converter working, but I can't seem to get the > negatives to work properly. If the int

[Tutor] Negative Signed Binary Conversion

2007-10-22 Thread ddm2
Hi, I'm trying to get this binary converter working, but I can't seem to get the negatives to work properly. If the integer is too low, the 0's that are added for the amount of bits gets out of whack. I've tried to solve the problem by adding another 'count' meter by which I can then tell if there