Hmm, right, math.pxd is actually lacking a lot of declarations:
http://en.wikipedia.org/wiki/Math.h
> To do this I tried to add the signature of this function to math.pxd
> in libc folder of Cython, as th last indented line of the pxd file,
> like so:
>
> double fabs(double x)
Sure, should work.
> then in my pyx file I did the following:
>
> from libc.math cimport fabs
>
> This line starts giving the following error when i want to see the
> annotated output.
>
> AttributeError: 'UnspecifiedType' object has no attribute
> 'create_from_py_utility_code'
Hmm, I assume that's not all you put into your .pyx, is it? That certainly
works for me.
> if I remove that line, everything goes fine?
>
> Where to go from here?
Could you provide some example code that fails for you? Try to strip down
your code to a short example, that will usually allow you to see what goes
wrong.
Stefan
BTW, I think it shouldn't make your code slower to use the Python
functions. Applying math.abs() to a typed C floating point value should
call fabs().
http://trac.cython.org/cython_trac/ticket/662
(we've discussed this idea on cython-dev ages ago, but I couldn't find a
ticket for it)
Stefan