Hi there,
I am currently working on a program that need to check for unsigned long (UINT32) value overflow after multiplication with another float (REAL32) variable. My current way is:
1. after multiplication store result in a unsigned long (UINT32) buffer
2. check buffer value against constant UINT32_MAX_VAL 4294967295.0
3. if over refuse to update value, if within range copy buffer to final unsigned log (UINT32) variable
But the check will be carried out at a rather time sensitive place and will be called several times. I afraid it may cause time out. So my question are:
a. Is there other way to check for variable overflow?
b. Is float (REAL32) calculation time consuming? Is there any documentation for calculation execution time?
c. Or should I cast everything to long long (UINT64)? Compare to float (REAL32) which one takes longer?
d. Is it time consuming to cast UINT32 to REAL32?