就好象我们添加1之后调用floor()。这句话你意思就是象我们添加1之后调用floor()是“象”是说效果!!!不是说在这个程序里存在floor()

解决方案 »

  1.   

    round(a) = (int)Math.floor(a + 0.5f);
      

  2.   

    a  round(a+0.5) ceil(a)
    -2.3 -2 -2
    -1.0 0 -1
    0 1 0
    0.25 1 1
    4 5 4
      

  3.   

    ceil   不比参数大的最大整数
    floor  舍去小数部分
    round  小数部分四舍五入得整数(先加0.5再floor得结果)
      

  4.   

    不明白楼主在说什么.之后执行floor()。你管这个干什么?
    不要相信什么答案
      

  5.   

    if(Math.round(values[x]+.5)==Math.ceil(values[x]))...............Math.round(values[x]+0.5)的执行效果就如同Math.floor(values[x])
    其实比较的就是Math.floor(values[x]) 和 Math.ceil(values[x]) 的大小关系这样解释,你明白了吗?
      

  6.   

    明白了,我的理解就是
    ceil()得出来的是比参数大或等于参数的值
    floor()得出来的是比参数小或等于参数的值
    round()的计算方法就是将参数的值加0.5,然后用floor()求出最后结果
    这样理解没错把
    谢谢楼上各位!
    再请问一下,怎么送分
      

  7.   

    ceil   应该是不比参数小的最大整数
      

  8.   


    Math.round(-2.3 + .5) = Math.round(Math.abs((-2.3 + .5))
      

  9.   

    ceil   是不比参数小的最大整数System.out.println(Math.ceil(2.8));//3.0
    System.out.println(Math.ceil(-2.8));//-2.0原来打错了