This is the mail archive of the
libstdc++@sources.redhat.com
mailing list for the libstdc++ project.
Re: long double and GLIBCPP_CHECK_MATH_SUPPORT
- To: libstdc++ at sources dot redhat dot com, dje at watson dot ibm dot com
- Subject: Re: long double and GLIBCPP_CHECK_MATH_SUPPORT
- From: Benjamin Kosnik <bkoz at redhat dot com>
- Date: Thu, 26 Oct 2000 07:11:50 -0700
David.
Let's back up a bit.
I put in these checks for long double as a quick hack to work around
powerpc build issues. In particular, the following (legal) code would
not compile:
extern "C" {
extern double cos ( double __x);
extern float cosf ( float __x);
}
namespace std {
inline float cos(float __x) { return ::cosf(__x); }
inline double cos(double __x) { return ::cos(__x); }
}
void test01()
{
long double d = 1111.111;
std::cos(d);
}
This code has to compile. The current sources give an ambiguity here,
which is not going to work.
If you look in 26/numerics, you can see that cmath *requires* long
double overloads for math types, even if the underlying "C" math
library does not support them. I think the best solution is to do
something like:
#if _GLIBCPP_HAVE___BUILTIN_SINL
inline long double
sin(long double __x) { return __builtin_sinl(__x); }
#elif _GLIBCPP_HAVE_SINL
inline long double
sin(long double __x) { return ::sinl(__x); }
#else
inline long double
sin(long double __x) { return ::sin(static_cast<double>(__x)); }
#endif
Which incidentally matches the float overloads. It allows the
compilation of the code above, and I've tested this on both powerpc
and x86. Granted, the results are sketchy, but I believe if user code
runs into problems here, the resulting problems will be easier to find
(and less aggravating) than a compile time error on legal code.
I'd like to remove this flag, the macro, and the support that went in
with it. I suppose this is a change you'll object to.
From what I understand, you are trying to optimize the configure
process, correct? Can you clarify your intent please?
-benjamin
2000-10-26 Benjamin Kosnik <bkoz@redhat.com>
* acinclude.m4 (GLIBCPP_ENABLE_LONG_DOUBLE): Remove.
* aclocal.m4: Regenerate.
* configure.in: Remove GLIBCPP_ENABLE_LONG_DOUBLE.
* configure: Regenerate.
* docs/configopts.html: Remove.
* src/complexl.cc: Revert.
* config.h.in: Remove.
* include/c_std/bits/std_cmath.h: Remove guards based on
_GLIBCPP_USE_LONG_DOUBLE.
* include/c/bits/std_cmath.h: Same. Format. Match c_std behavior
with respect to long double signatures.