[Python-3000] adding gamma and error functions to math module

nirinA raseliarison nirina at mail.blueline.mg
Mon Jul 21 15:16:08 CEST 2008


Terry Reedy
> I'm interested also.  Done and done.
> http://bugs.python.org/issue3366
patch is submitted. it is tested only on linux-2.6.26
with gcc-4.3.1.

Raymond Hettinger
> Discussions of "my approximation is better/faster/etc than yours"
> can be interminable.
> Recommend you put together your favorite approximation in a recipe.
> The one in test.random is suffices well for its purpose.
agreed.

Mark Dickinson
> Are you sure it uses MPFR?
no!
> I thought that for gcc 4.3,MPFR was used only for compile-time
> constant expressions. For a call to tgamma whose argument is
> not known at compile time, the usual libm function should be used.
i understood gcc now uses MPFR, but i missed the "only for compile-time
constant expressions."
thank you for the correction.

Daniel Stutzbach
> The code is a few hundred lines because numeric methods for these
> functions that are accurate in the range [a,b] tend not to be accurate
> outside the range [a,b].  Ergo, robust implementations include several
> different methods so that they are accurate over the entire range of
> the function.
i love codes when they look like mathematical formulae. but most of the
time, these codes are poorly accurate, and i prefer robustness. so now,
i'm not so lazy to read hundred lines of codes.

Mark Dickinson
> As Daniel Stutzbach already hinted, the easiest way to just
> get at the system gamma and error functions, in a platform-dependent
> manner, is probably to use ctypes.
> ...
> Is this enough for your immediate needs?
the other platform i use, and will still use, is a window98!
in this case, the gamma function defined in test_random.py is sufficient.

thanks for your input, guys

nirinA

--



More information about the Python-3000 mailing list