python math库函数源码_11. math库函数
一、math庫介紹
內置數學類函數庫,math庫不支持復數類型,僅支持整數和浮點數運算。
math庫一共提供了:
4個數字常數
44個函數,分為4類:
16個數值表示函數
8個冪對數函數
16個三角對數函數
4個高等特殊函數
庫中函數不能直接使用,需使用保留字import引用:
import math
math.(...)
或者
from math import
(...)
3.2 math庫的數值表示函數(16個)
3.3 math庫的冪對數函數(8個)
3.4 math庫的三角運算函數(16個)
3.5 math庫的高等特殊函數(4個)
四:舉例
# math_constants.pyimportmathprint(' π: {:.30f}'.format(math.pi))print(' e: {:.30f}'.format(math.e))print('nan: {:.30f}'.format(math.nan))print('inf: {:.30f}'.format(math.inf))
π?和 e 的精度僅受平臺浮點C語言庫限制。
$ python3 math_constants.py
π: 3.141592653589793115997963468544
e: 2.718281828459045090795598298428
nan: nan
inf: inf
其他一些具體詳細操作:https://zhuanlan.zhihu.com/p/107101718
原文鏈接:https://blog.csdn.net/weixin_48619768/article/details/108946647
總結
以上是生活随笔為你收集整理的python math库函数源码_11. math库函数的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Apache安装、配置、卸载
- 下一篇: javascript中基本包装、算数运算