Hi Guru's,
How to get around this resultant underflow issue? I looked around the forum, but did not find the (simple I am sure) answer.
w0 and w1 can and do vary with reference to ADC inputs.
So the desired calculation is that I would like be able to deduct w1 (a potentially higher value than w0) from w0 without the result underflowing below 1 or preferably 0.
I know I could first up say something like:
But... Is there a better way?
Thanks in advance!
Regards,
Mort.
How to get around this resultant underflow issue? I looked around the forum, but did not find the (simple I am sure) answer.
Code:
w0= 5
w1=18
w0=w0 - w1 min 0
end
So the desired calculation is that I would like be able to deduct w1 (a potentially higher value than w0) from w0 without the result underflowing below 1 or preferably 0.
I know I could first up say something like:
Code:
if w1>w0 then
w0=0
endif
Thanks in advance!
Regards,
Mort.