[Cython] Cygwin: Handling missing C99 long double functions

Ian Henriksen insertinterestingnamehere at gmail.com
Tue Apr 26 17:04:28 EDT 2016


On Tue, Apr 26, 2016 at 2:56 PM Robert Bradshaw <robertwb at gmail.com> wrote:

> On Tue, Apr 26, 2016 at 8:36 AM, Erik Bray <erik.m.bray at gmail.com> wrote:
>
>> On Tue, Apr 26, 2016 at 5:16 PM, Dima Pasechnik
>> <dimpase+github at gmail.com> wrote:
>> > Hi,
>> > certainly we did something with Sage on cygwin to work around these...
>> > Just in case,
>>
>> From what I can tell there are several places where Sage has hacked
>> around this issue in different packages, but it's not doing anything
>> specifically with it for Cython.  Sage uses the Cephes math lib to
>> support these functions on FreeBSD--and apparently used to use it on
>> Cygwin too, but disabled that for some reason.
>>
>> Regardless, Cython should ultimately do something sensible in these cases.
>>
>> My general thinking is that in cases where Cython generates code
>> containing C math functions, it ought to support a fallback.  This
>> will require some feature checks so that Cython can generate wrappers,
>> when necessary, around the double versions of those functions (as
>> Numpy currently does).
>>
>
> Let's make things concrete. You're complaining that something like
>
> cdef extern from "math.h":
>     long double sqrtl(long double)
>
> def foo(long double x):
>     return sqrtl(x)
>
> Doesn't work on Cygwin?
>
> The same is true for *any* C function that you use that's not totally
> portable (this is the bane of trying to use C). I don't think Cython should
> be detecting this and substituting a (less accurate) sqrt for sqrtl in this
> case. If you want do do this, write your own headers that (conditionally)
> define these things however you want.
>
> Or, are you complaining that Cython's test suite doesn't pass on some
> Cygwin because there are tests of features not available on Cygwin? (Your
> original email isn't clear.) If so, the test framework can be set up to
> exclude these tests on that platform.
>
>

Right, this sounds like a good place to exclude some tests. long double's
behavior
is pretty platform dependent. I wouldn't expect to be able to write platform
independent code that uses it. There's not much Cython can do to change the
situation either.
Best,
-Ian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/cython-devel/attachments/20160426/a904387e/attachment-0001.html>


More information about the cython-devel mailing list