Python常用标准库 --- math
2017-03-03 15:13
218 查看
数字处理。
下面列出一些自己决定会用到的:
下面列出一些自己决定会用到的:
方法 | 描述 | 示例 |
math.pi | 返回圆周率 | >>> math.pi 3.141592653589793 |
math.ceil(x) | 返回x浮动的上限 | >>> math.ceil(5.2) 6.0 |
math.floor(x) | 返回x浮动的下限 | >>> math.floor(5.2) 5.0 |
math.trunc(x) | 将数字截尾取整 | >>> math.trunc(5.2) 5 |
math.fabs(x) | 返回x的绝对值 | >>> math.fabs(-5.2) 5.2 |
math.fmod(x,y) | 返回x%y(取余) | >>> math.fmod(5,2) 1.0 |
math.modf(x) | 返回x小数和整数 | >>> math.modf(5.2) (0.20000000000000018, 5.0) |
math.factorial(x) | 返回x的阶乘 | >>> math.factorial(5) 120 |
math.pow(x,y) | 返回x的y次方 | >>> math.pow(2,3) 8.0 |
math.sprt(x) | 返回x的平方根 | >>> math.sqrt(5) 2.2360679774997898 |
相关文章推荐
- python常用标准库(一)-- threading
- 比较一下numpy.math和Python标准库的math.sin的计算速度
- python常用标准库
- Python标准库12 数学与随机数 (math包,random包)
- [代码笔记] python 常用标准库学习
- Python标准库数学与随机数 (math包,random包)
- Python常用标准库 --- random
- python学习笔记系列----(八)python常用的标准库
- python3常用的系统标准库
- Python常用标准库 --- os
- 【循序渐进学Python】11.常用标准库
- Python 常用标准库介绍
- Python学习笔记17:标准库之数学相关(math包,random包)
- JAVA从菜鸟【入门】到新手【实习】一一一一Python 内置函数,标准库与第三方库(拓展库),常用框架
- python的一些常用的标准库
- Python标准库12 数学与随机数 (math包,random包)(转)
- Python标准库12 数学与随机数 (math包,random包)
- Python标准库之随机数 (math包、random包)介绍
- Python常用标准库使用
- Python常用标准库 --- glob