Author Topic: Calculator error, edge cases...  (Read 202 times)

jporkkahtc

  • Senior Community Member
  • Posts: 2211
  • Hero Points: 192
  • Text
Calculator error, edge cases...
« on: August 28, 2020, 05:34:40 pm »
#1:
Maybe Calculator should restrict what you can type:
In binary mode, only accept 0 and 1.

Its odd because in binary mode starting from a blank line I type: ABC
and I get "0bABC"

#1 A: When I click =, I then get:
---------------------------
SlickEdit Pro
---------------------------
Syntax error
---------------------------
OK   
---------------------------

#1 B: But in Octal the error I get is:
---------------------------
SlickEdit Pro
---------------------------
Can't find variable 'oABC'
---------------------------
OK   
---------------------------

#1 C: It would be great if Calculator supported variables .... this is why I typically use Python as a desktop calculator.


#2:
Odder still, in binary mode type: 0x1010=
and you get:
0b0x1010= 0b1000000010000 = 4112 (Dec) = 0x1010 (Hex)
0b1000000010000

Notice the double-prefix.

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 5800
  • Hero Points: 461
Re: Calculator error, edge cases...
« Reply #1 on: August 28, 2020, 09:42:37 pm »
There would have to be a separate input mode and output mode. Right now, the mode effects both. The decimal mode lets you type all the prefixes yourself but this requires you to have to change the mode to "bin" after you finished typing since it doesn't show more than just decimal and hexadecimal totals (really just to save screen space).

It sort of already support variables. Unfortunately, only Slick-C variables which isn't useful (ex def_actapp+4). Especially since the calulator upper cases everything so you have to lower case the variable name after it gets messed up.

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 5800
  • Hero Points: 461
Re: Calculator error, edge cases...
« Reply #2 on: August 28, 2020, 09:56:19 pm »
I just realized you can change the output mode for the output total on the right. It defaults to Hex but you can change it to Binary.