As you know previously, with some mathematical tricks and proper algorithm of code – we’ve defined the float value calculations in Batch using Float Function 1.0. We already know that in cmd – conventional calculation technique using ‘SET /a’ Command, we can only perform mathematical operations on the integers.
However, there is no scope for precise calculation up to some decimal places. However, the Float Function 1.0 gave some hope to the batch programmers that now they can do some real mathematics, that we normally want in real life.
Batch Function – Float Function 1.0
But still, know that ‘Nothing can be perfect’. The version 1.0 of this float function by kvc also has some shortcomings or flaws. It did not allow the user to save the output value directly to a variable. Instead of this, the function only displays the corresponding result on the cmd console directly, even when the user wants it or not.
That’s pretty undesirable, as computers must work – as we want from them. We are humans and it’s enough to make them work according to us otherwise, there’s no need for them in this world.
We came to know this problem of Float Function 1.0 when we got a mail and comment from Mr. Lilián luna de Valencia, notifying us about the problem he’s facing while using this function from his batch file as he’s not getting the expected result.
What’s New in this Version?
We’ve solved his problem by telling him to add 3 lines of code to their batch file for the required function of their batch file. But, we thought that this limitation of 1.0 makes the usage difficult. It violates our goal of ‘making things easier in batch programming’. So, we decided that it’s time to launch for 1.1 of the Float function.
We are really thankful to Mr. Lilián luna de Valencia, for their sincere feedback. The 1.1 contains very few changes (that’s why it is ver.1.1 instead of being 2.0), but they worth to be added as to update the function. So now without wasting any time let us have a look at the ver.1.1 and the updates that are done.
Firstly, the code of Float function 1.1 by Kvc is smaller than the original 1.0 (by a little bit). The new functionality of saving the output of desired calculation directly to a variable – like a function, returns a value in the variable. Now you can easily use float function in your batch file without adding an unwanted, undesired extra code into your file.
From The Editor’s Desk
If you’re still not clear about the usage of Float function 1.1 by Kvc in cmd console or batch file. Just post a comment in the Cmd FAQ section. we’ll try to clear your doubts.
If you like our work in the field of batch programming, do comment because your one comment can motivate us:)
HASH Code - For Verification - (SHA-256)
Keep learning, keep sharing….TheBATeam
Be happy, spread happiness…