SmartMath Plugin - Real-time Calculations in AkelPad

Discuss and announce AkelPad plugins
  • Author
  • Message
DV
Offline
Posts: 1326
Joined: Thu Nov 16, 2006 11:53 am
Location: Kyiv, Ukraine

Re: SmartMath Plugin - Real-time Calculations in AkelPad

Post by DV »

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).

DV
Offline
Posts: 1326
Joined: Thu Nov 16, 2006 11:53 am
Location: Kyiv, Ukraine

Re: SmartMath Plugin - Real-time Calculations in AkelPad

Post by DV »

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
Post Reply