View Single Post
  #14   Spotlight this post!  
Unread 04-19-2002, 09:34 AM
rbayer's Avatar Unsung FIRST Hero
rbayer rbayer is offline
Blood, Sweat, and Code
no team (Teamless Orphan)
 
Join Date: Mar 2002
Rookie Year: 2001
Location: Minnetonka, MN
Posts: 1,087
rbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of light
Send a message via AIM to rbayer
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
__________________
New C-based RoboEmu2 (code simulator) available at: http://www.robbayer.com/software.php