An official Batch Programming blog! To Solve the daily problems with windows and fixing them with little notepad scripts. Unlock the Hidden Secrets of Windows, Learn to crack Software via CMD & Make your own Programming tools. Understand to Manipulate your PC via CMD.

Algorithm for calculating floating point numbers| By kvc

ALGORITHM FOR CALCULATING FLOATING POINT NUMBERS :Hey Guys, Today I’m Gonna share one of my best batch programming work.

As we have created a proper algorithm for calculating Floating point numbers from pure Integer environment.

In other words, we may have found the way of windows to define floating point integers in computer programming.

 This is fully created by kvc, and not even a single info about floating point values is taken from any other source.

So, without wasting any time, let’s talk about the Algorithm.

The algorithm is divided into 3 parts:

  1. Plus (+) and (-) operations,
  2. For Multiplication (x) operations,
  3. For Division (/) operations.

Now, In general, we have to take some assumptions in order to create something, the same case is here, as we have assumed some facts before making this awesome algorithm.


We were working on this project, and while having our copy and pen on the desk. we thought of the following basic fact.

‘As we know that every float value has two parts’

  1. The Part Before ‘dot’ (.)
  2. The Part After ‘dot’ (.)


Considering Cases:

  1. If we want to add two floating point values then… e.g. 2.36 + 3.649 = 6.009
    We can add Part 1 & Part 2 of both numbers separately but to do so, we have to make Part 2 of Both numbers in same decimal places. Like we can’t just simply add 36 to 649, it will mess-up with our result. 
  2. We have to make 36 à 360 first (so that decimal places become same i.e. 3 digits after dot ‘.’) then we can add Part 2 of both numbers and adding Part 1 of both the numbers will be easier enough,
    Similar operations are valid for subtracting floating point numbers. The Negative sign will be handled via two ‘If‘ statements in the code.

  3. And Algorithm for multiplying two floating point numbers is very easier than all others… As we just have to count the total no. of digits after dot ‘.’ in both the Numbers… i.e.
  4.  In the above case, Number 1 (2.39) has 2 digits after dot ‘.’ And Number 2 (3.649) has 3 digits after dot ‘.’, hence the total number of digits after the dot is 5…
    Now simply multiply 239 & 3649 and Place a Dot ‘.’ Leaving the last 5 digits of the answer.  e.g. 2.36 * 3.649 = 8.61164

  5. And the algorithm for dividing the two floating point numbers is somewhat a mixture of the above two algorithms.
  6. First we have to make the decimal places of numbers same (same as in 1st algorithm) and then we can count the total number of the digits after the dot and then perform simple division operation.
  7. The only change in this algorithm is that we have to multiply the number firstly with a multiplier which is 10000 of any other multiple of 10 so that on division,
  8. We don’t lose any part of the result and we place dot leaving the same number of digits of the result as ‘zeros’ in the multiplier. 
    Try to understand the above paragraph with the following example…
Also Read:  Shortcut Virus Remover ver.2.0 | by Kvc

Division Algorithm Explained

So, finally this Amazing Post ends and if in case you didn’t get anything from the above explanation or like my work about Batch Programming, then please leave me a comment down this post.

Just do leave a comment or An E-mail, even if you don’t like the way I represent things.

If you have any suggestion then you’re most welcome and if this trick helps you in any of your work feel free to say thanks to me’cuz you’ll not lose anything by saying thanks…

Keep learning, keep sharing….
Be happy, spread happiness…


Download Link

Next Post

Previous Post

Leave a Reply

© 2020 TheBATeam

Theme by Anders Norén