Read Mode

Make Precise Calculations in CMD / Batch - Floating Point Decimal numbers | AC Function 1.0 - By Michał Bukowski

In the traditional CMD environment - Users can do very limited activities with the default commands from Microsoft. But, Using the 3rd party Plugins / Extensions created by awesome Batch programmers across the world - we can make almost anything Possible in this dumb Black Screen. The Fact is verified and proved with the creation of BatchStore v.1.0 - By Kvc - Which uses 50+ Batch Plugins to Acquire a GUI Output in CMD console. And, Today - We are again going to talk about another mile-stone in the field of Batch Programming.

Make Precise Calculations in CMD / Batch - Floating Point Decimal numbers | AC Function 1.0 - By Michał Bukowski
Complex Calculations in CMD
Here, in this article we gonna talk about the Great creation of  Michał Bukowski. Which allows us to simply calculate the complex and high precision calculation within the CMD Console. Although, We (TheBATeam) tried to make such function - a long time ago. but, Due to lack of time and planning - it was only limited to version 1.1 of Float function. But, As we already know...
Need is the Mother of Invention!
When Michal needed such utility in their Batch program. They just simply made it using an additional 3rd party plugin. But, All we are focused on is - Results. How they are achieved is a different story - that is not we are concerned about much. So, Without wasting any time - Let's know more about the great creation and its usage. So, You can use it in your own programs. :)

Make Precise Calculations in CMD / Batch | AC Function 1.0 

If you are families with CMD's Set Command - Then You will know that it only allows the normal mathematical operations on the integer data types. Which means, you can't do calculations in float / Decimal point numbers. Which limits Batch programming in many professional areas. And, AC Function By Michal is a little step towards removing that limitation from CMD.

Make Precise Calculations in CMD / Batch - Floating Point Decimal numbers | AC Function 1.0 - By Michał Bukowski
Professional Calculations Using Batch / CMD - Can we do this?

What is AC Function?

It is a Simple 5.06 KBs of Batch Function - which uses, BC.exe Batch Plugin to manipulate the input and gives the required result as output. The Function converts the Simple mathematical expressions by users into the Format that BC.exe understands. And, takes the Output from the plugin to return the answer to the user. So, in a way - AC Function acts as a great intermediate between the user and the complex bc.exe plugin. 

Make Precise Calculations in CMD / Batch - Floating Point Decimal numbers | AC Function 1.0 - By Michał Bukowski
Demo of AC Function's capabilities!

Features of AC Function By Michal: (From 💚 of Author)

As, Per the words from the author of the Function - Batch's built-in SET /A calculator works only with integers. Its very limited tool, what is not enough for professional batch programming. By the way, your FLOAT plugin does not work with some calculations.
  • Calculates even complex calculations (like: "2*9/(11.5-9.11*2)+(2*7)")
  • Writes results into variables directly...
  • Rounds the entered numbers (also with calculations - two in one string!) with chosen number of decimals (Example:  2.912 to 3  or  8.14009 to 8.15)
  • Works with negative numbers.
Make Precise Calculations in CMD / Batch - Floating Point Decimal numbers | AC Function 1.0 - By Michał Bukowski
Comparing AC Function's Features
Currently, in version 1.0 of the function - it supports almost the basic functionalities like - 
  • addition (+) WORKS,
  • subtraction (-) WORKS
  • multiplication (*) WORKS 
  • division (/) WORKS 
  • exponentiation (^) DOESNT WORK (by now) 
    But, The other functionalities like - Exponential, log etc. will be added in next versions. Hope, They'll come out Soon. And, till then - You can Download AC Function ver.1.0 in your programs. 
Can Powershell Replace CMD in Windows ?? | PowerShell Vs. CMD

How to Use?

The AC Function allows you to perform 3 Operations on the expressions / numbers you'll provide to it. You can either make calculations of an expression - Or you can Round off a number upto a specific given precision. And, the 3rd Operation is the mixture of above two operations. You can calculate and round off the result in one step.

Syntax of AC Function:

Calculation Usage:
Ex. call ac.bat c (1/7)*3.5/(11+7) var1
( OUTPUT: VAR1=0.02777777777777777777 )
Rounding Usage:
Ex. call ac.bat r 0.02777777777777777777 4 var2
( OUTPUT: VAR2=0.0278 )
Calculation + Rounding Usage:
Ex. call ac.bat c (1/7)*3.5/(11+7) var4 r 4
( OUTPUT: VAR4=0.0278 )

And, That is all you need to know about this great function. You just need to Use 'C' for calculations - 'R' for Rounding off numbers and Combine them in one line to get effects of both together. 
How To Show Images on cmd Console? | Advanced CMD

From Editor's Desk: 

So, in the end - I will just say that - I hope, you'll like this great innovation and the article explaining it. You can simply Download AC Function from the link provided below. If You are in doubt about anything related to the Function. Or want to give suggestions - Feel free to leave a comment below. We'll try to help you out. Thanks for your time. :)

Support Us By Providing your comments about your thoughts. And, You can also share your work with the world via TheBATeam from Your Work Tab in the menu bar above. Once again... Thanks for your trust and time. :)

VirusTotal verification for file safety: Link
Download Github Project Repository: Link

Keep Learning, Keep Sharing...
Be Happy, Spread Happiness...


  1. the PI value is not correct in the above image.

    1. :) Glad to have you both here. :) You both are right! As, this Image will explain most of my talk.

      because, I've used 355/113 Fraction for calculating that value. You can get the project files either from github or from mediafire. (Any platform you trust) :) And, providing better fraction to the function will give more precise value of Pi. :)

      I will say, it's not the function's fault - It's the User's Fault to have the less precise value. :)


Powered by Blogger.