Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @echo off&setlocal enabledelayedexpansion
- ::attempting to pass the 32bit integer limit of batch
- ::current highest number generated:
- ::Bit-[64]==9223372036854775808
- set dec-1-result=1
- for /l %%a in (2,1,64) do (
- set dec-%%a-result=0
- set acc1=
- set acc2=
- set acc3=
- set/a lastbit=%%a-1
- call :getworkingdigit !lastbit!
- set l=0
- set "s=!workingdigit!#"
- for %%P in (16 8 4 2 1) do (
- if "!s:~%%P,1!" NEQ "" (
- set/a "l+=%%P"
- set "s=!s:~%%P!"
- )
- )
- set "lastdeclen=!l!"
- set totalacc=1
- if !lastdeclen! GEQ 8 (
- set/a modleft=!lastdeclen!%8
- set/a mod=!lastdeclen!/8
- if not "!modleft!"=="0" (
- set/a totalacc=!mod!+1
- ) else (
- set totalacc=!mod!
- )
- )
- for /l %%A in (1,1,!totalacc!) do (
- set "acc%%A=!workingdigit:~-8!"
- set "workingdigit=!workingdigit:~,-8!"
- )
- set acc-carry=0
- for /l %%1 in (1,1,!totalacc!) do (
- set zero=0
- if "!acc%%1:~0,1!"=="0" (
- set zero=1
- set acc%%1=!acc%%1:~1!
- )
- set/a acc%%1*=2
- set/a acc%%1+=!acc-carry!
- if !zero!==1 (
- if !acc%%1! GTR 9999999 (
- set acc%%1=1!acc%%1!
- ) else (
- set acc%%1=0!acc%%1!
- )
- )
- set acc-carry=0
- if not !zero!==1 (
- if !acc%%1! GTR 99999999 (
- set acc-carry=1
- )
- )
- set acc%%1=!acc%%1:~-8!
- )
- set dec-%%a-result=!acc3!!acc2!!acc1!
- if "!dec-%%a-result:~0,1!"=="0" (
- set dec-%%a-result=!dec-%%a-result:~1!
- )
- if "!dec-%%a-result:~0,1!"=="0" (
- set dec-%%a-result=!dec-%%a-result:~1!
- )
- )
- for /l %%a in (1,1,64) do (
- if %%a LEQ 9 (
- echo Bit-[0%%a]==!dec-%%a-result!
- ) else (
- echo Bit-[%%a]==!dec-%%a-result!
- )
- )
- exit/b
- :getworkingdigit
- set workingdigit=!dec-%1-result!
- exit/b
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement