steve_bank
Diabetic retinopathy and poor eyesight. Typos ...
All math operations on a digital computer reduce to binary operation.
The number 123.456 has an integer and fractional part. The integr part is easy to see in binary. A simple binary count.
Decimal numbers a re represented by muliples of the least sugnificant digit or lsb.
For any number of bits the only time the binary imnage of a decimal number is exact is when the decimal number is multiples of the lsb. The more bits the better the approximation.
Customarily binmary numbers are shown from the msb on the left to the lsb on the right.
8 bits [7 6 5 4 3 2 1 0]
n = number of bits
B0 is the lasb
The rresoluion or lsb value is 1/(2^n)
for 8 bits the lasb = 1/2^8 = .0039062
The fractional value is
lsb*2^7 + lsb*2^6 + lsb*2^5+ lsb*2^4+ lsb*2^3+ lsb*2^2 + lsb*2^1 + lsb*2^0
The sum of the weighted bits will be 1 – lsb. Adding an lsb rolls over to an integr of 1.
This is essential digitizing the number 1. Languages have built in decimal to binary and binary to decimal functions.
Scilab does not have bit operations like has so it is a round about solution.
The number 123.456 has an integer and fractional part. The integr part is easy to see in binary. A simple binary count.
Decimal numbers a re represented by muliples of the least sugnificant digit or lsb.
For any number of bits the only time the binary imnage of a decimal number is exact is when the decimal number is multiples of the lsb. The more bits the better the approximation.
Customarily binmary numbers are shown from the msb on the left to the lsb on the right.
8 bits [7 6 5 4 3 2 1 0]
n = number of bits
B0 is the lasb
The rresoluion or lsb value is 1/(2^n)
for 8 bits the lasb = 1/2^8 = .0039062
The fractional value is
lsb*2^7 + lsb*2^6 + lsb*2^5+ lsb*2^4+ lsb*2^3+ lsb*2^2 + lsb*2^1 + lsb*2^0
The sum of the weighted bits will be 1 – lsb. Adding an lsb rolls over to an integr of 1.
This is essential digitizing the number 1. Languages have built in decimal to binary and binary to decimal functions.
Scilab does not have bit operations like has so it is a round about solution.