[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

where is math_sin defined?

On Sunday, 10 February 2019 15:15:32 GMT Jon Ribbens wrote:
> As an aside, how is 'math.sin' actually implemented? mathmodule.c
> refers to the function 'math_sin' but that name is not defined
> anywhere in the Python source code. I'm a bit mystified as to how
> CPython manages to compile!

I used gdb to find it:

Breakpoint 1, math_sin (self=<module at remote 0x7fffea716098>, args=0) at /
1176    FUNC1(sin, sin, 0,
(gdb) l
1171          "remainder($module, x, y, /)\n--\n\n"
1172          "Difference between x and the closest integer multiple of y.
1173          "Return x - n*y where n*y is the closest integer multiple of y.
1174          "In the case where x is exactly halfway between two multiples 
1175          "y, the nearest even value of n is used. The result is always 
1176    FUNC1(sin, sin, 0,
1177          "sin($module, x, /)\n--\n\n"
1178          "Return the sine of x (measured in radians).")
1179    FUNC1(sinh, sinh, 1,
1180          "sinh($module, x, /)\n--\n\n"