Hewlett-packard / Pavilion hpe

I am making a small calculator in batch, I am a little stuck on the factorial calculating part. My question is: Is there a way to increase the size of a variable (the limit of stuff it can contain), or split up the answer into two or more variables if all the numbers can't fit in one variable? I know factorial numbers tend to become really large. I noticed that if I were to calculate a number (say 52!), the script would return a negative number. Script:

@Echo off

setlocal enabledelayedexpansion

:: Get value

:GetValue

cls

set /p val="Enter a non-decimal value: "

:: Calculate Factorial

set ans1=1

for /l %%A in (1,1,!val!) do (

set /a ans2=!ans1!*%%A

set ans1=!ans2!

)

:: Display Answer

cls

Echo !ans1!

pause > nul

goto GetValueIf infinity is infinite, is the square root of infinity infinite as well?

- Kurp Von Steiner

message edited by RainBawZ

Do you wan to keep the precision as well ? For example, if you have number 7 billion and 44, would you be OK with just 7 billion. In other words, may it be a rounded number ? Hi there.

message edited by User123456789

I prefer not to round it up or down, as it is a "calculator". If there's no other way to do it, I'll make one in C# or C++ instead. If infinity is infinite, is the square root of infinity infinite as well?

- Kurp Von Steiner

Ask Your Question

Weekly Poll