|
Using 254-x Max 254 is better, but it can still cause errors. For example, if x=255, then 254-x will evaluate to -1, which in PBASIC is approx 65,000. You then take the max and get 255. While this will prevent basic run errors, it can still cause run-time logic problems.
While it's not likely that x will be 255, its still a possibility I don't like leaving. Therefore, I would reccomend the following code:
x=2254-x Min 2000 Max 2254 - 2000
|