GATJR
04-08-07, 12:27 PM
I use */ (star-slash) in my PID loop as a scaler. How do I detect when the result is an overflow. First thought is to just undo the */ and do the whole thing by hand but that gets bigger and slower.
I was hoping that one of FORTH gurus would know how to handle this.
This wasn't a problem when we ran our steering system ATVs with +-22 degree steering, but we see an overflow everynow and then on our Jeep with +-450 degree steering.
The result of the */ is greater than 32767 very rarely, but it does occur and I'd like to be able to detect it and manage it. The signs of the results of */MOD are different when the overflow occurs except for the zero case, so */MOD almost works.
I was hoping that one of FORTH gurus would know how to handle this.
This wasn't a problem when we ran our steering system ATVs with +-22 degree steering, but we see an overflow everynow and then on our Jeep with +-450 degree steering.
The result of the */ is greater than 32767 very rarely, but it does occur and I'd like to be able to detect it and manage it. The signs of the results of */MOD are different when the overflow occurs except for the zero case, so */MOD almost works.