Author Topic: 0xffffffff in calculator  (Read 2474 times)


  • Senior Community Member
  • Posts: 104
  • Hero Points: 7
0xffffffff in calculator
« on: September 15, 2017, 05:38:47 am »
The new calculator is nice! I was just fooling around in it and tried writing a hex number. It worked and it shows the decimal representation. Nice! Now entering 0xffffffff shows 0xffff and -1. Adding one more f and it starts working again.


  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 6398
  • Hero Points: 498
Re: 0xffffffff in calculator
« Reply #1 on: September 16, 2017, 10:28:59 am »
In terms of int type (short ushort int uint etc.), there's a lot of guessing going on. It's definitely not pure C++, but it's pretty close. If you type 0xFFFFFFFFU, then it will convert to an unsigned number. Otherwise, it converts to -1 and then back to 0xFFFF for the hex output. Notice that if you type "-1", you get the same hex result as if you type 0xFFFFFFFF.

Note: The hover over number popup code displays some numbers like this in both signed and unsigned. The calculator doesn't.

Unlike C++, for the non-bitwise operators, Slick-C auto increases the int size.

0xFFFFFFFFU+1   -- no overflow here
0xFFFFFFFFFFFFFFFFU+1  -- no overflow here either. Slick-C ints up to 32 digits.

Hope this makes sense. It's never exactly C++ 64-bit or 32-bit arithmetic. This calculator supports floating point too.
« Last Edit: September 16, 2017, 03:02:44 pm by Clark »