Category : Files from Magazines
Archive   : VOL11N13.ZIP
Filename : DIV.BAT

 
Output of file : DIV.BAT contained in archive : VOL11N13.ZIP
echo off
cls
if %1!==! goto instr
echo Calculations are in PROGRESS!
strings /p~ decpos2 = find ~~%2~.
if not %decpos2%==0 goto havdec2
set num2=%2
goto getone
:havdec2
strings decpos2 = sub %decpos2%,1
strings num2 = left %2,%decpos2%
strings decpos2 = add %decpos2%,2
strings dec2 = mid %2,%decpos2%,128
strings decpl2 = length %dec2%
set num2=%num2%%dec2%
:getone
strings /p~ decpos1 = find ~~%1~.
if not %decpos1%==0 goto havdec1
set num1=%1
goto chkdpl
:havdec1
strings decpos1 = sub %decpos1%,1
strings num1 = left %1,%decpos1%
strings decpos1 = add %decpos1%,2
strings dec1 = mid %1,%decpos1%,128
strings decpl1 = length %dec1%
set num1=%num1%%dec1%
:chkdpl
strings sub %num1%,%num2% > nul
if not errorlevel 1 goto addk
strings num1 = mul %num1%,10
strings decpl1 = add %decpl1%,1
goto chkdpl
:addk
strings #decpl = sub %decpl1%,%decpl2% > nul
if errorlevel 1 goto mult
if not %#decpl%==0 if not %#decpl%==1 if not %#decpl%==2 goto divide
:mult
strings num1 = mul %num1%,10
strings decpl1 = add %decpl1%,1
goto addk
:divide
strings answer = div %num1%,%num2%
:getlen
strings len = length %answer%
strings sub %len%,%#decpl% > nul
if not errorlevel 1 goto getint
set answer=0%answer%
goto getlen
:getint
strings intlen = sub %len%,%#decpl%
strings int = left %answer%,%intlen%
strings decml = right %answer%,%#decpl%
if %int%!==! set int=0
set answer=%int%.%decml%
echo %1 / %2 = %answer%
set answer=
set int=
set decml=
set intlen=
set num1=
set num2=
set #decpl=
set decpl1=
set decpl2=
set dec1=
set dec2=
set decpos1=
set decpos2=
set len=
goto end
:instr
echo / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / /
echo.
echo Enter the numbers after %0; dividend followed by divisor,
echo.
echo such as DIV 20.5 .25
echo.
echo The quotient will have at least 3 places of decimal (default).
echo If you wish more, add zeros in the decimal place of the dividend.
echo.
echo / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / /
:end
echo.
echo.
:end


  3 Responses to “Category : Files from Magazines
Archive   : VOL11N13.ZIP
Filename : DIV.BAT

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/