math模块的作用

math模块实现了正常情况下原生平台C库中才有的很多专用IEEE函数,可以使用浮点值完成复杂的数学运算,包括对数和三角函数运算。

1、打印常量的示例

import math

print('  π: {:.30f}'.format(math.pi))
print('  e: {:.30f}'.format(math.e))
print('nan: {:.30f}'.format(math.nan))
print('inf: {:.30f}'.format(math.inf))
math_constants.py

相关文章:

  • 2022-02-20
  • 2022-01-04
  • 2021-12-05
  • 2022-12-23
  • 2021-06-05
  • 2021-07-30
  • 2021-12-06
猜你喜欢
  • 2021-10-04
  • 2021-12-31
  • 2022-12-23
  • 2021-09-07
  • 2021-12-02
  • 2021-09-03
相关资源
相似解决方案