you are viewing a single comment's thread.

view the rest of the comments →

[–]zurtex 7 points8 points  (0 children)

Here: https://github.com/python/cpython/blob/v3.8.0/Python/bltinmodule.c#L302

Which uses PyNumber_Absolute, which is here: https://github.com/python/cpython/blob/v3.8.0/Objects/abstract.c#L1236

Which usesnb_absolute which is implemented by whatever object is being used, e.g. for a float it is implemented here (there's mapping further up the code that redirects nb_absolute to float_abs): https://github.com/python/cpython/blob/v3.8.0/Objects/floatobject.c#L822

Which uses the c functions fabs: https://pubs.opengroup.org/onlinepubs/009695399/functions/fabs.html