+ 1
What is "exponent underflow"?
In computer organization.
3 Antworten
+ 1
What are Overflow and Underflow?
Overflow occurs when calculations produce results exceeding the capacity of the result.
Example:
16-bit integers can hold numbers in the range -32768...32767 .
So what happens when you add 20000 to 20000?
1 111 1 (carry digits)
0100111000100000
+0100111000100000
1001110001000000
The sixteenth bit contains a '1' as a result of adding the two numbers. Yet, numbers with a '1' in the leading position are interpreted as negative numbers, so instead of '40000', the result is interpreted as '-25536'.
Overflow can also occur in the exponent of a floating point number, when the exponent has become too large to be represented using the given representation for floating-point numbers (e.g, 7 bits for 32-bit integers, or exponents larger than 63).
A calculation resulting in a number so small that the negative number used for the exponent is beyond the number of bits used for exponents is called underflow (e.g, 7 bits for 32-bit integers, or exponents smaller than -64).
https://www.cs.drexel.edu/~introcs/F2K/lectures/5_Scientific/overflow.html
+ 1
No,I am asking about exponent underflow.
+ 1
Floating point numbers (the ones with decimal points) have gaps in between them. That means there is a smallest possible float you can make after 0; and if your calculation returns something smaller than that, you have run into underflow.
More details:
How does that connect to integer underflow?
Floats are stored in (binary) scientific notation, so for example the number 15 is 1.875 * 2^3, or if we switch to binary, 1.111 * 10^101.
The floating point format only stores the mantissa (The 111 of the 1.111 from the example) and the exponent (101). "exponent underflow" now occurs when the exponent underflows, that means when the number becomes smaller than what can be stored. For floats that is -128 I believe, as the exponent is 8 bits wide.