Tech moves fast! Stay ahead of the curve with Techopedia!
Join nearly 200,000 subscribers who receive actionable tech insights from Techopedia.
Underflow is a condition which occurs in a computer or similar device when a mathematical operation results in a number which is smaller than what the device is capable of storing. It is the opposite of overflow, which relates to a mathematical operation resulting in a number which is bigger than what the machine can store. Similar to overflow, underflow can cause significant errors.
Underflow can be considered a representational error and occurs mostly while dealing with decimal arithmetic. It mostly occurs when two negative numbers are added and the result is out of range for the device to store.
Applications and programs respond to underflow in different manners. While most report an error and stop processing, some applications try to continue processing and approximate the results. In many cases, whenever underflow occurs, most have the default option to set the number to zero and store the value. Like overflow, underflow also results in not having the result saved in the memory of the application or device. Underflow is not as serious or fatal as in the case of overflow, as there is no good technique to represent large magnitudes in a floating-point system. In cases of arbitrarily small magnitudes, the underflow can be set to zero as a reasonable approximation.