Numeric representation Flashcards

(6 cards)

1
Q

BCD format

A

Binary-coded decimal format for real numbers.

Split byte to nibble - each nibble is a decimal number, used for e.g. in calculator in order to provide the same results as for paper calculations.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Radix

A

Base number of digit, for decimal the radix equal 10

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Scale format

A

The idea is in representing real numbers by scaling them into integers, for e.g to represent the fractional part of 1.3, the whole number can be scaled to 130.

Limitation: MAX_INT

For + - operations you need to have the same scale operator before the operation.

For / * operations you need to have additional result adjustments.

for divide => result * 100
for multiply => result / 100

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Rational representation

A

The rational representation uses pairs of integers to represent fractional
values. One integer represents the numerator (n) of a fraction, and the
other represents the denominator (d). The actual value is equal to n/d.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Hexidecimal representation

A
Because reading and writing
binary values is awkward, programmers often avoid binary representation in
program source files, preferring hexadecimal notation
%0000  $0
%0001  $1
%0010  $2
%0011  $3
%0100  $4
%0101  $5
%0110  $6
%0111  $7
%1000  $8
%1001  $9
%1010  $A
%1011  $B
%1100  $C
%1101  $D
%1110  $E
%1111  $F
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Binary representation

A

Despite computer languages being able to convert decimal notation, most
modern computer systems talk to I/O devices using binary, and their arith-
metic circuitry operates on binary data.

If the number is even, emit a zero. If the number is odd, emit a one.
2.Divide the number by two and throw away any fractional component or
remainder.
If the quotient is zero, the algorithm is complete.
If the quotient is not zero and the number is odd, insert a one before the
current string. If the quotient is not zero and the number is even, prefix
your binary string with zero.
Go back to step 2 and repeat.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly