Script for large integer and floating-point arithmetic and comparison using macros (updated to v1.1)
Posted: 12 Jan 2018 11:54
Hey everyone,
I just wanted to share my script which aims to enhance arithmetic operations in batch without the use of VBscript. With this, you can do all the standard arithmetic math but with larger integers and floating-point numbers. It also takes care of evaluating all inputs, contains enhanced number comparison and evaluation functions, gives you full control over the precision of float outputs, and more!
The script takes full advantage of macros to help with the additional overhead. While the maximum number of digits across operations is limited compared to the other solutions I've seen, it appears to be much faster and I believe the fixed size should be more than enough for regular tasks. In addition, because this is a pure batch solution, it should work fine on older Windows systems. So far I've tested it on Windows XP Professional 32-bit and Windows 7 Ultimate 64-bit.
Keep in mind that this is only my second major batch script so forgive me if my code appears a bit amateurish. Despite my inexperience, I tried my best to design the script to be fast and easy to read and use.
I've also included two additional scripts. The arithmetic_examples.bat file contains examples for all the user macros in arithmetic.bat as well as some useful tips to take full advantage of the script. The other one, benchmark.bat, is a simple but powerful script designed for benchmarking other scripts and applications. It uses arithmetic.bat for time calculations and is a great showcase on how you can easily incorporate it in your own scripts.
If you find any of these useful, encounter bugs or have any suggestions, by all means let me know!
*** UPDATES ***
I recently completed another script that utilized both arithmetic.bat and benchmark.bat and found some issues.
arithmetic.bat v1.1 (2018-1-24)
* Fixed bug where user macros can't be called after changing directory.
* Fixed other minor bugs and made some tweaks.
* Added four new user macros @enableResultMes, @disableResultMes, @enablePauseOnErrors and @disablePauseOnErrors.
benchmark.bat v1.1 (2018-1-24)
* Fixed bug where user macros can't be called after changing directory.
* Script will now run even if arithmetic.bat is initialized from a different location.
Ron
I just wanted to share my script which aims to enhance arithmetic operations in batch without the use of VBscript. With this, you can do all the standard arithmetic math but with larger integers and floating-point numbers. It also takes care of evaluating all inputs, contains enhanced number comparison and evaluation functions, gives you full control over the precision of float outputs, and more!
The script takes full advantage of macros to help with the additional overhead. While the maximum number of digits across operations is limited compared to the other solutions I've seen, it appears to be much faster and I believe the fixed size should be more than enough for regular tasks. In addition, because this is a pure batch solution, it should work fine on older Windows systems. So far I've tested it on Windows XP Professional 32-bit and Windows 7 Ultimate 64-bit.
Keep in mind that this is only my second major batch script so forgive me if my code appears a bit amateurish. Despite my inexperience, I tried my best to design the script to be fast and easy to read and use.
I've also included two additional scripts. The arithmetic_examples.bat file contains examples for all the user macros in arithmetic.bat as well as some useful tips to take full advantage of the script. The other one, benchmark.bat, is a simple but powerful script designed for benchmarking other scripts and applications. It uses arithmetic.bat for time calculations and is a great showcase on how you can easily incorporate it in your own scripts.
If you find any of these useful, encounter bugs or have any suggestions, by all means let me know!
*** UPDATES ***
I recently completed another script that utilized both arithmetic.bat and benchmark.bat and found some issues.
arithmetic.bat v1.1 (2018-1-24)
* Fixed bug where user macros can't be called after changing directory.
* Fixed other minor bugs and made some tweaks.
* Added four new user macros @enableResultMes, @disableResultMes, @enablePauseOnErrors and @disablePauseOnErrors.
benchmark.bat v1.1 (2018-1-24)
* Fixed bug where user macros can't be called after changing directory.
* Script will now run even if arithmetic.bat is initialized from a different location.
Ron