[Numpy-discussion] long double woes on win32
David Cournapeau
cournape@gmail....
Sat Aug 16 10:06:56 CDT 2008
On Sat, Aug 16, 2008 at 9:11 AM, Charles R Harris
<charlesr.harris@gmail.com> wrote:
>
> 1) We could define the numpy longdouble type to be double, which makes us
> compatible with MS and is effectively what numpy compiled with MSVC does
> since MSVC long doubles are doubles. Perhaps this could be done by adding a
> -DNOLONGDOUBLE flag to the compiler flags and then defining longdouble to
> double. But this means auditing the code to make sure the long double type
> is never explicitly used so that the mingw compiler does the right thing. I
> don't think this should be a problem otherwise except for the loss of "true"
> long doubles and their extra bit of precision.
According to Travis, we never use long double, always npy_long_double.
But as I mentioned above, forcing a mode with long double being
effectively double breaks the configuration.
This is the problem, because fixing it (which I will do once the trunk
is open for 1.3) requires some non trivial changes in the
configuration, namely: we look for some math functions (says acoshf)
and assumes that finding one guarantees all of the same kind (float
versions of hyperbolic float functions) exist, which only worked on
some platforms, but not on others.
The solution is not complicated (testing for every function +
bisecting to avoid a too long configuration stage), but will need
thorough testing.
> 2) We can keep the mingw "true" long doubles and avoid any reliance on the
> MS library. This may already be done for the math functions by effectively
> computing the long double functions as doubles, but I will have to check on
> that. In any case, some of the usefulness of long doubles will still be
> lost.
The problem is not only the computation, but all the support around:
printf, etc... (the current test failures are in those functions) And
anyway, since python is linked against the MS C runtime, I think it is
kind of pointless to do so.
> 3) We can write our own library functions. That seems like a lot of work but
> perhaps there is something in the BSD library we could use. I think BSD uses
> the gnu compiler but has it's own libraries.
Yes, the C library in BSD* is certainly not the glibc. But see above
for the limited usefulness of this. We have to use long double as
double in the configuration; the question is not if, but how (using VS
for binaries, updating mingw to fix its broken configuration when
sizeof(npy_double) == sizeof(npy_longdouble)) and when.
cheers,
David
More information about the Numpy-discussion
mailing list