Latest changes:
- correcting `sin`, `cos`, `tan` to return exactly 0 where appropriate;
- fixed: invalid user-defined functions did not report an error;
- corrections for `NaN` in comparisons;
- optimizing comparison and bitwise operators (identifying operators by numeric Id instead of string);
- correcting: `int`, `ceil` etc. reject `Inf` and `NaN` arguments;
- new: `rad` and `deg` as a trailing command, similarly to `hex`;
- some code cleanup in "SmartMath.bas".
Still TODO:
- reduce blinking while the calculation results are displayed.
(Actually, it is possible to reduce the number of repaint operations - but, in that case, the calculation results look worse, as if several paint operations are superimposed on one another. This does not look clean and sharp).
SmartMath Plugin - Real-time Calculations in AkelPad
- Author
- Message
-
Offline
- Posts: 1328
- Joined: Thu Nov 16, 2006 11:53 am
- Location: Kyiv, Ukraine
-
Offline
- Posts: 1328
- Joined: Thu Nov 16, 2006 11:53 am
- Location: Kyiv, Ukraine
Re: SmartMath Plugin - Real-time Calculations in AkelPad
Latest news:
- SmartMath preserves 64-bit integer accuracy during calculations when possible;
- SmartMath preserves 64-bit integer accuracy of input values in a form like `1e18` and even `0.1234e6`;
- while validating a user-defined function, its parameters no more use global variables with the same name (see "User-Defined Functions Validation" inside the "USAGE_AND_SYNTAX.md").
SmartMath is expected to give you strong guarantee of preserving 64-bit integer accuracy during calculations when possible.
Thus, the result of e.g. `2**63 + 2**62` and `(2**63 - 1) << 1` is an accurate integer value.
This was a part of the initial design of SmartMath'es expression parser and evaluator. It was stated in both "USAGE_AND_SYNTAX.md" and in the "add-mathparser-function" skill for AI.
However, I had to manually re-check each operation and function to ensure they really preserve the 64-bit integer accuracy when possible (because not all of them actually did). It's a good example of the magic of AI-driven development
Whatever you tell it to do, you always must verify the results. And not just the output results, but also the way how AI implemented that. While AI does amazing job in performing exact tasks, it still needs to be controlled to not do stupid things and to apply the most appropriate approach.
Given that, how I can be sure the implementation of SmartMath'es expression parser and evaluator matches the expectations? Well, we have almost 1000 tests that cover most of its functionality. And we always can add more to fix the exact behavior!
The most recent "USAGE_AND_SYNTAX.md" is here:
https://github.com/d0vgan/AkelPad-Smart ... _SYNTAX.md
And the current binaries (if you don't want to deal with FreeBasic) are here:
https://drive.google.com/file/d/1eendPg ... drive_link
- SmartMath preserves 64-bit integer accuracy during calculations when possible;
- SmartMath preserves 64-bit integer accuracy of input values in a form like `1e18` and even `0.1234e6`;
- while validating a user-defined function, its parameters no more use global variables with the same name (see "User-Defined Functions Validation" inside the "USAGE_AND_SYNTAX.md").
SmartMath is expected to give you strong guarantee of preserving 64-bit integer accuracy during calculations when possible.
Thus, the result of e.g. `2**63 + 2**62` and `(2**63 - 1) << 1` is an accurate integer value.
This was a part of the initial design of SmartMath'es expression parser and evaluator. It was stated in both "USAGE_AND_SYNTAX.md" and in the "add-mathparser-function" skill for AI.
However, I had to manually re-check each operation and function to ensure they really preserve the 64-bit integer accuracy when possible (because not all of them actually did). It's a good example of the magic of AI-driven development
Given that, how I can be sure the implementation of SmartMath'es expression parser and evaluator matches the expectations? Well, we have almost 1000 tests that cover most of its functionality. And we always can add more to fix the exact behavior!
The most recent "USAGE_AND_SYNTAX.md" is here:
https://github.com/d0vgan/AkelPad-Smart ... _SYNTAX.md
And the current binaries (if you don't want to deal with FreeBasic) are here:
https://drive.google.com/file/d/1eendPg ... drive_link
-
Offline
- Posts: 1328
- Joined: Thu Nov 16, 2006 11:53 am
- Location: Kyiv, Ukraine
Re: SmartMath Plugin - Real-time Calculations in AkelPad
With the latest updates, SmartMath becomes even smarter than before! 
1. Time values are supported:
`01:25 + 00:37` -> `02:02`
`1h20m + 15m30s` -> `01:35:30`
`hours((30m, 6m, 40s))` -> `(0.5, 0.1, 0.011111)`
2. Complex numbers are optionally supported:
- By default, `sqrt(-1)` and `ln(-1)` produce `NaN`.
- With "Complex Numbers" enabled in the menu, `sqrt(-1)` is `i` and `ln(-1)` is `3.141593i`.
In general, complex numbers are supported by most of the operators and functions where they make sense.
Did you know, but the way, the complex numbers can not be compared in terms of `>` and `<`? Only equality and non-equality are supported.
This is another check-point in the development of SmartMath.
At this moment, I have just 2 more functions to add. After that, there will be refactoring, corrections, bug-fixes, if any.
the current binaries (if you don't want to deal with FreeBasic) are here:
https://drive.google.com/file/d/1goPTl1 ... drive_link
1. Time values are supported:
`01:25 + 00:37` -> `02:02`
`1h20m + 15m30s` -> `01:35:30`
`hours((30m, 6m, 40s))` -> `(0.5, 0.1, 0.011111)`
2. Complex numbers are optionally supported:
- By default, `sqrt(-1)` and `ln(-1)` produce `NaN`.
- With "Complex Numbers" enabled in the menu, `sqrt(-1)` is `i` and `ln(-1)` is `3.141593i`.
In general, complex numbers are supported by most of the operators and functions where they make sense.
Did you know, but the way, the complex numbers can not be compared in terms of `>` and `<`? Only equality and non-equality are supported.
This is another check-point in the development of SmartMath.
At this moment, I have just 2 more functions to add. After that, there will be refactoring, corrections, bug-fixes, if any.
the current binaries (if you don't want to deal with FreeBasic) are here:
https://drive.google.com/file/d/1goPTl1 ... drive_link
-
Offline
- Posts: 67
- Joined: Thu Feb 04, 2016 5:27 am
Re: SmartMath Plugin - Real-time Calculations in AkelPad
Haha, great work Dovgan.
It never ceases to amaze me just how many features the plugin has now.
By the way, how can we make your fork the main repository?
I think it would be ideal so that it shows up indexed in GitHub's results; for example, at the moment if we search for "akelpad", my repository appears in the results but not your fork with all the improvements.
Or maybe give you access so you can update the main repository directly?
To be honest, I don't know much about how GitHub works or its options. I was looking and there's an "Invite collaborators" option; maybe if I invite you, you can update the main repository directly?
What do you think?
Another thing, maybe you noticed or maybe you didn't, but I originally made this first to get to the heart of SmartMath, since AkelPad didn't have anything like Scintilla's "Line Hints".
https://akelpad.sourceforge.net/forum/v ... php?t=3008
https://github.com/c-sanchez/AkelPad-LineHint-Plugin
However, even though this plugin isn't useful on its own, as I said, I made it with SmartMath in mind, and although it does the job, I suppose it could be improved/optimised; could you take a look at it as well? :p
It never ceases to amaze me just how many features the plugin has now.
By the way, how can we make your fork the main repository?
I think it would be ideal so that it shows up indexed in GitHub's results; for example, at the moment if we search for "akelpad", my repository appears in the results but not your fork with all the improvements.
Or maybe give you access so you can update the main repository directly?
To be honest, I don't know much about how GitHub works or its options. I was looking and there's an "Invite collaborators" option; maybe if I invite you, you can update the main repository directly?
What do you think?
Another thing, maybe you noticed or maybe you didn't, but I originally made this first to get to the heart of SmartMath, since AkelPad didn't have anything like Scintilla's "Line Hints".
https://akelpad.sourceforge.net/forum/v ... php?t=3008
https://github.com/c-sanchez/AkelPad-LineHint-Plugin
However, even though this plugin isn't useful on its own, as I said, I made it with SmartMath in mind, and although it does the job, I suppose it could be improved/optimised; could you take a look at it as well? :p
-
Offline
- Posts: 1328
- Joined: Thu Nov 16, 2006 11:53 am
- Location: Kyiv, Ukraine
Re: SmartMath Plugin - Real-time Calculations in AkelPad
Once the code is refactored and verified for some time to be treated as stable, I'll raise a pull request to the main repository.
After that, just a click on the "Merge" button will prevent it from being merged into the main repo.
Surely, there may be review comments that will be addressed before merging.
In long-time perspective, having access to the main repository will be quite useful.
In the future I may use the C++ version of the MathParser to e.g. make a plugin for Notepad++. In such case, some corrections to the MathParser will most likely be needed.
That was a good start indeed, with a new functionality that rather demonstrates a way to achieve more.c-sanchez wrote: ↑Sat May 16, 2026 7:37 pmAnother thing, maybe you noticed or maybe you didn't, but I originally made this first to get to the heart of SmartMath, since AkelPad didn't have anything like Scintilla's "Line Hints".
https://akelpad.sourceforge.net/forum/v ... php?t=3008
https://github.com/c-sanchez/AkelPad-LineHint-Plugin
While it can be perfectly useful for users who need accessibility assistance, I'm not sure I have ideas how to enhance it at the moment.