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

9's complement of a 4-bit binary number

I don't understand how to calculate the 9's complement of a binary number. I can apply it to decimal ones, example 15 = (9-1)(9-5) ) 84 then I thought to proceed with a binary -> decimal -> 9's complement -> binary conversion but I guess it's not…
user3595871
  • 1
  • 1
  • 1
  • 3
0
votes
1 answer

I am trying to reverse complement a fasta DNA sequence

I have been trying to reverse complement a fasta DNA sequence. Here is my code: fastafile=open('sequence (3).fasta','r') entries=[] reverse="" sequence=['A','T','G','C','N'] for line in fastafile: if not line.startswith('>'): line =…
B_bunny
  • 35
  • 1
  • 6
0
votes
1 answer

How to get relative complement of one data.frame in another?

I have two data.frame objects that need to get its relative complement set from one to another. I checked similar post from this site, certainly someone asked already, but it was about vector, and it is okay. However, I tried solution from existing…
user6070577
0
votes
1 answer

1's complement operator in C

In the program below, why is ~a printed in the output as 10? Why not -11? #include int main() { int a=10; ~a; printf("complement : %d\n",a); }
user6359267
0
votes
0 answers

String to HEX conversion

Given the following: string var1 = "0206" string var2 = "020C" string result = "FFFA" I need to take the twos complement of the hex representation of var2 [((FFFF-VAR2)+1)] And add it to the hex representation of var1. The result will be a string…
user6262035
0
votes
1 answer

Binary into 2's compliment

if I convert the binary number 000000 into 2's compliment I will get 1's compliment (invert) = 111111 2's compliment (add +1) = here I run into a problem, does this return 000000 and the 1 gets discarded or does this return 1000000? Thanks in…
snjall
  • 23
  • 5
0
votes
2 answers

Why is -9 base 10 equal to a7ffda89 in base 17?

Using Microsoft's implementation of itoa, how do you get "a7ffda89" as the base 17 representation of -9 in base 10? What I am looking for is a description of the algorithm. Here is the code I used to find out what itoa would return using Microsoft's…
Matthew Hoggan
  • 7,402
  • 16
  • 75
  • 140
0
votes
2 answers

C++ program Booths Algorithm 2s Complement using array

I have included the program in which I am having a logical problem. The program is based on booth's algorithm and I have put a snippet of it. In this 'working' snippet decimal number is accepted from the user converted to decimal form with the help…
user5444075
  • 57
  • 1
  • 3
  • 10
0
votes
0 answers

Negative numbers in binary (8-bit)

I'm supposed to convert the following negative numbers to 8-bit binary using both (i) ones complement, and (ii) twos complement: -76 -203 -18 -177 I know how to do -76 and -18... • -76 In binary (positive): 01001100 i) 10110011 ii) 10110100 • …
lrogar
  • 59
  • 1
  • 8
0
votes
1 answer

Find the complement using base 9

I have this simple problem which for some reason I have trouble with I'll be glad to get help. I have these two numbers in base 10 : 5250, 321. I change the basis from 10 to 9 then I get : 5250 --> 7173 321 ---> 386 I use the method of r complement…
JaVaPG
  • 169
  • 1
  • 4
  • 9
0
votes
1 answer

One s complement and two´s complement logic behind

for my computer science class I need to finish a project where I desperately need to understand logic of one´s complement and two´s complement. I already know how to construct these and also how hardware adder works when dealing with two´s…
fifco
  • 11
  • 6
0
votes
2 answers

How to do complement for one bit in verilog

I want to ask about switching one bit for example x[3] in bit vector x[0:3] to one if it's zero or to zero if it's one in verilog.So if x=0101 it will become x=0100 .I have tried concatination with not but it's error in verilog .Can you help me to…
Sereena
  • 37
  • 3
  • 8
0
votes
2 answers

10's complement of a number statement

The values of a,x,y if 47x80 is the 10's complement of yaya0 is: I calculated the 10's complement of yaya0 to be 100,000-yaya0 and then. 47x80=100,000-yaya0 Now how to find values ?
0
votes
3 answers

complement of regular expression how to find

Give a regular expression for the language L over the alphabet {0,1} whose complement is represented by the regular expression 0* i think that the answer is 1^+ but i cannot prove it please help
user2957741
  • 993
  • 2
  • 11
  • 11
0
votes
2 answers

How to get an array "complement" of another?

the easiest way for me to explain what i want is with an example: a = 1:20 b = [2,7,12,18] Now I want c to be [1,3,4,5,6,8,...,19,20] with length 16: length(a) - length(b) of course. Is there a way for me to get c?
Antonio Craveiro
  • 121
  • 1
  • 11