Hi there,
Using s15.16 fixed point numbers, is there a simple way to catch over/underflow errors without having to replicate the equation being tested in floats and using a break point?
Ie
a * b will result in an overflow
my mind is running a blank on how best to do this without having to replicate the equation each time
(I have quite a few)
any help would be appreciated.
Using s15.16 fixed point numbers, is there a simple way to catch over/underflow errors without having to replicate the equation being tested in floats and using a break point?
Ie
a * b will result in an overflow
- Code:
EGL_Fixed a = EGL_FixedFromFloat(300);
EGL_Fixed b = EGL_FixedFromFloat(300);
EGL_Fixed c = EGL_Mul(a,b);
#if DEBUG
float af = EGL_FloatFromFixed(a);
float bf = EGL_FloatFromFixed(b);
float cf = af*bf;
if(cf > EGL_FloatFromFixed(EGL_PINF))
{
//over flow - break here
}
#endif
my mind is running a blank on how best to do this without having to replicate the equation each time
(I have quite a few)
any help would be appreciated.