WP34s: Gamma function for x very close to zero
|
10-04-2015, 12:52 PM
(This post was last modified: 10-04-2015 01:49 PM by Dieter.)
Post: #1
|
|||
|
|||
WP34s: Gamma function for x very close to zero
I just found what I think is a glitch in the WP34s Gamma function: arguments very close to zero can cause the calculator to hang and/or throw an error.
Code: 1E-10 Γ OK I assume this is because somewhere in the code (using 39 digit precision) 1+some_small_value rounds to 1. But there is a simple fix: If |x|<1E–20 simply evaluate \(\Gamma(x) \approx \frac{1}{x}-\gamma_{EM}\). The absolute value of the relative error here is < 1E–40, so the result is as least as accurate as the internal 39 digit routine. Dieter |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)