Author Topic: 64-bit calculator and math functions  (Read 5517 times)

Marcel

  • Senior Community Member
  • Posts: 261
  • Hero Points: 26
64-bit calculator and math functions
« on: September 04, 2009, 08:26:02 PM »
64-bit calculator and math functions

asandler

  • Senior Community Member
  • Posts: 303
  • Hero Points: 27
Re: 64-bit calculator and math functions
« Reply #1 on: September 15, 2009, 08:27:48 AM »
I often do various calculations with bytes and bits. It goes like this: first I open an empty buffer in SE and put the numbers in the buffer. Next, I open a calculator and do the math with the numbers placing the result in the same buffer. Copying the numbers from calculator and back to the buffer is quiet tedious. What I would really love to see is SE doing the math for me and placing the result in the buffer.

For example, if I place my numbers in a row and I want to sum them, I'd select the numbers and press a plus button in SE and it would calculate their sum and place the result below.
Same if the numbers are in a row. I'd select the numbers and press the plus sign. SE would sum them and place the result at the end of the row.

Another way of enhancing simple math calculations is being able to pick the a math expression directly from the buffer using selection, and calculating the result in the buffer.

For example, I'd write 8*24 in the buffer, select it and press calculate button. SE would calculate the result of the expression and append =192 after the expression.
This is already implemented in built-in calculator in SE, so extending this functionality onto buffers should be easier.

Note: I know that any of these can be implemented using a macro, but there's a huge value in having it in the SE itself. This is because I have SE installed on three computers that I work with and maintenance becomes a real pain - not only I should keep up with the latest versions of SE itself and its hot-fixes, but also I should keep up with macro releases.
« Last Edit: September 15, 2009, 08:30:16 AM by asandler »

hs2

  • Senior Community Member
  • Posts: 2761
  • Hero Points: 292
Re: 64-bit calculator and math functions
« Reply #2 on: September 15, 2009, 08:41:58 AM »
@Alex: Have a look at the 'add'/'column-math' command. HS2

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 6966
  • Hero Points: 531
Re: 64-bit calculator and math functions
« Reply #3 on: September 21, 2009, 08:16:42 PM »
I often do various calculations with bytes and bits. It goes like this: first I open an empty buffer in SE and put the numbers in the buffer. Next, I open a calculator and do the math with the numbers placing the result in the same buffer. Copying the numbers from calculator and back to the buffer is quiet tedious. What I would really love to see is SE doing the math for me and placing the result in the buffer.

For example, if I place my numbers in a row and I want to sum them, I'd select the numbers and press a plus button in SE and it would calculate their sum and place the result below.
Same if the numbers are in a row. I'd select the numbers and press the plus sign. SE would sum them and place the result at the end of the row.

Another way of enhancing simple math calculations is being able to pick the a math expression directly from the buffer using selection, and calculating the result in the buffer.

For example, I'd write 8*24 in the buffer, select it and press calculate button. SE would calculate the result of the expression and append =192 after the expression.
This is already implemented in built-in calculator in SE, so extending this functionality onto buffers should be easier.

Note: I know that any of these can be implemented using a macro, but there's a huge value in having it in the SE itself. This is because I have SE installed on three computers that I work with and maintenance becomes a real pain - not only I should keep up with the latest versions of SE itself and its hot-fixes, but also I should keep up with macro releases.

There's been a response to this already but it might not have been clear.  Select some numbers (no operator means +).  Place the cursor on the SlickEdit command line and type "add" and press enter.  You can bind the "add" command to a key or add a toolbar button for quicker access.

asandler

  • Senior Community Member
  • Posts: 303
  • Hero Points: 27
Re: 64-bit calculator and math functions
« Reply #4 on: September 22, 2009, 06:38:12 AM »
I often do various calculations with bytes and bits. It goes like this: first I open an empty buffer in SE and put the numbers in the buffer. Next, I open a calculator and do the math with the numbers placing the result in the same buffer. Copying the numbers from calculator and back to the buffer is quiet tedious. What I would really love to see is SE doing the math for me and placing the result in the buffer.

For example, if I place my numbers in a row and I want to sum them, I'd select the numbers and press a plus button in SE and it would calculate their sum and place the result below.
Same if the numbers are in a row. I'd select the numbers and press the plus sign. SE would sum them and place the result at the end of the row.

Another way of enhancing simple math calculations is being able to pick the a math expression directly from the buffer using selection, and calculating the result in the buffer.

For example, I'd write 8*24 in the buffer, select it and press calculate button. SE would calculate the result of the expression and append =192 after the expression.
This is already implemented in built-in calculator in SE, so extending this functionality onto buffers should be easier.

Note: I know that any of these can be implemented using a macro, but there's a huge value in having it in the SE itself. This is because I have SE installed on three computers that I work with and maintenance becomes a real pain - not only I should keep up with the latest versions of SE itself and its hot-fixes, but also I should keep up with macro releases.

There's been a response to this already but it might not have been clear.  Select some numbers (no operator means +).  Place the cursor on the SlickEdit command line and type "add" and press enter.  You can bind the "add" command to a key or add a toolbar button for quicker access.

Yes Clark, I saw the reply. It indeed addresses fraction of my request. However, it only allows addition. There's no built-in command for other math operations. Also, it does not allow one to calculate a mathematical expression in the buffer. Finally, there's no user-interface to do all that. You have to add your own toolbar with custom buttons. This is a kind of things I addressed in the Note: section of my proposal.

Oh and thanks to both of you for addressing this.

hs2

  • Senior Community Member
  • Posts: 2761
  • Hero Points: 292
Re: 64-bit calculator and math functions
« Reply #5 on: September 22, 2009, 08:50:13 AM »
@Alex: Although the command is called 'add' (maybe due to historical reasons) it supports the same operators as the 'math' command (used on cmdline) with the selected expression. See 'Help>Index>math' for further details.
HS2

asandler

  • Senior Community Member
  • Posts: 303
  • Hero Points: 27
Re: 64-bit calculator and math functions
« Reply #6 on: September 22, 2009, 08:54:08 AM »
Oh, this is great. It can do expressions too. It seems to be what I was looking for.
Thanks for pointing this out. ;D

elmar

  • Community Member
  • Posts: 21
  • Hero Points: 1
Re: 64-bit calculator and math functions
« Reply #7 on: May 23, 2016, 07:14:06 AM »
It would be great if SlickEdit could provide support for quick number conversion:
when the mouse cursor hovers over a number, SlickEdit should open a small window showing the same number in other number systems. The number format should consider the current language.
For example in C/C++:
- cursor hovers over number 1234 --> SlickEdit will show 0x4d2, 2322 (octal) and 10011010010 (binary)
- cursor hovers over number 0x1234 --> SlickEdit will show 4660 (decimal), 11064 (octal) and  1001000110100 (binary)

The current solution is to copy the number to the clipboard, open the calculator, paste and convert, close calculator --> very inefficient

jorick

  • Senior Community Member
  • Posts: 400
  • Hero Points: 17
Re: 64-bit calculator and math functions
« Reply #8 on: May 23, 2016, 01:10:06 PM »
I agree with elmar.  I hate opening the calculator for checking what a binary number in hex is.  And let me add that one of the number systems should be ASCII such that 0x30 would display as '0'.  It would be nice in C if a number like 0x68656C70 would display as 'help'.  Yes, I know there may be endian issues (ARM would cause the number to display as 'pleh'), but it's still far better than hauling out the old Nixie Number Cruncher to do the conversion.

rgloden

  • Senior Community Member
  • Posts: 169
  • Hero Points: 5
Re: 64-bit calculator and math functions
« Reply #9 on: May 23, 2016, 05:39:33 PM »
One slightly less painful approach in SE to convert numbers is
* hit escape to take you to the command line
* type "math " and then paste

This is does the hex and decimal translation which is all I need.  Personally I would prefer never to see octal and hex => binary isn't that hard to do in your head (and possibly easier with 32 or 64 bit numbers).

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 6966
  • Hero Points: 531
Re: 64-bit calculator and math functions
« Reply #10 on: May 23, 2016, 06:12:14 PM »
One slightly less painful approach in SE to convert numbers is
* hit escape to take you to the command line
* type "math " and then paste

This is does the hex and decimal translation which is all I need.  Personally I would prefer never to see octal and hex => binary isn't that hard to do in your head (and possibly easier with 32 or 64 bit numbers).

I use the math commands too. Some enhancements have been made to the v21 GUI calculator to show the result in decimal and hex without the need hit the = button. I would like the math commands to do the same.

I'm not big on hover overs but menu commands (i.e  Convert Number To submenu) to convert the number at the cursor and copy it to the clipboard might be really handy. Seems like the math command with no parameters could do all this (i.e grab number at cursor, convert, and copy to clipboard).