Advertisement
hidde663

escape32bit-INT-limit.bat

Sep 27th, 2018
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.64 KB | None | 0 0
  1. @echo off&setlocal enabledelayedexpansion
  2. ::attempting to pass the 32bit integer limit of batch
  3. ::current highest number generated:
  4. ::Bit-[64]==9223372036854775808
  5. set dec-1-result=1
  6. for /l %%a in (2,1,64) do (
  7. set dec-%%a-result=0
  8. set acc1=
  9. set acc2=
  10. set acc3=
  11. set/a lastbit=%%a-1
  12. call :getworkingdigit !lastbit!
  13. set l=0
  14. set "s=!workingdigit!#"
  15. for %%P in (16 8 4 2 1) do (
  16. if "!s:~%%P,1!" NEQ "" (
  17. set/a "l+=%%P"
  18. set "s=!s:~%%P!"
  19. )
  20. )
  21. set "lastdeclen=!l!"
  22. set totalacc=1
  23. if !lastdeclen! GEQ 8 (
  24. set/a modleft=!lastdeclen!%8
  25. set/a mod=!lastdeclen!/8
  26. if not "!modleft!"=="0" (
  27. set/a totalacc=!mod!+1
  28. ) else (
  29. set totalacc=!mod!
  30. )
  31. )
  32. for /l %%A in (1,1,!totalacc!) do (
  33. set "acc%%A=!workingdigit:~-8!"
  34. set "workingdigit=!workingdigit:~,-8!"
  35. )
  36. set acc-carry=0
  37. for /l %%1 in (1,1,!totalacc!) do (
  38. set zero=0
  39. if "!acc%%1:~0,1!"=="0" (
  40. set zero=1
  41. set acc%%1=!acc%%1:~1!
  42. )
  43. set/a acc%%1*=2
  44. set/a acc%%1+=!acc-carry!
  45. if !zero!==1 (
  46. if !acc%%1! GTR 9999999 (
  47. set acc%%1=1!acc%%1!
  48. ) else (
  49. set acc%%1=0!acc%%1!
  50. )
  51. )
  52. set acc-carry=0
  53. if not !zero!==1 (
  54. if !acc%%1! GTR 99999999 (
  55. set acc-carry=1
  56. )
  57. )
  58. set acc%%1=!acc%%1:~-8!
  59. )
  60. set dec-%%a-result=!acc3!!acc2!!acc1!
  61. if "!dec-%%a-result:~0,1!"=="0" (
  62. set dec-%%a-result=!dec-%%a-result:~1!
  63. )
  64. if "!dec-%%a-result:~0,1!"=="0" (
  65. set dec-%%a-result=!dec-%%a-result:~1!
  66. )
  67. )
  68. for /l %%a in (1,1,64) do (
  69. if %%a LEQ 9 (
  70. echo Bit-[0%%a]==!dec-%%a-result!
  71. ) else (
  72. echo Bit-[%%a]==!dec-%%a-result!
  73. )
  74. )
  75. exit/b
  76. :getworkingdigit
  77. set workingdigit=!dec-%1-result!
  78. exit/b
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement