Floating point limits

I was asked these two questions, and I cannot correctly circle my head with a floating point, so if someone can offer some guidance on how I should work with these questions, I would be very grateful.

  • What is the smallest and largest number that can be represented in 2s compliment normalized floating point designation with 10-bit mantissa and 6-bit exponent?

  • Which two nearest values ​​are equal to 0 is possible with the aforementioned mantissa and exponent. Think about where overflow and overflow takes place.

+6
source share
3 answers

If you are talking about the IEE754 variant, you can study Wikipedia IEEE754-1985 and independently develop calculations for a fully normalized number, taking into account the different sizes of the fraction and the indicator.

Forget the mark for now, it's just a bit flip.

The largest fraction is all one-bit, which for a ten-bit mantissa:

1 1 1 1 1 1 1 1 1 1 1 + - + - + - + -- + -- + -- + --- + --- + --- + ---- 2 4 8 16 32 64 128 256 512 1024 = 1024 + 512 + 256 + 128 + 64 + 32 + 16 + 8 + 4 + 2 + 1 ----------------------------------------------------- 1024 

(implicit 1 plus ten bits in all-consuming fractions). This is 2047/1024 .

With respect to the exponent, the highest non-specific value (special values ​​such as NaN or ±Inf ) for a 6-bit indicator is 2 6 -2 or 62 (range from 0 to 62).

But, since you need positive and negative indicators, you subtract 31 (offset, half the maximum non-specific value). This gives you a range of -30 to 31 (-31 can be discounted here, as it is not normalized).

Thus, the largest and smallest (most negative) values ​​are ±(2047/1024)x2 31 or ±4292870144 .

Similarly, two near zero values ​​have an exponent field of -30 (the minimum normalized) and a mantissa field of all zeros, which with an implicit 1 gives you 1 .

These values ​​are ±(1)x2 -30 or ±0.000000000931322574615478515625 .

You have to print this page on Wikipedia and this answer and sit together until you understand them. I do not mind helping you here, but if you spew out my answer for homework, you will almost certainly be caught (if your teachers have any intelligence, although there is no guarantee that).

To put this answer on your own words (and therefore not plagiarize), you need to understand this.

+1
source

(I would add this as a comment, but at some point I lost the ability to comment. Perhaps for some reason my reputation worsened.)

Make sure you make a distinction between what the smallest number means compared to what the largest negative number means. They are different, and you can lose credit based on how you respond to this on your assignment. Given that the second question asks the smallest numbers represented in this format, I think the first question is supposed to be asking for the most negative number (negative number, at most from zero - the negative number with the highest value).

As said in an earlier answer, I suggest you work with them manually.

Ask yourself: What combination of sign, exponent and mantissa will create the largest / smallest numbers? If you know how to convert from binary to decimal, I think you should easily solve this problem. If you do not know this, I suggest you start work and go your own way.

+2
source

Perhaps you should take a look at these pages: 1 , 2 , 3 , 4 , 5 , 6 , 7

I hope this helps, just not giving answers directly. :)

Btw. did you try to do the calculations manually?

+1
source

Source: https://habr.com/ru/post/891380/


All Articles