In SX Microcontrollers, SX/B Compiler and SX-Key Tool, kd5dhu wrote: [2] I'm having a little trouble with the Modulus operator or more specifically the __REMAINDER Aliases in SX/B v1.51.01 From the HELP file under Operators section: Modulus it states: [code] Note: The remainder of a division (modulus) is available immediately after the division or modulus operation. This code: dig10 = value / 10 dig01 = __REMAINDER ... uses half the instruction space of: dig10 = value / 10 dig01 = value // 10 The only requirement for using __REMAINDER (or __WREMAINDER for word values) is that the assignment to another variable must be the first instruction following the division or modulus operation. "[/2] [/code][2] In my code I'm doing the following: [code] tmp1 = Year / 4 ' Step 1a. - get a quarter of the year tmp2 = __REMAINDER ' Setp 1b. - save the remainder [/2][/code][2] If Year = 00 then I would expect: tmp1 = 0 tmp2 = 0 But I actually get: tmp1 = 0 tmp2 = 255 However If I change the code to: [code] tmp1 = Year / 4 ' Step 1a. - get a quarter of the year tmp2 = Year // 4 ' Setp 1b. - save the remainder[/2] [/code][2] I get what I expect: tmp1 = 0 tmp2 = 0 Could this be a bug with the __REMAINDER? Or am I not understanding this correctly? Thanks [/2] ---------- End of Message ---------- You can view the post on-line at: http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=145383 Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2006 (http://www.dotNetBB.com)