John Esraelo
asked on
SQL: Factorial:: large numbers
Hello team,
A non-recursive method in below will give me what I need, however, I would like to have a larger number than 38! and I know that either numeric or decimal can handle +- 38.
Is there a way to use one of the 2 mentioned data types and use all the 72, not using the negative range?
(see attached)
Any assistance will be appreciated.
thx
factorial.png
A non-recursive method in below will give me what I need, however, I would like to have a larger number than 38! and I know that either numeric or decimal can handle +- 38.
Is there a way to use one of the 2 mentioned data types and use all the 72, not using the negative range?
(see attached)
Any assistance will be appreciated.
thx
factorial.png
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I think that if you are working with integers you might try converting all your numbers into right-justified, left-zero-filled varchars and then writing CLR functions in C# for adding, dividing, subtracting and multiplying. You might also search for articles on ASCII arithmetic and BCD.
Good luck!
Mike
Good luck!
Mike
This closed, but the number space of factorials is so small that you could just pre-compute them (or look them up) and store them in a table as strings.
Here they all are from 1 to 256
http://membres.multimania.fr/rsirdey/facttabl.htm
Just put those in the database and look them up. Don't bother doing all the math yourself.
Here they all are from 1 to 256
http://membres.multimania.fr/rsirdey/facttabl.htm
Just put those in the database and look them up. Don't bother doing all the math yourself.
ASKER
I might start looking into some calculations in other bases, such as hex or something.. then convert the result to a character string.