This is actually quite a bit harder than you might think in a BAT file. Could something be worked up, yes (and as a Math major I like to play with things like this). But math support in BAT is relatively weak, and only integer numbers are supported so any manipulation of decimals has to be performed manually in the BAT script. In addition, numbers are limited to 2^31 in size, so they max out at 2147483647, and so as a result any number larger than 2GB can not be dealt with.

Some approximations can be done and that is what I have typically seen on EE, there are some questions that already have solutions to this, a little searching will likely turn these up.

I often use a couple of standalone EXE utilities that do math for any complex algebra in a BAT script.

http://www.experts-exchang

~bp