Questions tagged [bit-representation]

43 questions
0
votes
3 answers

Accessing a character from int variable using pointer in C

Why the output of below code is -127. Why shouldn't it be -1? #include int main(){ int a = 129; char *ptr; ptr = (char *)&a; printf("%d ",*ptr); return 0; }
MCG
  • 1,011
  • 1
  • 10
  • 21
0
votes
1 answer

Is git archive output supposed to be bit-repeatable through git versions?

I am using git archive to generate a file which is later hashed to be checked for integrity against a pre-stored hash. However I have not seen anywhere that git archive is intended for bit repeatability, so I fear that any future changes in git…
Álex
  • 1,587
  • 11
  • 17
0
votes
1 answer

Representation of double numbers

In an 8 bit representation, we know that the number 4 is stored as 00000100, and the number -4 is stored as 11111100. But how the number 4.6 is stored in a double?
Casio991ms
  • 37
  • 8
0
votes
4 answers

ASCII table and character presentation

We learn in class about ASCII table, and that every character from 128 characters has a unique number from 0-128 representing it. For example "a" is 97 (in binary 97 is 1100001). "%" is 37 (and in binary 37 is 0100101). (I understand that for a…
0
votes
1 answer

How is this sum equal in unsigned binary and twos complement binary?

I'm reading through a computer architecture book and came across the following: Assume you have a 8-bit cell. So there are 256 possible integer values. Non-negatives run from 0 to 127. Assuming two's complement binary representation, what is the sum…
user8371266
0
votes
0 answers

How to translate I-type instruction to its 32-bit representation?

Given the following instruction: addi $s0, $0, −10 I need to compute it's 32-bit representation. Since addi is I-type instruction the opcode for addi is 001000. Rs is $0, which is 00000 Rt os $s0, which is 10000 how do i compute the remaining 16…
Utsab
  • 159
  • 2
  • 4
  • 12
0
votes
1 answer

Bit representation using excess-3 and mantissa

If a float number is stored in one byte such that the first bit is the sign, the next three bits represent the exponent in excess-3 notation and the last four bits represent the mantissa, then the bit pattern 00100100 represents? I understand that…
0
votes
0 answers

Is there a way to represent a number in binary where bits have approximately uniform significance?

I'm wondering if it is possible to represent a number as a sequence of bits, each having approximately the same significance, such that if we flip one of the bits, the overall value does not change by much. For example, we can use sequences of…
jdferreira
  • 651
  • 1
  • 6
  • 16
-1
votes
2 answers

Long Representation vs Double representation of positive and negative zero in java

I was wondering about the differences between positive and negative zero in different numeric types. I understand the IEEE-754 for floating point arithmetic and bit representation in double precision so the following didn't come as a…
Mr T.
  • 4,278
  • 9
  • 44
  • 61
-1
votes
1 answer

Why is the length of a 32 byte hash 267 bits in binary and not 256 bits?

Given you hash some string to produce a 256bit output, why is the binary representation not of length 256 package main import ( "fmt" "crypto/sha256" ) func main() { s := "1" m := sha256.Sum256([]byte(s)) fmt.Println(len(m)) …
base 10
  • 49
  • 7
-1
votes
1 answer

Fixed point representation vs. floating point representation on [0,1]

What are the differences/similarities between the fixed point (bit-level) representation of a value in [0,1] compared to its floating point (bit-level) value?
Mike
  • 39
  • 5
-1
votes
1 answer

Bitwise Programming in Python

I'm trying to write a program to solve an ACM problem, and it has to be very fast. A mathematically fast approach to the problem is to use bitwise computations. However, I'm using python and I'm having trouble performing these computations at bit…
-2
votes
1 answer

What is the representation of values in the LD instruction in the 8-bit Z80 processor?

I am having difficulties with understanding what's going on in this code: LD A, -1; LD B, 130; ADD A, B; And what flags are set to 1 after the ADD instruction. Basically, I don't know, what value is stored inside the register B. I cannot find any…
Mateusz Piotrowski
  • 8,029
  • 10
  • 53
  • 79
1 2
3