Wrong math result with calling C extension in Python
<p>I am calling the <code>pow()</code> function of C's math library. My installation is Python3.5 on Windows 10 but I tried the same program in Python2.7 with same result. The return from the function is not as expected. Not sure what's happening. The code is given below. The result I get is 1.0.</p>

<pre><code>from ctypes import *

libc = cdll.msvcrt
libc.pow.argtypes = [c_double, c_int]
libc.pow.restype = c_double
libc.pow(2.3, 2)
</code></pre>

<p>There is a type mismatch. Use c_double for power as well.
Like this. It should work.</p>

<p>libc.pow.argtypes = [c_double, c_double]</p>

python python-c-extension