GL1TCH3D

Floater2

Jan 17th, 2012
488
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.32 KB | None | 0 0
  1. @echo off
  2. Setlocal enabledelayedexpansion
  3.  
  4. :input
  5. set /p x=X:
  6. set /p y=Y:
  7. set /p sign=Operation (+ - * / ):
  8. Ser check=0
  9. call :blergle
  10. goto input
  11.  
  12. :blergle
  13. For /f "delims=. tokens=1,2" %%a in ("%x%") do (
  14. Set int1=%%a
  15. Set float1=%%b
  16. )
  17. For /f "delims=. tokens=1,2" %%a in ("%y%") do (
  18. Set int2=%%a
  19. Set float2=%%b
  20. )
  21. Set a=0
  22. if not defined float1 (
  23. set a=1
  24. goto endbleh1
  25. )
  26. :bleh1
  27. set g=!float1:~%a%,1!
  28. If not defined g goto endbleh1
  29. Set /a a+=1
  30. Goto bleh1
  31. :endbleh1
  32. Set b=0
  33. if not defined float2 (
  34. set b=1
  35. goto endbleh2
  36. )
  37. :bleh2
  38. set f=!float2:~%b%,1!
  39. If not defined f goto endbleh2
  40. Set /a b+=1
  41. Goto bleh2
  42. :endbleh2
  43. set t=0
  44. set h=1
  45. set i=1
  46. set zomg=0
  47. set testnum=%a%
  48. :zomg1
  49. if "%t%"=="%testnum%" goto zomg2
  50. if "%zomg%"=="0" set h=%h%0
  51. if "%zomg%"=="1" set i=%i%0
  52. set /a t+=1
  53. goto zomg1
  54. :zomg2
  55. if "%zomg%"=="%b%" goto zomg3
  56. set t=0
  57. set testnum=%b%
  58. set zomg=1
  59. goto zomg1
  60. :zomg3
  61. set /a tester1=%h%-%i%
  62. set input1=%int1%%float1%
  63. set input2=%int2%%float2%
  64. if %tester1% EQU 0 goto n1
  65. if %tester1% LSS 0 goto l1
  66. if %tester1% GTR 0 goto g1
  67.  
  68. :n1
  69. if "%sign%"=="*" (set /a divisor=%h%*%h%) else (set divisor=%h%)
  70. Goto other
  71. :l1
  72. set add=!i:%h%=!
  73. set input1=%input1%%add%
  74. if "%sign%"=="*" (set /a divisor=%i%*%i%) else (set divisor=%i%)
  75. Goto other
  76. :g1
  77. set add=!h:%i%=!
  78. set input2=%input2%%add%
  79. if "%sign%"=="*" (set /a divisor=%h%*%h%) else (set divisor=%h%)
  80. Goto other
  81. :other
  82. If "%sign%"=="/" (set numerator=%input1%
  83. Set divisor=%input2%
  84. ) else (
  85. set /a numerator=%input1%%sign%%input2%
  86. )
  87. If "%check%"=="0" set odivide=%divisor%
  88. If "%check%"=="1" (set /a nintenger=%numerator%/%divisor%
  89. ) else (
  90. set /a integer=%numerator%/%divisor%
  91. )
  92. If "%check%"=="1" (
  93. set /a remainder=%numerator%-(%ninteger%*%divisor%)
  94. ) else (
  95. set /a remainder=%numerator%-(%integer%*%divisor%)
  96. )
  97. If "%check%"=="1" (
  98. set /a nfloat=(%remainder%*100)/%divisor%
  99. ) else (
  100. set /a float=(%remainder%*100)/%divisor%
  101. )
  102. If "%check%"=="1" (set newfloat=%ninteger%.%nfloat%
  103. ) else (
  104. set result=%integer%.%float%
  105. )
  106. goto newfloat
  107.  
  108. :newfloat
  109. If "%check%"=="1" goto check
  110. echo %result%
  111. Set x=%result%
  112. Set y=%divisor%
  113. Set sign=*
  114. Set check=1
  115. Goto blergle
  116. :check
  117. If "%newfloat%"=="%numerator%" echo %result% & goto input
  118. Set ad=%add%0
  119. Set result=%integer%.%ad%%float%
  120. Set x=%result%
  121. Set y=%odivide%
  122. Goto blergle
Advertisement
Add Comment
Please, Sign In to add comment