# Increasing variable content limit / splitting variable

Hewlett-packard / Pavilion hpe
April 8, 2014 at 01:52:05
Specs: Windows 7 Professional, 3.6GHz 16GB
 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 offsetlocal enabledelayedexpansion:: Get value:GetValueclsset /p val="Enter a non-decimal value: ":: Calculate Factorialset ans1=1for /l %%A in (1,1,!val!) do ( set /a ans2=!ans1!*%%A set ans1=!ans2!):: Display AnswerclsEcho !ans1!pause > nulgoto GetValueIf infinity is infinite, is the square root of infinity infinite as well?- Kurp Von Steinermessage edited by RainBawZ

See More: Increasing variable content limit / splitting variable

#1
April 21, 2014 at 10:48:56
 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

Report •

#2
April 22, 2014 at 22:56:00
 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

Report •
Related Solutions