i am working on a project which gets live data from telemeters and meter readings, and lot of processing is done using those data. at some places i am encountering Underflow Exception, and program terminates abruptly, is there any way to check the exception.......??
The underflow exception occurs if the rounded result has an exponent that is too small to be represented using the floating-point format of the result.
Actually its very simple...
Surround the code which gets data or the code part which generates underflow exception in try-catch block
In catch block assing variable(s) value zero , smallest normal number or a denormal number
Eg. if code is
float veryless=i-j; //here veryless generates underflow exc
replace it by
catch(Exception e) //or catch(Underflow e)
veryless=0; //or by some default