totalPage=(int)Math.floor(totalrecord/PageSize)+1;Math.floor()在这里起什么作用???

解决方案 »

  1.   

    求其近似值,和ceil相似,注意区别。
    floor
    public static double floor(double a)
    Returns the largest (closest to positive infinity) double value that is less than or equal to the argument and is equal to a mathematical integer. 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 value. 
    Returns:
    the largest (closest to positive infinity) floating-point value that less than or equal to the argument and is equal to a mathematical integer.
      

  2.   

    Math.floor
    floor -- 原意 地板。
    数学函数,求一个浮点数的地板,就是求一个最接近它的整数,它的值小于或等于这个浮点数。例如:
    Math.floor(0.60)  -- 0
    Math.floor(0.40)  -- 0
    Math.floor(5)  -- 5
    Math.floor(5.1) -- 5
    Math.floor(-5.1) -- -6
    Math.floor(-5.9) -- -6{} -- 条件语句 if 用的
    if (条件) {则} else { 否则};Math.floor(prompt("请您输入吧",“10”)) 
    函数的参数由键盘输入得到。
    if(a<18)-- 如果小于18岁  否则  
      

  3.   

    Math.floor
    floor -- 原意 地板。
    数学函数,求一个浮点数的地板,就是求一个最接近它的整数,它的值小于或等于这个浮点数。例如:
    Math.floor(0.60)  -- 0
    Math.floor(0.40)  -- 0
    Math.floor(5)  -- 5
    Math.floor(5.1) -- 5
    Math.floor(-5.1) -- -6
    Math.floor(-5.9) -- -6{} -- 条件语句 if 用的
    if (条件) {则} else { 否则};Math.floor(prompt("请您输入吧",“10”)) 
    函数的参数由键盘输入得到。
    if(a<18)-- 如果小于18岁  否则  
      

  4.   

    floor向下取整,也就是取小于等于参数的整数。
    ceil向上取整,也就是取大于等于参数的整数。
    round取最接近参数的整数。结果将舍入为整数:加上 1/2,对结果调用 floor 并将所得结果强制转换为 int 类型。换句话说,结果等于以下表达式的值: 
    (int)Math.floor(a + 0.5f)
      

  5.   

    floor向下取整,也就是取小于等于参数的整数。
    ceil向上取整,也就是取大于等于参数的整数。
    round返回最接近参数的 int。结果将舍入为整数:加上 1/2,对结果调用 floor 并将所得结果强制转换为 int 类型。换句话说,结果等于以下表达式的值: (int)Math.floor(a + 0.5f)
      

  6.   

    舍尾取整整个表达式计算总页数的。如果本身已经是int了,就没必要了
      

  7.   

    Math.floor 向下取整
    Math.ceil  向上取整
    例:
            System.out.println(Math.floor(123.45)); >> 123
            System.out.println(Math.floor(-123.45));>> -124
            System.out.println(Math.ceil(123.45));  >> 124
            System.out.println(Math.ceil(-123.45)); >> -123
      

  8.   

    floor向下取整,也就是取小于等于参数的整数。
    ceil向上取整,也就是取大于等于参数的整数。
    round返回最接近参数的整数。结果被舍入为整数:加上1/2,对结果调用floor并将所得结果强制转换为整数。
    换句话说,结果等于:(int)Math.floor(a+0.5f)
      

  9.   

    floor向下取整,也就是取小于等于参数的整数。
    ceil向上取整,也就是取大于等于参数的整数。
    round返回最接近参数的整数。结果被舍入为整数:加上1/2,对结果调用floor并将所得结果强制转换为整数。
    换句话说,结果等于:(int)Math.floor(a+0.5f)
      

  10.   

    Math.floor 向下取整
    Math.ceil  向上取整System.out.println(Math.floor(123.45));
    System.out.println(Math.floor(-123.45));
    System.out.println(Math.ceil(123.45));
    System.out.println(Math.ceil(-123.45));/*
    123.0
    -124.0
    124.0
    -123.0
    */
      

  11.   

    floor向下取整,也就是取小于等于参数的整数。
      

  12.   

    中国话
    是地板
    e.g
    9.6地板是9
    -9.6地板是-10
    同理还有个ceil
    相反的叫天花板
      

  13.   

    返回最大的(最接近正无穷大)double 值,该值小于或等于参数,并且等于某个整数。
      

  14.   

    返回最大的(最接近正无穷大)double 值,该值小于或等于参数,并且等于某个整数。
      

  15.   

    floor是向下取整,也就是说取小于等于参数的整数!
    ceil是向上取整,也就是说取大于等于参数的整数!
    round返回最接近参数的 int。结果将舍入为整数:加上 1/2,对结果调用 floor 并将所得结果强制转换为 int 类型。换句话说,结果等于以下表达式的值: (int)Math.floor(a + 0.5f)
      

  16.   

    floor是向下取整,也就是取小于等于参数的整数!
    ceil是向上取整,也就是取大于等于参数的整数!
    round是取最接近参数的值。加上1/2,然后floor的值。即:
    (int)Math.floor(a+1/2)
      

  17.   

    Math.floor(),其中Math是JavaScript的一个对象,floor是Math的属性。Math.floor()可以获得一个数的整数部分,而不是四舍五入,这在编程中比较常用,用法实例: <script>
    document.write(Math.floor(400.0244))
    </script>
    运行结果是400。 <script>
    document.write(Math.floor(3.8))
    </script>
    运行结果是3
      

  18.   

    Math.floor(),其中Math是JavaScript的一个对象,floor是Math的属性。Math.floor()可以获得一个数的整数部分,而不是四舍五入,这在编程中比较常用,用法实例: <script>
    document.write(Math.floor(400.0244))
    </script>
    运行结果是400。 <script>
    document.write(Math.floor(3.8))
    </script>
    运行结果是3
      

  19.   

    Math.floor(),其中Math是JavaScript的一个对象,floor是Math的属性。Math.floor()可以获得一个数的整数部分,而不是四舍五入,这在编程中比较常用
      

  20.   

    floor
    public static double floor(double a)返回最大的(最接近正无穷大)double 值,该值小于或等于参数,并且等于某个整数。特殊情况是: 
    如果参数值总是等于某个整数,那么结果与该参数相同。
    如果参数是 NaN、无穷大、正零或负零,那么结果与参数相同。参数:
    a - 一个值。 
    返回:
    最大(最接近正无穷大)浮点值,该值小于或等于该参数,并且等于某个整数。
      

  21.   

    http://www.dreamdu.com/javascript/Math.floor/楼主以后请到Google搜一下,这种东西很多的
      

  22.   

    天花板地板函数:天花板:Math.ceil();地板函数:Math.floor()
      

  23.   


    这帖子是 4 年半前的,还接分呢,要结的话老早就结了!这个帖子是我来 CSDN 以来见到的超级挖坟帖!