Advertisement
Guest User

Judago str_math.bat v1.7

a guest
May 1st, 2016
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 14.62 KB | None | 0 0
  1. @ECHO Off
  2. SETLOCAL ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION
  3. if "%~3"=="" (
  4.     echo.
  5.     echo STR_MATH.BAT v1.7
  6.     echo.
  7.     echo.   Large number and floating point work around script for Addition,
  8.     echo.   Subtraction, Division, Multiplaction and Modulus. Floating point
  9.     echo.   and negitive numbers supported.
  10.     echo.
  11.     echo.   Usage:
  12.     echo.     STR_MATH.BAT {Number} {+-XM} {Number}
  13.     echo.     STR_MATH.BAT {Number} / {Number} [n max decimal places]
  14.     echo.
  15.     echo.   Division defaults to a maximum ten decimal places of output.
  16.     echo.   An optional user defined max can be input as the fourth number.
  17.     echo.   No rounding is performed on output of division, the number is
  18.     echo.   only truncated. For example a result of 0.1257 with three places
  19.     echo.   will return 0.125 NOT 0.126.
  20.     echo.
  21.     echo.   Modulous results of negitive numbers seem to match Powershell
  22.     echo.   but are not garanteed.
  23.     echo.
  24.     echo.   Output Will be echo'd, a "for /f" loop can be used to
  25.     echo.   capture the output. An example is as follows, be sure
  26.     echo.   NOT to use the /A switch to SET if using a variable.
  27.     echo.    
  28.     echo.     FOR /F %%A IN ^(' STR_MATH.BAT 50.265 X 1.36 '^) DO SET RESULT=%%A
  29.     echo.
  30.     echo.   Variables must be expanded when passed to the script, like so:
  31.     echo.
  32.     echo.     FOR /F %%A IN ^(' STR_MATH.BAT %%number1%% / %%number2%% '^) DO SET RESULT=%%A
  33.     echo.
  34.     echo.   Judago  2011 ^& 2015- Retrived from Dave Samuels and edited to bring
  35.     echo.   it back in line with the original version and added Modulous.
  36.     goto :eof
  37. )
  38.    
  39.  
  40.  
  41.  
  42. set _INP_NUM1=
  43. set _INP_NUM2=
  44. set _INP_NEG1=
  45. set _INP_NEG2=
  46. set _INP_OP=
  47. set "_INP_NUM1=%~1"
  48. set "_INP_NUM2=%~3"
  49. set "_INP_OP=%~2"
  50. if /i "%~2"=="*" (
  51.     set _INP_OP=x
  52. )
  53. if /i "%~2"=="%%" (
  54.     set _INP_OP=m
  55. )
  56.  
  57.    
  58. rem Default number of digits for division
  59. set _DIV_DP=10
  60.  
  61.  
  62.  
  63. rem ***** Start Input validation *****
  64.  
  65. if "%~2"=="/" if not "%~4"=="" (
  66.      for /f "delims=0123456789 tokens=1*" %%a in ("A0%~4") do (
  67.         if "%%b"=="" (
  68.             for /f "tokens=1* delims=0" %%c in ("A0%~4") do (
  69.                 if "%%d"=="" (
  70.                     set _DIV_DP=0
  71.                 ) else set _DIV_DP=%%d
  72.             )
  73.         ) else (
  74.             1>&2 Echo ERROR: "%~4" not detected as a valid number of decimal places
  75.             goto :eof
  76.         )
  77.     )
  78.     shift /4
  79. )
  80.        
  81. if not "%~4"=="" (
  82.     1>&2 echo ERROR: Too many arguments: "%~4"
  83.     goto :eof
  84. )
  85. if not defined _INP_NUM1 (
  86.     1>&2 echo ERROR: Invalid Input: "!_INP_NUM1!"
  87.     goto :eof
  88. )
  89. if not defined _INP_NUM2 (
  90.     1>&2 echo ERROR: Invalid Input: "!_INP_NUM2!"
  91.     goto :eof
  92. )
  93. if not defined _INP_OP (
  94.     1>&2 echo ERROR: Invalid Operator: "!_INP_OP!"
  95.     goto :eof
  96. )
  97. if not "!_INP_OP:~1!"=="" (
  98.     1>&2 echo ERROR: Invalid Operator: "!_INP_OP!"
  99.     goto :eof
  100. )
  101.  
  102. rem ***** / ***** Start Negitive input ***** \ *****
  103. for %%a in (1 2) do (
  104. if "!_INP_NUM%%a:~0,1!"=="-" if not "!_INP_NUM%%a:~1!"=="" (
  105.         set _INP_NUM%%a=!_INP_NUM%%a:~1!
  106.         set _INP_NEG%%a=-
  107.     ) else (
  108.         1>&2 echo ERROR: Invalid input: "!_INP_NUM%%a!"
  109.         goto :eof
  110.     )
  111. )
  112. rem ***** \ ***** End Negitive input ***** / *****
  113.  
  114. for /f "tokens=1* delims=0123456789." %%a in ("A0!_INP_NUM1!!_INP_NUM2!") do (
  115.     if not "%%b"=="" (
  116.         1>&2 echo ERROR: Invalid input: "!_INP_NUM1!" **OR** "!_INP_NUM2!"
  117.         goto :eof
  118.     )
  119. )
  120. for %%a in (1 2) do (
  121.     for /f "tokens=1-3 delims=." %%b in ("0!_INP_NUM%%a!0") do (
  122.         if not "%%d"=="" (
  123.             1>&2 echo ERROR: Invalid input: "!_INP_NUM%%a!"
  124.             goto :eof
  125.         )
  126.     )
  127. )
  128. for /f "tokens=1* delims=/Xx+-mM" %%a in ("A+!_INP_OP!") do (
  129.     if not "%%b"=="" (
  130.         1>&2 echo ERROR: Invalid operator: "!_INP_OP!"
  131.         goto :eof
  132.     )
  133. )
  134.  
  135. rem ***** End input validation *****
  136.  
  137. rem ***** Start Remove leading zero's / Return for zero sums  *****
  138. for %%a in (1 2) do (
  139.     for /f "tokens=1* delims=0" %%b in ("A0!_INP_NUM%%a!") do (
  140.         if "%%c"=="" (
  141.             if /i "!_INP_OP!"=="x" echo 0
  142.             if "!_INP_OP!"=="/" (
  143.                 if %%a==2 (
  144.                     1>&2 Echo ERROR: Divide by zero
  145.                     goto :eof
  146.                 ) else echo 0
  147.             )
  148.             if /i "!_INP_OP!"=="m" (
  149.                 if %%a==2 (
  150.                     1>&2 Echo ERROR: Divide by zero
  151.                     goto :eof
  152.                 ) else echo 0
  153.             )
  154.             if "!_INP_OP!"=="-" (
  155.                 if %%a==1 (
  156.                     if defined _INP_NEG2 (
  157.                         echo !_INP_NUM2!
  158.                     ) else echo -!_INP_NUM2!
  159.                 ) else (
  160.                     echo !_INP_NEG1!!_INP_NUM1!
  161.                 )
  162.             )
  163.             if "!_INP_OP!"=="+" (
  164.                 if %%a==1 (
  165.                     echo !_INP_NEG2!!_INP_NUM2!
  166.                 ) else echo !_INP_NEG1!!_INP_NUM1!
  167.             )
  168.             goto :eof
  169.         ) else set _INP_NUM%%a=%%c
  170.     )
  171. )
  172. rem ***** End Remove leading zero's / Return for zero sums *****
  173.  
  174. rem ***** Start Floating point normalisation *****
  175. for %%a in (1 2) do (
  176.     if "!_INP_NUM%%a:~0,1!"=="." set _INP_NUM%%a=0!_INP_NUM%%a!
  177.     if "!_INP_NUM%%a:~-1!"=="." set _INP_NUM%%a=!_INP_NUM%%a!0
  178.     for /l %%b in (0 1 9) do set _INP_NUM%%a=!_INP_NUM%%a:%%b=%%b !
  179.     for %%c in (!_INP_NUM%%a!) do set /a _INP_LEN%%a+=1
  180.     set _INP_NUM%%a=!_INP_NUM%%a: =!
  181.     if "!_INP_NUM%%a!"=="!_INP_NUM%%a:.=!" (
  182.         set _INP_DP%%a=0
  183.     ) else (
  184.         for /l %%d in (!_INP_LEN%%a! -1 1) do (
  185.             if not defined _INP_DP%%a if "!_INP_NUM%%a:~%%d,1!"=="." (
  186.                 set /a _INP_DP%%a=!_INP_LEN%%a! - %%d
  187.             )
  188.         )
  189.     )
  190.     set _INP_NUM%%a=!_INP_NUM%%a:.=!
  191. )
  192.  
  193. if !_INP_DP1! gtr !_INP_DP2! (
  194.     set /a _INP_DP=_INP_DP1 - 1
  195. ) else set /a _INP_DP=_INP_DP2 - 1
  196. for /l %%a in (!_INP_DP1! 1 !_INP_DP!) do set _INP_NUM1=!_INP_NUM1!0
  197. for /l %%a in (!_INP_DP2! 1 !_INP_DP!) do set _INP_NUM2=!_INP_NUM2!0
  198. rem ***** End Floating point normalisation *****
  199.  
  200. rem ***** Start Negitive output checking *****
  201. if /i "!_INP_OP!"=="x" (
  202.     if "!_INP_NEG1!!_INP_NEG2!"=="-" set _INP_NEG=-
  203. ) else if "!_INP_OP!"=="+" (
  204.     if "!_INP_NEG1!!_INP_NEG2!"=="--" set _INP_NEG=-
  205.     if defined _INP_NEG2 if not defined _INP_NEG1 (
  206.         call :isgreater !_INP_NUM1! !_INP_NUM2!
  207.         if "!_GTR_RES!"=="3" (
  208.             set _INP_NUM1=%_INP_NUM2%
  209.             set _INP_NUM2=%_INP_NUM1%
  210.             set _INP_NEG=-
  211.         )
  212.         set _INP_OP=-
  213.     )
  214.     if defined _INP_NEG1 if not defined _INP_NEG2 (
  215.         call :isgreater !_INP_NUM1! !_INP_NUM2!
  216.         if "!_GTR_RES!"=="3" (
  217.             set _INP_NUM1=%_INP_NUM2%
  218.             set _INP_NUM2=%_INP_NUM1%
  219.         ) else if "!_GTR_RES!"=="1" set _INP_NEG=-
  220.         set _INP_OP=-
  221.     )
  222. ) else if "!_INP_OP!"=="-" (
  223.     if "!_INP_NEG1!!_INP_NEG2!"=="" (
  224.         call :isgreater !_INP_NUM1! !_INP_NUM2!
  225.         if "!_GTR_RES!"=="3" (
  226.             set _INP_NUM1=%_INP_NUM2%
  227.             set _INP_NUM2=%_INP_NUM1%
  228.             set _INP_NEG=-
  229.         )
  230.     )
  231.     if "!_INP_NEG1!!_INP_NEG2!"=="--" (
  232.         call :isgreater !_INP_NUM1! !_INP_NUM2!
  233.         if "!_GTR_RES!"=="3" (
  234.             set _INP_NUM1=%_INP_NUM2%
  235.             set _INP_NUM2=%_INP_NUM1%
  236.         ) else if "!_GTR_RES!"=="1" set _INP_NEG=-
  237.     )
  238.     if defined _INP_NEG2 if not defined _INP_NEG1 set _INP_OP=+
  239.     if defined _INP_NEG1 if not defined _INP_NEG2 (
  240.         set _INP_NEG=-
  241.         set _INP_OP=+
  242.     )
  243. ) else if "!_INP_OP!"=="/" (
  244.     if "!_INP_NEG1!!_INP_NEG2!"=="--" set _INP_NEG=
  245.     if "!_INP_NEG1!!_INP_NEG2!"=="-"  set _INP_NEG=-
  246. ) else if /i "!_INP_OP!"=="M" (
  247.     if defined _INP_NEG1 set _INP_NEG=-
  248. )
  249.  
  250. rem ***** End Negitive output checking *****
  251.  
  252. if "!_INP_OP!"=="-" goto subtract
  253. if "!_INP_OP!"=="+" goto add
  254. if /i "!_INP_OP!"=="X" goto multiply
  255. if /i "!_INP_OP!"=="m" goto divide
  256. if "!_INP_OP!"=="/" goto divide
  257.  
  258. 1>&2 Echo ERROR: OPERATER "!_INP_OP!" is not known!
  259. goto :eof
  260.  
  261.  
  262. :SUBTRACT
  263. if "%~1"=="@" (
  264.     set _SUB_NUM1=%~2
  265.     set _SUB_NUM2=%~3
  266. ) else (
  267.     set _SUB_NUM1=!_INP_NUM1!
  268.     set _SUB_NUM2=!_INP_NUM2!
  269. )
  270. for %%a in (CHA RES LEN1 LEN2 CAR TOT) do set _SUB_%%a=
  271. for %%a in (1 2) do (
  272.     for /l %%b in (0 1 9) do set _SUB_NUM%%a=!_SUB_NUM%%a:%%b=%%b !
  273.     for %%c in (!_SUB_NUM%%a!) do set /a _SUB_LEN%%a+=1
  274.     set _SUB_NUM%%a=!_SUB_NUM%%a: =!
  275. )
  276. if !_SUB_LEN1! gtr !_SUB_LEN2! (
  277.     set /a _SUB_LEN=_SUB_LEN1 - 1
  278. ) else set /a _SUB_LEN=_SUB_LEN2 - 1
  279. for /l %%b in (!_SUB_LEN1! 1 !_SUB_LEN!) do set _SUB_NUM1=0!_SUB_NUM1!
  280. for /l %%b in (!_SUB_LEN2! 1 !_SUB_LEN!) do set _SUB_NUM2=0!_SUB_NUM2!
  281. for /l %%a in (!_SUB_LEN! -1 0) do (
  282.     set /a _SUB_RES=!_SUB_NUM1:~%%a,1! - !_SUB_NUM2:~%%a,1!
  283.     if !_SUB_RES! lss 0 (
  284.         set _SUB_TAKE=
  285.         for /l %%b in (%%a -1 0) do if not defined _SUB_TAKE (
  286.             if not "%%b"=="%%a" (
  287.                 if not "!_SUB_NUM1:~%%b,1!"=="0" (
  288.                     set /a _SUB_CHA=!_SUB_NUM1:~%%b,1! - 1
  289.                     set /a _SUB_TAKE=%%b + 1
  290.                     for %%c in (!_SUB_TAKE!) do set _SUB_NUM1=!_SUB_NUM1:~0,%%b!!_SUB_CHA!!_SUB_NUM1:~%%c!
  291.                     set /a _SUB_RES=1!_SUB_NUM1:~%%a,1! - !_SUB_NUM2:~%%a,1!
  292.  
  293.                 ) else (
  294.                     set /a _SUB_CHA=%%b + 1
  295.                     for %%c in (!_SUB_CHA!) do set _SUB_NUM1=!_SUB_NUM1:~0,%%b!9!_SUB_NUM1:~%%c!
  296.                 )
  297.             )
  298.         )
  299.     )
  300.     set _SUB_TOT=!_SUB_RES!!_SUB_TOT!
  301. )
  302. for /f "tokens=1* delims=0" %%a in ("A0!_SUB_TOT!") do set _SUB_TOT=%%b
  303. if not defined _SUB_TOT set _SUB_TOT=0
  304. if not "%~1"=="@" (
  305.     call :FINISH _SUB_TOT
  306.     echo %_INP_NEG%!_SUB_TOT!
  307. )
  308.  
  309. goto :eof
  310.  
  311.  
  312. :ADD
  313. if /I "%~1"=="@" (
  314.     set _ADD_NUM1=%~2
  315.     set _ADD_NUM2=%~3
  316. ) else (
  317.     set _ADD_NUM1=!_INP_NUM1!
  318.     set _ADD_NUM2=!_INP_NUM2!
  319. )
  320. for %%a in (LEN1 LEN2 CAR TOT) do set _ADD_%%a=
  321. for %%a in (1 2) do (
  322.     for /l %%b in (0 1 9) do set _ADD_NUM%%a=!_ADD_NUM%%a:%%b=%%b !
  323.     for %%c in (!_ADD_NUM%%a!) do set /a _ADD_LEN%%a+=1
  324.     set _ADD_NUM%%a=!_ADD_NUM%%a: =!
  325. )
  326. if !_ADD_LEN1! gtr !_ADD_LEN2! (
  327.     set /a _ADD_LEN=_ADD_LEN1 - 1
  328. ) else set /a _ADD_LEN=_ADD_LEN2 - 1
  329. for /l %%b in (!_ADD_LEN1! 1 !_ADD_LEN!) do set _ADD_NUM1=0!_ADD_NUM1!
  330. for /l %%b in (!_ADD_LEN2! 1 !_ADD_LEN!) do set _ADD_NUM2=0!_ADD_NUM2!
  331. for /l %%a in (!_ADD_LEN! -1 0) do (
  332.     set /a _ADD_CAR=_ADD_CAR + !_ADD_NUM1:~%%a,1! + !_ADD_NUM2:~%%a,1!
  333.     set _ADD_TOT=!_ADD_CAR:~-1!!_ADD_TOT!
  334.     set _ADD_CAR=!_ADD_CAR:~0,-1!
  335.     if not defined _ADD_CAR set _ADD_CAR=0
  336. )
  337. if !_ADD_CAR! gtr 0 set _ADD_TOT=!_ADD_CAR!!_ADD_TOT!
  338. if not "%~1"=="@" (
  339.     Call :FINISH _ADD_TOT
  340.     echo %_INP_NEG%!_ADD_TOT!
  341. )
  342.  
  343. goto :eof
  344.  
  345.  
  346. :MULTIPLY
  347. set /a _INP_DP=(_INP_DP * 2) + 1
  348. set _MUL_NUM1=!_INP_NUM1!
  349. set _MUL_NUM2=!_INP_NUM2!
  350. for %%a in (CAR TOT) do set _MUL_%%a=0
  351. for %%a in (X10 REV1 REV2) do set _MUL_%%a=
  352. for %%a in (1 2) do (
  353.     for /l %%b in (0 1 9) do set _MUL_NUM%%a=!_MUL_NUM%%a:%%b=%%b !
  354.     for %%c in (!_MUL_NUM%%a!) do set _MUL_REV%%a=%%c !_MUL_REV%%a!
  355. )
  356. for %%a in (!_MUL_REV1!) do (
  357.     set _MUL_ROW=!_MUL_X10!
  358.     for %%b in (!_MUL_REV2!) do (
  359.         set /a _MUL_CAR=^(%%a * %%b^) + _MUL_CAR
  360.         set _MUL_ROW=!_MUL_CAR:~-1!!_MUL_ROW!
  361.         set _MUL_CAR=!_MUL_CAR:~0,-1!
  362.         if not defined _MUL_CAR set _MUL_CAR=0
  363.     )
  364.     for /f "tokens=1* delims=0" %%c in ("A0!_MUL_CAR!!_MUL_ROW!") do (
  365.         if not "%%d"=="" (
  366.             call :ADD @ %%d !_MUL_TOT!
  367.             set _MUL_TOT=!_ADD_TOT!
  368.         )
  369.     )
  370.     set _MUL_CAR=
  371.     set _MUL_X10=!_MUL_X10!0
  372. )
  373. Call :FINISH _MUL_TOT
  374. echo %_INP_NEG%!_MUL_TOT!
  375. goto :eof
  376.  
  377. :DIVIDE
  378. for %%a in (DONE LEN1 LEN2 X10 PAD) do set _DIV_%%a=
  379. if /i not "%_INP_OP%"=="m" (
  380.     for /l %%a in (1 1 %_DIV_DP%) do set _DIV_PAD=0!_DIV_PAD!
  381.     set /a _INP_DP=_DIV_DP - 1
  382. )
  383. set _DIV_NUM1=!_INP_NUM1!!_DIV_PAD!
  384. set _DIV_NUM2=!_INP_NUM2!
  385. set _DIV_TOT=0
  386. set _DIV_LOOP=10
  387. for %%a in (1 2) do (
  388.     for /f "tokens=1* delims=0" %%d in ("A0!_DIV_NUM%%a!") do set _DIV_NUM%%a=%%e
  389.     for /l %%b in (0 1 9) do set _DIV_NUM%%a=!_DIV_NUM%%a:%%b=%%b !
  390.     for %%c in (!_DIV_NUM%%a!) do set /a _DIV_LEN%%a+=1
  391.     set _DIV_NUM%%a=!_DIV_NUM%%a: =!
  392. )
  393. set /a _DIV_LEN1-=1
  394. for /l %%a in (!_DIV_LEN2! 1 !_DIV_LEN1!) do (
  395.     set _DIV_X10=0!_DIV_X10!
  396.     set /a _DIV_LOOP+=10
  397. )
  398. for /l %%a in (0 1 !_DIV_LOOP!) do (
  399.     if not defined _DIV_DONE (
  400.         call :ISGREATER !_DIV_NUM1! !_DIV_NUM2!!_DIV_X10!
  401.         if !_GTR_RES! leq 2 (
  402.             call :SUBTRACT @ !_DIV_NUM1! !_DIV_NUM2!!_DIV_X10!
  403.             set _DIV_NUM1=!_SUB_TOT!
  404.             call :ADD @ !_DIV_TOT! 1!_DIV_X10!
  405.             set _DIV_TOT=!_ADD_TOT!
  406.         ) else if defined _DIV_X10 (
  407.             set _DIV_X10=!_DIV_X10:~1!
  408.         ) else set _DIV_DONE=1
  409.     )
  410. )
  411. if /i "%_INP_OP%"=="m" set _DIV_TOT=!_DIV_NUM1!
  412. Call :finish _DIV_TOT
  413. if "!_DIV_TOT!"=="0" (
  414.     echo 0
  415.     if /i not "%_INP_OP%"=="m" 1>&2 echo ERROR: Insufficient decimal places^(!_DIV_DP!^)
  416. ) else (
  417.     echo !_INP_NEG!!_DIV_TOT!
  418. )
  419. Goto :eof
  420.  
  421.  
  422. :FINISH
  423. set _FIN_NUM=!%~1!
  424. set _FIN_FLAG=
  425. if not defined _INP_DP (
  426.     set _INP_DP=0
  427. ) else set /a _INP_DP+=1
  428. if not "!_INP_DP!"=="0" (
  429.     for /l %%a in (1 1 !_INP_DP!) do if "!_FIN_NUM:~%_INP_DP%!"=="" set _FIN_NUM=0!_FIN_NUM!
  430.     set _FIN_NUM=!_FIN_NUM:~0^,-%_INP_DP%!.!_FIN_NUM:~-%_INP_DP%!
  431.     for /l %%a in (!_INP_DP! -1 1) do (
  432.         if "!_FIN_NUM:~-1!"=="0" set _FIN_NUM=!_FIN_NUM:~0^,-1!
  433.         if "!_FIN_NUM:~-1!"=="." set _FIN_NUM=!_FIN_NUM:~0^,-1!
  434.     )
  435. )
  436. for /f "tokens=1* delims=0" %%a in ("A0!_FIN_NUM!") do (
  437.     if "%%b"=="" (
  438.         set _FIN_NUM=0
  439.     ) else set _FIN_NUM=%%b
  440. )
  441. if "!_FIN_NUM:~0,1!"=="." set _FIN_NUM=0!_FIN_NUM!
  442. IF NOT DEFINED _FIN_NUM SET _FIN_NUM=0
  443. set %1=!_FIN_NUM!
  444. goto :eof
  445.  
  446.  
  447. :ISGREATER
  448. set _GTR_RES=2
  449. for /f "tokens=1* delims=0" %%a in ("A0%~1") do (
  450.     if "%%b"=="" (
  451.         set _GTR_NUM1=0
  452.     ) else set _GTR_NUM1=%%b
  453. )
  454. for /f "tokens=1* delims=0" %%a in ("A0%~2") do (
  455.     if "%%b"=="" (
  456.         set _GTR_NUM2=0
  457.     ) else set _GTR_NUM2=%%b
  458. )
  459. for %%a in (lEN1 lEN2) do set _GTR_%%a=
  460. for %%a in (1 2) do (
  461.     for /l %%b in (0 1 9) do set _GTR_NUM%%a=!_GTR_NUM%%a:%%b=%%b !
  462.     for %%c in (!_GTR_NUM%%a!) do set /a _GTR_lEN%%a+=1
  463.     set _GTR_NUM%%a=!_GTR_NUM%%a: =!
  464. )
  465. if !_GTR_lEN1! gtr !_GTR_lEN2! (
  466.     set _GTR_RES=1
  467. ) else if !_GTR_lEN2! gtr !_GTR_lEN1! (
  468.     set _GTR_RES=3
  469. ) else (
  470.     set /a _GTR_lEN1-=1
  471.     for /l %%a in (0 1 !_GTR_lEN1!) do (
  472.         if not defined _GTR_RES (
  473.             if !_GTR_NUM1:~%%a^,1! gtr !_GTR_NUM2:~%%a^,1! set _GTR_RES=1
  474.             if !_GTR_NUM2:~%%a^,1! gtr !_GTR_NUM1:~%%a^,1! set _GTR_RES=3
  475.         )
  476.     )
  477. )
  478. goto :eof
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement