HI,
Thanks for your reply, I dont know the minimum & value which the input signal could attain.
for eg. ecg signal , I need to find the maximum peak of the signal & minimum it attain , as per the person's heartbeat, where I can not guess the maximum & minimum value of the signal, specially with signed input the logic fails coz more the negetive number(magnitude ) smaller it is.
I still dont understand your problem. Im guessing you are trying to do some normalisation? You cannot do that with current data, you have to use historic data, and then clip anything that over or underflows, unless you have some kind of large buffer to store the data before normalisation?
If you used the signed/unsigned types in the numeric std library, then the function:
shhrikant,
this is the same as the C program. you can initialize the value for "max" to the most negative value. eg, x8000 for a 16b value. "min" is initialized to the most positive number. eg. x7FFF for 16b.
the first sample will naturally be less than or equal to the min, updating it. it will also be greater than or equal to the max, updating it.