Skip to main content
2 votes

How do you tell whether a binary number is positive or negative?

how do we know that they t2 = 0xfffffff5= -11 and not $t2 = 4294967285? We don't. They're the same number (in mod 232 arithmetic, which is what your computer uses.) Essentially, signed or unsigned is ...
Rainer P.'s user avatar
  • 852
2 votes

Are float pseudo-random number generators always implemented using integer generators underneath

I am not aware of any direct-to-float PRNGs. The primary issue is that it is very difficult to get high quality random numbers using floating point operations. PRNGs typically leverage well ...
Cort Ammon's user avatar
  • 3,351
1 vote

Calculate the CPI of a program

Begin by drawing a table of the instructions executed: # INSN OP1 OP2 OP3 COMMENT 1 addi t0 zero 1 t0 = 1 2 addi v0 zero 0 v0 = 0 3 beq t0 zero exitout t0 != 0 (hit) 4 sll t0 t0 0 (bds) 5 addi ...
Gaslight Deceive Subvert's user avatar
1 vote

Are my ideas good enough to be hired by programming design groups?

What if the user of this malloc is making a node-based datastructure and expects each node to survive multiple calls to its addNode()? I assume that is what the <...
ratchet freak's user avatar
1 vote

Are float pseudo-random number generators always implemented using integer generators underneath

My very very first computer that came with BASIC built-in, had a random number generator that replaced the previous value x with the fractional part of (x + pi)^5. It wasn’t very random. It had the ...
gnasher729's user avatar
  • 30.5k
1 vote

Are float pseudo-random number generators always implemented using integer generators underneath

As other answers have pointed out, most PRNGs using floating-point computation and floating-point storage for the PRNG state simply use the floating-point unit to perform integer arithmetic, using the ...
njuffa's user avatar
  • 520
1 vote

Are float pseudo-random number generators always implemented using integer generators underneath

Yes. When IBM created its POWER processors which may have been the first ones with a fused multiply-add operation, they managed to implement the linear-congruential method using floating point, ...
gnasher729's user avatar
  • 30.5k
1 vote

What is the reason or advantage of having special purpose status flags for the result of comparisons?

You have two choices. Either you have separate compare instructions for ==, !=, <, <= etc. which all create 0 or 1, or you have one compare instruction creating flags and various branch ...
gnasher729's user avatar
  • 30.5k
1 vote

What is the purpose of padding bits in primitive integer types?

IIRC, Crays had a 23 bits integer type. This was really just their 32 bits floating point type with the exponent set to zero/ignored. If this idea sounds outdated, AVX-512 recently introduced a 52 ...
MSalters's user avatar
  • 895

Only top scored, non community-wiki answers of a minimum length are eligible