In SX Microcontrollers, SX/B Compiler and SX-Key Tool, robotworkshop wrote: Although I can't seem to find if it is spelled out in the docs, it appears that all the built-in math is setup for unsigned use. Does anyone already have any routines already coded in SX/B to simulate some of the signed math operations? I am sure I can come up with some but if the code has already been posted it may save some time. At the moment I have to work with some word variables and need to get some really simple things from them. So far my code will assume anything with bit 15 set is a negative number in 2's complement format. From the two word values i'd like to get: - ABS difference of the two words - Whether that difference was positive or negative. Also looking for the best method of handling signed numbers for conditional IF statements. I had been checking bit 15 to see if it was a negative number first but want to see what others are using. Robert ---------- End of Message ---------- You can view the post on-line at: http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=252070 Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2008 (http://www.dotNetBB.com)