zoukankan      html  css  js  c++  java
  • Java学习之Math类理解

    Math类包含用于几何和三角运算的所有浮点函数,以及一些用于通用目的的方法。Math类定义了两个double常量:E(约等于2.72)和PI(约等于3.14)

    1、三角函数

    表中的方法接收double类型的参数(单位为弧度),并返回各自三角函数的运算结果。

    用于三角函数的方法
    方法 描述
    static  double  sin(double arg) 返回由arg指定的角度(单位为弧度)的正弦值
    static  double  cos(double arg) 返回由arg指定的角度(单位为弧度)的余弦值
    static  double  tan(double arg) 返回由arg指定的角度(单位为弧度)的正切值

    2、指数函数

    用于指数函数的方法
    方法 描述
    static  double  cbrt(double arg) 返回arg的立方根
    static  double  exp(double arg) 返回e的arg次方
    static  double  expml(double arg) 返回e的(arg-1)次方
    static  double  log(double arg) 返回arg的自然对数
    static  double  log10(double arg) 返回arg的以10为底的对数
    static  double  pow(double arg) 返回y的x次方。如pow(2.0,3.0)返回8.0
    static  double  scalb(double arg,int factor) 返回arg×2factor
    static  double  sqrt(double arg) 返回arg的平方根

    3、舍入函数

      Math类定义了一些提供各种类型舍入操作的方法。

    Math类定义的舍入方法
    static int  abs(int  arg) 返回arg的绝对值
    static double  abs(double  arg) 返回arg的绝对值
    static double  ceil(double  arg) 返回大于或等于arg的最小整数
    static double  floor(double  arg) 返回小于或等于arg的最小整数值
    static int  floorDiv(int  dividend, int divisor) 返回不大于dividend/divisor的结果的最大整数
       
       
       
       
       
       
       
       
       
       
       
  • 相关阅读:
    实例演示Android异步加载图片(转)
    python egg for centos 制作
    获取 python import模块的路径
    error: zlib.h: No such file or directory
    error: pyconfig.h: No such file or directory
    error: bzlib.h: No such file or directory
    VirtualBox虚拟机克隆方法
    错误:‘lock_guard’ 在此作用域中尚未声明
    出现问题:fatal error: ltdl.h: No such file or directory
    OpenLdap与BerkeleyDB安装过程
  • 原文地址:https://www.cnblogs.com/sdlzspl/p/7266143.html
Copyright © 2011-2022 走看看