I faced with the following issue: if the value of a floating point format number is in the range of underflow, it must be 0 or a denormal number.If the value is not 0 than what is the exact value of it?Is it conventional constant value or depend on different architectures? I am sorry but could not understand through wiki's article
Some -- not all but the most common one are -- binary floating point representations are using a trick to get one more bit of precision. First, let's define the normal representation for non-null floating point values as the representation where the exponent is chosen so that the most significant bit of the value is the most significant bit of the value is the most significant bit of the significand (also known as mantissa). The trick is to notice that when the normal representation is used, the most significant bit of the significand is always set for non null values, and thus those format mandate the representation to be normalized so that they can avoid to represent it in the format.
This has two undesirable characteristics.
Some values which would have been representable if normalization was not mandated are now no more representable as normalization would implies a non representable exponent.
The difference between 0 and the first representable value is bigger than the difference between the next representable value and the first.
Some formats (again not all but the most common one are) are trying to avoid those properties by allowing non-normalized values if normalization is not possible. Those are called denormal or subnormal.
So when a computation result in a number which is smaller (in absolute value) to the smallest normal representation -- also known as underflow --, the main choices are:
- use as result a denormal if the representation allow it and the number is not smaller than the smallest denormal
- use zero as result
Note that some other possibilities exist:
- use as result a NaN marking the result as underflow
- generate an exception or an interrupt of some sort
- set a sticky bit somewhere meaning that an underflow has been met in addition to returning one value of some kind.
Underflow are usually considered as too common for those other possibilities, excepted the last one, to be considered as useful for most code.