English
Language : 

TL32 Datasheet, PDF (6/31 Pages) List of Unclassifed Manufacturers – Real Time System Testing MIT 16.070 Lecture 32
Some Exception Handling Methods
Q: What if data goes bad for any number of reasons? What if bad data
results in...
• Divide by zero in the software algorithm
• Data input from sensors out of a specified range (overflow
condition for the algorithm or for the data type)
A: Add conditionals to your software to work around the problem.
Instead of
result = y/x;
data = get_data();
Use
if x !=0 then result = y/x;
data = get_data();
if data>1000, data = 1000;
if data<0, data = 0;
hperry
5/4/01