Issue 3501: expm1 missing - Python tracker (original) (raw)

Issue3501

Created on 2008-08-04 22:20 by ms, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (4)
msg70722 - (view) Author: Mike Speciner (ms) Date: 2008-08-04 22:20
The math module contains log1p but is missing expm1 (the inverse of log1p). These functions are necessary to avoid loss of precision in floating point calculations, and are part of the C99 standard math library.
msg70723 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2008-08-04 22:44
Mike, Can you propose an implementation, for those platforms that haven't yet caught up with C99? Something comparable to the implementation of log1p in Python/pymath.c would be appropriate. Ideally, such an implementation would: - be accurate to within a few ulps across the whole domain, - be not too long, and not too slow - have a decent chance of working with strange floating-point formats (Python doesn't assume IEEE 754) - handle IEEE 754 values 'correctly' (i.e., as recommended by Annex F to the C99 standard) It's too late to get this into Python 2.6/3.0, but patches aimed at 2.7 or 3.1 would be welcome.
msg70724 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2008-08-04 23:07
A cheap trick would be to use the identity expm1(x) = 2*exp(x/2)*sinh(x/2) This could also be used in Python as a workaround, for now. But I agree that expm1 should go into the math library.
msg77076 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2008-12-05 21:44
I'm absorbing this issue into issue 3366.
History
Date User Action Args
2022-04-11 14:56:37 admin set github: 47751
2008-12-05 21:44:58 mark.dickinson set status: open -> closedresolution: duplicatesuperseder: Add gamma function, error functions and other C99 math.h functions to math modulemessages: +
2008-08-09 15:27:48 mark.dickinson set priority: normalassignee: mark.dickinsoncomponents: + Extension Modules, - Noneversions: + Python 3.1, Python 2.7, - Python 3.0
2008-08-04 23:07:06 mark.dickinson set messages: +
2008-08-04 22:44:57 mark.dickinson set nosy: + mark.dickinsonmessages: +
2008-08-04 22:20:47 ms create