Hi, Math experts:

Looking at the codes below, for many math operations, CPython is checking errno 
to determine the error status even though the math function returns normal 
value back. Is it a safe solution? From the description here 
http://man7.org/linux/man-pages/man3/errno.3.html and 
https://wiki.sei.cmu.edu/confluence/pages/viewpage.action?pageId=87152351, it 
looks apis probably set the errno when normal result is returned. Or being a 
side effect by calling other APIs in the implementation. In this situation, 
CPython's math operation might raise exceptions however in fact the result is 
correct.

https://github.com/python/cpython/blob/master/Modules/mathmodule.c#L956
https://github.com/python/cpython/blob/master/Modules/mathmodule.c#L864

Thanks,
Peixing
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to