Issue 91602 - provide ersatz for expm1 and log1p
Summary: provide ersatz for expm1 and log1p
Alias: None
Product: porting
Classification: Code
Component: code (show other issues)
Version: DEV300m20
Hardware: All Windows XP
: P3 Trivial (vote)
Target Milestone: OOo 3.1
Assignee: ooo
QA Contact: issues@porting
Depends on:
Blocks: 91547 91870
  Show dependency tree
Reported: 2008-07-12 18:02 UTC by Regina Henschel
Modified: 2009-07-03 21:19 UTC (History)
3 users (show)

See Also:
Issue Type: PATCH
Latest Confirmation in: ---
Developer Difficulty: ---

ersatz for expm1 and log1p, and test values (2.42 KB, text/plain)
2008-07-12 18:05 UTC, Regina Henschel
no flags Details
changes in patch form (599 bytes, text/plain)
2008-12-03 13:34 UTC, Regina Henschel
no flags Details

Note You need to log in before you can comment on or make changes to this issue.
Description Regina Henschel 2008-07-12 18:02:29 UTC
Working for Calc for BETADIST, I need the functions expm1 and log1p. But I
noticed, that they are not provided by MS Visual C++ 9.0 Express edition. (At
least I do not found them.) I have used a local ersatz. But I think such a
ersatz should be placed in a common place in a way that I can use expm1 and
log1p in my code and if a compiler has got them, the original version is used,
and if a compiler hasn't got them, the ersatz is used.

I'll attach a file with the ersatz, that works for me with MS Visual C++ 9.0
Express edition on WinXP home. But I don't know, which scenarios will need it
too and whether the ersatz will work there too.
Comment 1 Regina Henschel 2008-07-12 18:05:06 UTC
Created attachment 55086 [details]
ersatz for expm1 and log1p, and test values
Comment 2 ooo 2008-07-17 14:13:46 UTC
I think this should go into ::rtl::math where a wrapper would call either the
compiler provided function or the replacement. Stephan, what do you think?

Btw, is there a way to detect at compilation time whether a compiler supports
these functions, other than using #ifdef __MSC_VER or similar respectively the
usual configure attempt to test compile a function call?
Comment 3 Stephan Bergmann 2008-07-17 17:33:52 UTC
@er:  Yes, adding something to sal/inc/sal/math.h seems reasonable.  I am not
aware of a good way to test for existence of those functions in math.h; #if
__STDC_VERSION__ >= 199901L would work for C (conservatively), but not
necessarily for C++.
Comment 4 ooo 2008-07-17 18:32:19 UTC
Grabbing issue.
Comment 5 Regina Henschel 2008-12-03 13:34:41 UTC
Created attachment 58470 [details]
changes in patch form
Comment 6 ooo 2008-12-04 21:58:02 UTC
In cws odff05:

revision 264877

A slightly different approach than the attached patch. This makes the functions
available to C sources as well, and provides one single point to change in case
we wanted to replace the replacements with compiler-builtins for specific platforms.
Comment 7 ooo 2008-12-11 13:54:21 UTC
Code present in CWS build.
Comment 8 ooo 2009-07-03 21:19:11 UTC
Available in masters, closing.