谁给我讲讲这个Math.rint()的用法?

解决方案 »

  1.   

    public static double rint(double a)Returns the double value that is closest in value to the argument and is equal to a mathematical integer. If two double values that are mathematical integers are equally close, the result is the integer value that is even. Special cases: 
    If the argument value is already equal to a mathematical integer, then the result is the same as the argument. 
    If the argument is NaN or an infinity or positive zero or negative zero, then the result is the same as the argument.Parameters:
    a - a double value. 
    Returns:
    the closest floating-point value to a that is equal to a mathematical integer.这个是1.5版本的API原文
      

  2.   

    楼上的,jdk我也会看,就是没有看懂才来问问的。
      

  3.   

    jdk中的定义为: public static native double rint(double a);传回最接近传入值的整数(常用于负数的小数舍入).
      

  4.   

    语法:public static native double rint(double a);
    功能:计算距离参数a最近的整数;
    参数:a一个double值;
    返回:对参数a的小数点后部分四舍五入,将整数值返回
    如果同为精确整数的两个double值距离参数同样近,则结果为偶数值;