View Single Post
  #11   Spotlight this post!  
Unread 24-06-2002, 00:21
archiver archiver is offline
Forum Archival System
#0047 (ChiefDelphi)
 
Join Date: May 2001
Location: Pontiac, MI
Posts: 21,214
archiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond repute
'Min 0' does NOTHING!!!

Posted by Joe Johnson.   [PICTURE: SAME | NEW | HELP]


Engineer on team #47, Chief Delphi, from Pontiac Central High School and Delphi Automotive Systems.

Posted on 11/8/2000 8:55 PM MST


In Reply to: Re: 4x4 software differential,oops posted by James on 11/8/2000 8:10 PM MST:



One more thing I just noticed about your PBASIC code.

The line of code below will always leave Variable unchanged (even if Variable='-1')

Variable = Variable MIN 0

This is because in 16 bit unsigned math, (A MIN 0) is ALWAY equal to A. There is nothing less than 0 in unsigned math.

One way of getting around this is to do the following:

Variable = $8000 + Variable MIN $8000 - $8000

Now if Variable='-1' before the statement it will equal 0 after.

This is a very important lesson to learn when working with PBASIC.

Joe J.



__________________
This message was archived from an earlier forum system. Some information may have been left out. Start new discussion in the current forums, and refer back to these threads when necessary.