0
\$\begingroup\$

I am learning computer architecture and organization. I am stuck in the following question. Can someone please help me?

For a floating-point representation with 35 bits in the mantissa and 15 bits in the exponent, the number of significant digits in decimal and the minimum (negative) value of the exponent in decimal will be:

I know that the number of significant digits in decimal will be 10, but I don't understand how to solve the second part of the question.

This is what I tried:

As there are 15 bits in the exponent, the total numbers that can be represented = 2^15 = 32768

Since exponent may be positive, negative and zero, so this means that the range of exponent is from -16384 to +16383. So minimum value of exponent in decimal is:
2^(-16384) = 10^y
-16384 * log(2) = y * log(10)
y = -4932.075 -- minimum exponent value = -4932 ( in decimal ).
So the minimum value of the exponent will be -4932 (in decimal) but it is wrong. I don't understand why? The correct answer is -9864.
The number is stored in IEE-754 format. Credits: NPTEL This is the formula which perhaps I am supposed to use but I don't understand how we get the correct answer. I can get the correct answer if I use this process: 2^15 = 32768
So,
2^(-32768) = 10^y
Thus, y = -9864.1
So minimum exponent value in decimal is -9864.
But according to me we should use 2^14 = 16384
The reason why I am using 14 bits is because, suppose if we have 8 bits so we can represent 256 numbers from -128 to +127. -128 is 2^(8-1). So,
2^(-16384) = 10^y
Thus, y = -4932.0.
So minimum exponent value in decimal is -4932.

\$\endgroup\$
1
  • \$\begingroup\$ Comments are not for extended discussion; this conversation has been moved to chat. \$\endgroup\$
    – Voltage Spike
    Commented Apr 10, 2021 at 5:55

2 Answers 2

1
\$\begingroup\$

This is a formalistic solution to the question, which gives the same result as in previous answer.

A number in IEEE-754 format has three components: sign \$S\$, exponent \$E\$ and mantissa \$M\$ - those are the stored values to represent a number.

\$E\$ is unbiased exponent with \$n\$ bits, which can be treated as unsigned integer and ranges between \$0\$ and \$2^{(n-1)}-1\$.

However, in IEEE-754 format, the particular number \$x\$ can be calculated using biased exponent \$e\$ as \$ x = (-1)^S 2^e m\$, with the bias \$B=2^{(n-1)}-1\$ and the biased exponent \$e=E-B\$.

Knowing that \$E=0\$ is used for a special case of denormalized numbers, the next minimal value of unbiased exponent is \$E=1\$.

Then the minimum (negative) value of the biased exponent for \$n=15\$ will be

\$ e = E-B = 1 - (2^{(n-1)} - 1) = -2^{14} + 2= - 16382_{10}. \$

More details about IEEE-754 format.

UPDATE:

Ok, so here is a question similar to what OP have posted (from here), with a solution:

  1. For a floating-point representation with 64 bits in the mantissa and 12 bits in the exponent, the number of significant digits in decimal and the maximum (positive) value of the exponent in decimal will be:

a. 15 and 48

b. 20 and 617

c. 19 and 616

d. 7 and 38

Correct answer is (c). The number of significant digits x in 64 bits can be found as: \$10^x = 2^{64}\$ -> \$x = 19\$.

The maximum value of the exponent y in 12 bits can be found as: \$10^y = 2^{2047} \$ -> y = 616. [maximum positive number in 12 bit 2’s complement is 2047]

So there seems to be a confusion in what is called an exponent, as here the exponent is just a corresponding power of ten.

If the exponent (in this last mentioned sense) is \$y\$ in \$2^x = 2^{e_{min}} = 10^y\$, where

\$ e_{min} = - 2^{(n-1)} . \$

Then to get a "correct" answer \$-9864\$ , there should be \$n=16\$, meaning that stated \$15\$ bits do not include the sign:

\$ e_{min} = - 2^{15} = -32768 \$

\$ y = log_{10}(2^{e_{min}}) = -9864 (rounded). \$

\$\endgroup\$
1
  • \$\begingroup\$ The correct answer is -9864. \$\endgroup\$ Commented Apr 9, 2021 at 10:09
1
\$\begingroup\$

The question is unanswerable without more information. Consider that in the IEEE-754 floating-point format, there are some reserved values in the exponent field, which lead to encodings other than (finite and normal) values. Denormals (including zero) use an all-0 bit pattern in the exponents, while NaNs and infinities use use the all-1 bit pattern. You've already touched on the question of bias.

Without being told either that the exponent field is treated like IEEE-754 or how it is treated, you cannot know which patterns are reserved, which represent negative exponents, or what the most negative exponent is.

Assuming the IEEE-754 rules, the bias will be 16383, the all-0 exponent is reserved for zero and denormals, and the minimum exponent in hexadecimal is 0x0001 and in decimal is 1-16383 = -16382

\$\endgroup\$
3
  • \$\begingroup\$ The number is stored in IEE-754 format, I have made the correction now but your answer is wrong. \$\endgroup\$ Commented Apr 8, 2021 at 21:35
  • \$\begingroup\$ @AnshulGupta Actually, the answer -16382 seems to be the right one (See my answer for the "proof"). Why do you think it is wrong? \$\endgroup\$
    – megasplash
    Commented Apr 9, 2021 at 9:45
  • \$\begingroup\$ I know the correct answer and it is -9864. I don't know how it is coming. The correct answer was given. \$\endgroup\$ Commented Apr 9, 2021 at 10:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.