https://zhidao.baidu.com/question/180631496511289124.html?qbl=relate_question_1&word=bat%20%C1%BD%CE%BB%CA%FD%CF%E0%B3%FD%20%D0%A1%CA%FD%B5%E3%20set
It should be said bat only a simple calculation and calculation formula can only be an integer, a direct result of the small number of part been discarded
but first need to find ways to expand the number of decimal places is an integer, decimal values to obtain the required post-processing of the string, For example 11/3 calculated to two decimal places (the 5 round 4)
@echo OFF
SET / AA =. 11, B =. 3, X = A / B
echo direct calculations rounding:% a% ÷% b% =% x %
SET / A2 = A * 1000 A
SET / AX = A2 / B + 5
SET X =% X: ~,% -3% X:. ~%-3,2
echo precise (4 rounded into 5) to two decimal:% A% B% ÷% X% =%
PAUSE
===== one decimal place
set x=%x:~,-2%.%x:~-2,1%
REM Select two decimal digits for all operations SET /A VAR=250+310 ECHO RESULT: %VAR:~0,-2%.%VAR:~-2%
rem Set "ONE" variable with two decimal places:
SET ONE=100
rem To multiply two FP numbers, divide the result by ONE:
SET /A MUL=A*B/ONE
rem To divide two FP numbers, multiply the first by ONE:
SET /A DIV=A*ONE/B
https://stackoverflow.com/questions/25951196/set-command-floating-point-numbers?noredirect=1