GlobalAccessSoftware icon

exponential_powers.bat

GlobalAccessSoftware | PRO | 11/16/23 05:33:27 AM UTC | 0 ⭐ | 13561 👁️ | Never ⏰ | []
Batch |

900 B

|

Software

|

0 👍

/

0 👎

 
 
::: RC8
 
  if not defined vers set vers=v8.5.7.84
 
::: SAMPLE USAGE and Function
::: set /a base=10 & set /a exponent=5
::: set fn="%bats%\exponential_powers.bat"
::: call %fn% answer %baseNum% %exponent%
::: echo . & echo The Answer for 10\5 is: %answer%.
::: echo . & pause & echo .
 
::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:powers <intVar rslt, intVar base, intVar expo>
  setlocal
  set rslt=%~1 & set base=%~2
  set expo=%~3 & set /a answ=1
  for /l %%n in (1, 1, %expo%) do (
    if %answ% gtr 2147483647 pause & break
    if %answ% leq 0 pause & break
    set /a answ*=%base%
    )
  if %answ% gtr 2147483647 (
    goto oops ) else (
      if %answ% leq 0 goto oops )
:end
  endlocal & set %~1=%answ% 
  exit /b %errorlevel%
::::::::::::::::::::::::::::::::::::::::::::::::::::::::
 
:oops
  set answ=That number is out of range.
  goto end
 
 
  :::  100%  -JpE-
 

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎