1、简易说明

(1)round:四舍五入

(2)floor:向下取整

(3)ceiling:向上取整

2、举例说明

      <#--freemarker中的round、floor和ceiling数字的舍入处理-->
      <#--round:四舍五入-->
      <#--floor:向下取整-->
      <#--ceiling:向上取整-->

      <#assign numList = [12,0.23,89,12.03,69.56,45.67,-0.56,-8.05,-89.56,4.69]/>
      <#list numList as num>
          ${num} ?round=${num?round} ?floor=${num?floor} ?ceiling=${num?ceiling}
      </#list>

3、示例结果

 <span style="white-space:pre">    </span> 12 ?round=12 ?floor=12 ?ceiling=12
          0.23 ?round=0 ?floor=0 ?ceiling=1
          89 ?round=89 ?floor=89 ?ceiling=89
          12.03 ?round=12 ?floor=12 ?ceiling=13
          69.56 ?round=70 ?floor=69 ?ceiling=70
          45.67 ?round=46 ?floor=45 ?ceiling=46
          -0.56 ?round=-1 ?floor=-1 ?ceiling=0
          -8.05 ?round=-8 ?floor=-9 ?ceiling=-8
          -89.56 ?round=-90 ?floor=-90 ?ceiling=-89
          4.69 ?round=5 ?floor=4 ?ceiling=5

freemarker中的round、floor和ceiling数字的舍入处理(十七)的更多相关文章

  1. freemarker中的round、floor和ceiling数字的舍入处理

    freemarker中的round.floor和ceiling数字的舍入处理 1.简易说明 (1)round:四舍五入 (2)floor:向下取整 (3)ceiling:向上取整 2.举例说明 < ...

  2. C++中的 Round(),floor(),ceil()

     2.1             2.6               -2.1               -2.6floor : 不大于自变量的最大整数             2          ...

  3. Freemarker中遍历List以及内置函数使用

    在Freemarker应用中经常会遍历List获取需要的数据,并对需要的数据进行排序加工后呈现给用户. 那么在Freemarker中如何遍历List,并对List中数据进行适当的排序呢?一. Free ...

  4. SQL 中详解round(),floor(),ceiling()函数的用法和区别?

    SQL 中详解round(),floor(),ceiling()函数的用法和区别? 原创 2013年06月09日 14:00:21   摘自:http://blog.csdn.net/yueliang ...

  5. SQL语句(floor、ceiling和round以及left和right)

    前言:个人认为命令没有必要记,学过的知识总结一下,用到了可以快速找到派上用场.用的多了,自然会记住,但是一定要理解每一个字符代表的是什么,多一个少一个会怎么样 要点概述 floor 和ceiling和 ...

  6. oracle中 trunc(),round(),ceil(),floor的使用

    oracle中 trunc(),round(),ceil(),floor的使用 原文: http://www.2cto.com/database/201310/248336.html 1.round函 ...

  7. js中Math.round、parseInt、Math.floor和Math.ceil小数取整总结(转)

    js中Math.round.parseInt.Math.floor和Math.ceil小数取整总结 Math.round.parseInt.Math.floor和Math.ceil 都可以返回一个整数 ...

  8. 关于python中的round()和javascript中的round()的比较

    ps:python的round()和javascript的round()的比较: javascript:Math.round():正常的标准舍入,就像我们学的数学课本上面的规则 python:pyth ...

  9. Python 中关于 round 函数的坑

    round函数很简单(而且不需要引入math模块),对浮点数进行近似取值,保留几位小数. 比如 # -*- coding: UTF-8 -*- r1=round(12.12345,3) r2=roun ...

随机推荐

  1. #1280 : Rikka with Sequence II [meet int the middle]

    tle弃疗了 等着回学校找个标程拍一下吧 #include <iostream> #include <cstdio> #include <cstring> #inc ...

  2. POJ 2007 Scrambled Polygon [凸包 极角排序]

    Scrambled Polygon Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 8636   Accepted: 4105 ...

  3. 树莓派小车(三)Python控制小车

    正文之前 由于最近忙于复习赶考,所以暂时没有拿起树莓派小车,直到昨天,终于空出时间来把代码整理一下来和大家分享. 正文 在树莓派小车系列之二中,讲到了树莓派的引脚定义方式有两种: PHYSICAL N ...

  4. .35-浅析webpack源码之babel-loader入口文件路径读取

    在处理./input.js入口文件时,在类型判断被分为普通文件,所以走的文件事件流,最后拼接得到文件的绝对路径. 但是对应"babel-loader"这个字符串,在如下正则中被判定 ...

  5. LVS的DR设置测试

    dir: ipvsadm -C 清空之前ipvsadm   iptables -t nat -F 防火墙规则清空v   rs1,rs2: vi /etc/sysconfig/network-scrip ...

  6. easyui+ajax获取同表关联的数据

    easyui是我们常用的前端框架之一,easyui的使用使得前端页面更加美观.为了能够使用combobox,ajax必须同步. 该小程序是使用ssm框架,对数据库的数据进行查询,所以url对应着map ...

  7. object类的equals方法简介 & String类重写equals方法

    object类中equals方法源码如下所示 public boolean equals(Object obj) { return this == obj; } Object中的equals方法是直接 ...

  8. Java经典编程题50道之七

    输入一行字符,分别统计出其中英文字母.空格.数字和其它字符的个数. public class Example07 {    public static void main(String[] args) ...

  9. git ssh 配置

    创建并切换到 ~/.ssh(存在就直接切换过去) 运行 ssh-keygen 创建 rsa 文件 复制 .pub 的文件内容,添加到网站的公钥列表 Git\etc\ssh\ssh_config 中添加 ...

  10. js中的typeof和instanceof和===

    typeof: 用于判断number/string/boolean/underfined类型/function 不能判断:null和object ,不能区分object和Array instanceo ...