I feel I've written about the */ and ** so many times I've lost count, it's also described in the manual, but it's apparently one of those things...so here goes:
The ** multiplies the two values you give it. This results in an intermediate 32bit result. PBP then returns the top 16bits of those 32bits. This means it does an inherent divide by 65536 so you COULD think of the ** operator as a "multiply by units of 1/65536 command".
So x = value ** 1601 is PBP lingo for x = value * 0.02443 and what's 4095*0.02443? Correct, it's 100.
How did I find 1601? Well you want an "output value" of 100 for an "input value" of 4095 so, (100/4095)*65536=1600.39 but since you really wanted it to display 100 and not 99 we had to round that up to 1601. Same thing for the 0.1% resoultion, then we need to round it up to 16004.
I hope that makes sense.
/Henrik.
EDIT: Forgot, the */ and ** works slightly different depending on if you have LONGs enabled or not. The above describes how it works when DON'T have LONGs enabled.




Bookmarks