Hello all ^-^
Maybe you saw that you can now divide whole integers into floating points from THIS THREAD
But now you can add them using this function!
![[Image: ef1714466b1f4ce94ebbbf770d8edc92.png]](https://gyazo.com/ef1714466b1f4ce94ebbbf770d8edc92.png)
Maybe you saw that you can now divide whole integers into floating points from THIS THREAD
But now you can add them using this function!
![[Image: ef1714466b1f4ce94ebbbf770d8edc92.png]](https://gyazo.com/ef1714466b1f4ce94ebbbf770d8edc92.png)
Code
rem MUST have at least 4 digits behind decimal point
call :floatADD 1.5000 1.2000
call :floatADD 32.6123 51.0932
:floatADD
set "i=0" & for %%a in (%~1 %~2) do set /a "i+=1" & for /f "tokens=1,2 delims=." %%b in ("%%a") do ( set "s!i!=%%b" & set "f!i!=%%c" )
set /a "j=i-1" & for /l %%a in (1,1,!j!) do ( set /a "n=%%a + 1" & for %%b in (!n!) do ( set /a "w=!s%%a! + !s%%b!", "f=(1!f%%a! + 1!f%%b!) - 20000" ) )
if !f! gtr 10000 set /a "w=!w! + !f:~0,1!" & set "f=!f:~1!"
if "!f:~3!" equ "" set "f=0!f!"
if "%~3" neq "" ( set "%~3=!w!.!f!" ) else ( echo %~1 + %~2 = !w!.!f! )
goto :eof
