Post Reply 
Scientific RPN Calculator (with ATTINY85)
03-09-2018, 10:28 AM
Post: #30
RE: Scientific RPN Calculator (with ATTINY85)
(03-09-2018 09:22 AM)deetee Wrote:  Wow I did not know that my HP35 (disguised as !) calculates gamma instead of faculty. Right now I have implemented the typical for-loop to calculate n!
Can you recommend a smaller formula to calculate gamma other than the Nemes approach (Stirling works for big numbers accurate only).

Nemes is also for large numbers. Lanczos is another commonly used approximation. All are okay. The trick is to make sure the number is large enough:

Code:
double fac = 1;
while (x < too_small) fac *= x++;
...
return fac * result;

The required threshold isn't big but it depends on the approximation used.
You'll want to check the recurrence.


Pauli
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Scientific RPN Calculator (with ATTINY85) - Paul Dale - 03-09-2018 10:28 AM



User(s) browsing this thread: 2 Guest(s)