View Single Post
  #3   Spotlight this post!  
Unread 21-08-2008, 18:00
EricVanWyk EricVanWyk is offline
Registered User
no team
 
Join Date: Jan 2007
Rookie Year: 2000
Location: Boston
Posts: 1,597
EricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond repute
Send a message via AIM to EricVanWyk
Re: Variable rollover with Labview (suggestions?)

I'm having a little trouble following exactly what you are trying to accomplish: could you provide example inputs and what you want as an output?

I've included a few options, all assume that rollover is 100.

Which of the following behaviors is correct?
1) 112 becomes 12
2) 112 becomes 100


Another interpretation: You have a variable x, and you are incrementing or decrementing by dx. You want output to "latch" to either extreme if you would otherwise roll.
x=98, dx=5, output = 100
x=98, dx=70, output = 100
x=3, dx=-5, output = 0

Perhaps pulling dx into your function would make it easier, as you can use it's sign without having to guess.
Also, would it help to temporarily use a 32bit int to avoid overflow, and then truncate back down?
Reply With Quote