Author Topic: Bug in dec2hex() in math.e  (Read 4859 times)

rfindley

  • Junior Community Member
  • Posts: 2
  • Hero Points: 1
Bug in dec2hex() in math.e
« on: April 03, 2009, 07:59:37 PM »
Found a bug in dec2hex() in math.e.  Looks like a cut-and-paste error.  Is this the right place to post such?

In the base-2 conversion section is the following code snippet:

   } else if ( base == 2 && (number & 0xFFFFFFFF) == number ) {
      while ( number != 0 ) {
         digit := (int)(number & 0x7);
         result = digit:+result;
         number = number >> 1;
         number = number & 0x7FFFFFFF;
      }

The highlighted text should be changed to 0x1.  As is, when converting to binary, you get some pretty strange results.  I noticed this while using the Calculator form.

-Robin

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 7041
  • Hero Points: 535
Re: Bug in dec2hex() in math.e
« Reply #1 on: April 03, 2009, 09:29:24 PM »
Thanks! I have verified this fix and have checked it in.  I can't believe how old this bug is.