Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide expm1 and log1p #4638

Closed
vicuna opened this issue Nov 5, 2008 · 3 comments
Closed

Provide expm1 and log1p #4638

vicuna opened this issue Nov 5, 2008 · 3 comments
Assignees

Comments

@vicuna
Copy link

vicuna commented Nov 5, 2008

Original bug ID: 4638
Reporter: @Chris00
Assigned to: @xavierleroy
Status: closed (set by @xavierleroy on 2011-05-29T10:14:20Z)
Resolution: fixed
Priority: normal
Severity: feature
Version: 3.11.0+beta
Fixed in version: 3.12.0+dev
Category: ~DO NOT USE (was: OCaml general)

Bug description

The functions expm1 and log1p are important in some situations to avoid loss of precision. It will be nice to have them available in OCaml by default.

@vicuna
Copy link
Author

vicuna commented Nov 9, 2008

Comment author: @xavierleroy

I agree expm1 and log1p are useful. The problem is that these functions are not in the C89 standard ("ANSI C"), only in C99. In particular, Microsoft's standard library does not implement them. So, we have a cross-platform portability issue here.

In the meantime, there exists numerically-accurate implementations in terms of regular exp() and log(), due to W. Kahan himself:
http://www.plunk.org/~hatch/rightway.php
Maybe these would be good enough for your application.

@vicuna
Copy link
Author

vicuna commented Dec 11, 2008

Comment author: @Chris00

Thanks for your prompt reply. Since I use Linux, I did a direct binding to the C function but maybe, for windows, a binding to fdlibm http://www.netlib.org/fdlibm/ can maybe envisioned?

@vicuna
Copy link
Author

vicuna commented Apr 1, 2009

Comment author: @xavierleroy

Tentative implementation in CVS trunk. Use Kahan's magic formulae if the C library doesn't provide the functions. Scheduled for inclusion in release 3.12.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants