欢迎使用CSDN-markdown编辑器
2015-12-10 14:41
253 查看
Math
此文章只是对Math进行大概的介绍,示例后续再上,java.math.Math类常用的常量和方法:Math.PI 记录的圆周率
Math.E记录e的常量
Math.abs 求绝对值
Math.sin 正弦函数 Math.asin 反正弦函数
Math.cos 余弦函数 Math.acos 反余弦函数
Math.tan 正切函数 Math.atan 反正切函数 Math.atan2 商的反正切函数
Math.toDegrees 弧度转化为角度 Math.toRadians 角度转化为弧度
Math.ceil 得到不小于某数的最大整数
Math.floor 得到不大于某数的最大整数
ceil()是天花板,即向上取整。floor是地板,向下取整。round是四舍五入。
Math.IEEEremainder 求余
Math.max 求两数中最大
Math.min 求两数中最小
Math.sqrt 求开方
Math.pow 求某数的任意次方, 抛出ArithmeticException处理溢出异常
Math.sqrt(x):平方根
Math.pow(x,y):x的y次方
Math.exp 求e的任意次方
Math.log10 以10为底的对数
Math.log 自然对数
Math.rint 求距离某数最近的整数(可能比某数大,也可能比它小)
Math.round 同上,返回int型或者long型(上一个函数返回double型)
Math.random 返回0,1之间的一个随机数
相关文章推荐
- ntpclent
- Java---布局管理代码简单使用(解答)
- leetcode:206 Reverse Linked List-每日编程第十四题
- 递归与迭代的区别
- ios 设计模式
- Eclipse 未开始 【Ubuntu】
- 编译 Android 版本的 Opus 音频编解码库的方法
- wix xslt for adding node
- lucene 索引过程
- SDUT 数据结构实验之查找五:平方之哈希表
- ClassCastException: android.widget.ImageView cannot be cast to android.widget.TextView
- eclipse快捷键
- android绑定远程服务以及android接口定义语言(aidl)
- appcan 主窗口和frame窗口通信
- 关于返回Return的一些困惑:”for(){return;}是否退出循环?“
- 解决外网与内网或内网之间的通信,NAT穿透
- qj的招待会
- leetcode:191 Number of 1 Bits-每日编程第十三题
- leetcode:235 Lowest Common Ancestor of a Binary Search Tree-每日编程第十二题
- python安装numpy科学计算模块