Questions tagged [complement]

This tag is deprecated! Use more specific tags instead: For the binary representations of negative values in computer science, use tags [ones-complement] and [twos-complement]; For the bitwise complement operation, use [bitwise], or [regex-negation] for the use of complement patterns in regular expressions, or [bit-manipulation] for complementing said data.

This tag is deprecated! Please consider use of the following tags instead:

112 questions
0
votes
1 answer

ADXL345 Accelerometer integer overflow with Arduino Due

I am working on a self-balancing robot project and am using the ADXL345 accelerometer alongside the ITG-3200 gyro to sense the tilt of the robot. I was having problems earlier with signed integers not displaying correctly, as it turns out, the…
user3185748
  • 2,478
  • 8
  • 27
  • 43
0
votes
1 answer

size of memory of computer that uses 16 bits memory address

If the memory address of a computer uses 16 bits, what is the size of its memory? I find many references online but I can't be certain which are relevant. Thank you. 2^16?
Jack Smother
  • 207
  • 1
  • 8
  • 32
0
votes
1 answer

What is wrong with my Ones Complement?

i want to do the following subtraction using ones complement Octal(24)-Hex(4B) and give a binary answer Octal(24) is 20 decimal and Hex(4B) is 75 in decimal 20->10100 75->1001011 taking 1s complement of 75 0110100 and adding to…
0
votes
1 answer

C++: compute a number's complement and its number of possible mismatches

I got a bit stuck with my algorithm and I need some help to solve my problem. I think an example would explain better my problem. Assuming: d = 4 (maximum number of allowed bits in a number, 2^4-1=15). m_max = 1 (maximum number of allowed bits…
Eagle
  • 3,362
  • 5
  • 34
  • 46
0
votes
1 answer

1s and 2s complement of a negative number

All answers I seem to find on how to find the 1s (flip the bits of the positive) and the 2s (flip the bits of the positive binary and add 1) complement doesn't seem to answer my question. My homework assignment asks to find the complement of a…
0
votes
2 answers

Print BinaryString without padding

Suppose I have defined a long variable like this : long lng = 2543697L; and print it out : System.out.println (" first long "+Long.toBinaryString(lng)); the output is this : 1001101101000001010001 but when I complement the bits using ~ a…
0decimal0
  • 3,884
  • 2
  • 24
  • 39
0
votes
3 answers

What is the Decimal value for the 8-bit 2's complement number 11010110?

This more of a hw question but I cannot figure this one out. I thought it would be 214 but because of the first bit on the left, I am not so sure.
kevintdiy
  • 181
  • 2
  • 5
  • 13
0
votes
2 answers

Mysql complement with many tables and grouping

I hope the answer is simple and I'm silly. So I've two tables: day (with PK id_day) and hour (with PK id_hour). I've an another table tilt_time which has id_day, id_hour fields and a plus FK field (which has prohibited times). E.g. tilt_time has the…
uzsolt
  • 5,832
  • 2
  • 20
  • 32
0
votes
3 answers

How to get complementary lines from two text files?

How to get complementary lines from two text files? File file1.txt has 123 foo 234 bar ... File file2.txt has 123 foo 333 foobar 234 bar ... I want to get all lines in file1.txt and not in file2.txt. The two files are hundreds of MB large and…
qazwsx
  • 25,536
  • 30
  • 72
  • 106
-1
votes
1 answer

How can I make a reverse complement method with recursion work?

I am trying to create a "dragon curve" that uses left and right turns to create a shape on the drawing panel. The directions are generated recursively, where for a certain number of iterations or "levels" the direction adds on the previous string of…
-1
votes
1 answer

Converting either a Decimal or Binary value to Binary signed 2's complement in Python

I am having trouble in achieving either of the following in Python: Convert a Decimal value to Binary signed 2's complement. Examples: 40975 = 00000000000000001010000000001111 275 = 0000000100010011 Convert a Binary value to Binary signed 2's…
-1
votes
1 answer

How do I convert a number from sign and magnitude to twos complement?

Got this class for college which ill never need again, how can I convert a number from (ex 1100) to twos complement and reversed? Any online calculator that can do this? I understand what twos complement is and what sign and magnitude is, just dont…
Bnomik
  • 1
-1
votes
1 answer

Complement function

My data: a <- c('KK','LL','II','JJ','AA','CC','GG','FF','EE','QQ','ZZ','XX') b <- c('CC','GG','FF','EE','KK','LL','II','JJ','QQ','ZZ','XX','BB','AA','OO','WW') target: list all of the things that which 「 "b"have but "a" don't have 」 I try…
fish
  • 23
  • 1
  • 1
  • 6
-1
votes
2 answers

Getting complement of a character

How can't the codes below work, in order to get the complement of the character entered? It seems like the loop never end, but let say, if I enter 'Z' as dna, why wouldn't it break and quit? Did I use the break or if wrongly? How about elif? def…
MingJian
  • 29
  • 2
  • 3
-1
votes
2 answers

Complementing bits in a register in Assembly Language

How does one complement an individual bit or bits in a register?
frodosamoa
  • 973
  • 2
  • 11
  • 13