Commit 8a74aefc authored by Robert Bradshaw's avatar Robert Bradshaw

Fix constants in libc/math.pxd

parent 8332ebce
cdef extern from "math.h" nogil:
enum: M_E
enum: M_LOG2E
enum: M_LOG10E
enum: M_LN2
enum: M_LN10
enum: M_PI
enum: M_PI_2
enum: M_PI_4
enum: M_1_PI
enum: M_2_PI
enum: M_2_SQRTPI
enum: M_SQRT2
enum: M_SQRT1_2
double M_E
double M_LOG2E
double M_LOG10E
double M_LN2
double M_LN10
double M_PI
double M_PI_2
double M_PI_4
double M_1_PI
double M_2_PI
double M_2_SQRTPI
double M_SQRT2
double M_SQRT1_2
double acos(double x)
double asin(double x)
......
# mode: compile
from libc.math cimport (M_E, M_LOG2E, M_LOG10E, M_LN2, M_LN10, M_PI, M_PI_2,
M_PI_4, M_1_PI, M_2_PI, M_2_SQRTPI, M_SQRT2, M_SQRT1_2)
from libc.math cimport (acos, asin, atan, atan2, cos, sin, tan, cosh, sinh,
tanh, acosh, asinh, atanh, exp, log, log10, pow, sqrt)
def test_pi():
"""
>>> import math
>>> test_pi() == math.pi
True
"""
return M_PI
def test_sin(x):
"""
>>> test_sin(0)
0.0
>>> from math import sin
>>> [sin(k) == test_sin(k) for k in range(10)]
[True, True, True, True, True, True, True, True, True, True]
"""
return sin(x)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment