#encoding:utf-8
import math #向上取整 http://www.manongjc.com/article/1335.html
print "math.ceil---"
print "math.ceil(2.3) => ", math.ceil(2.3)
print "math.ceil(2.6) => ", math.ceil(2.6) #向下取整 http://www.manongjc.com/article/1336.html
print "\nmath.floor---"
print "math.floor(2.3) => ", math.floor(2.3)
print "math.floor(2.6) => ", math.floor(2.6) #四舍五入 http://www.manongjc.com/article/1337.html
print "\nround---"
print "round(2.3) => ", round(2.3)
print "round(2.6) => ", round(2.6) #这三个的返回结果都是浮点型 http://www.manongjc.com/article/1338.html
print "\n\nNOTE:every result is type of float"
print "math.ceil(2) => ", math.ceil(2)
print "math.floor(2) => ", math.floor(2)
print "round(2) => ", round(2)

运行结果:

python 向上取整ceil 向下取整floor 四舍五入round的更多相关文章

  1. c++ / % 四舍五入 向上取整ceil 向下取整floor

     / % 四舍五入 向上取整ceil 向下取整floor #include <math.h> double floor(double x); float floorf(float x); ...

  2. python(50):python 向上取整 ceil 向下取整 floor 四舍五入 round

    取整:ceil 向下取整:floor 四舍五入:round 使用如下:

  3. js 向上取整、向下取整、四舍五入

      js 向上取整.向下取整.四舍五入 CreateTime--2018年4月14日11:31:21 Author:Marydon // 1.只保留整数部分(丢弃小数部分) parseInt(5.12 ...

  4. Oracle四舍五入,向上取整,向下取整

    用oracle sql对数字进行操作: 取上取整.向下取整.保留N位小数.四舍五入.数字格式化 取整(向下取整): select floor(5.534) from dual; select trun ...

  5. c# 小数四舍五入,向上取整,向下取整,见角进元保留多个小数位数

    /// <summary> /// 实现数据的四舍五入法 /// </summary> /// <param name="v">要进行处理的数据 ...

  6. Oracle - 数字处理 - 取上取整、向下取整、保留N位小数、四舍五入、数字格式化

    用oracle sql对数字进行操作: 取上取整.向下取整.保留N位小数.四舍五入.数字格式化 取整(向下取整): select floor(5.534) from dual; select trun ...

  7. Python 之 向上取整、向下取整以及四舍五入函数

    import math f = 11.2 print math.ceil(f) #向上取整 print math.floor(f) #向下取整 print round(f) #四舍五入 #这三个函数的 ...

  8. NowCoderWannafly挑战赛5-可编程拖拉机比赛-向上取整和向下取整函数

    可编程拖拉机比赛 时间限制:C/C++ 1秒,其他语言2秒空间限制:C/C++ 65536K,其他语言131072K64bit IO Format: %lld 题目描述 "这个比赛,归根结底 ...

  9. PHP取整,四舍五入取整、向上取整、向下取整、小数截取

    PHP取整数函数常用的四种方法: 1.直接取整,舍弃小数,保留整数:intval(): 2.四舍五入取整:round(): 3.向上取整,有小数就加1:ceil(): 4.向下取整:floor(). ...

随机推荐

  1. 由于@@ServerName等问题对SQL增量升级脚本进行补充

    由于@@ServerName在安装数据库之后修改了机器名的情况下,获取到的内容仍然是原来的机器名,造成数据库连接失败, 所以不能直接使用该全局变量. 此外对升级脚本的执行方式做了一下调整,将版本的判断 ...

  2. 编程技术●Python

    <Python语言入门> 2015-01-16 14:13 ★ 虽然书名叫入门.序里也写了说完全没有编程经验的都可以用这本书来学习入门.不过好像不太适合哦.书很好,内容也挺全面细致的.太好 ...

  3. MagicalRecord 多表关联数据操作

    最近在使用MagicalRecord做数据持久层CoreData的操作库,今天做了一个多表关联数据的操作,整理了一个demo,特此记录一下. 关于如何使用Cocopads 和 MagicalRecor ...

  4. 安装生物信息学软件-bowtie2

    好吧,这是本周(2016.10.21-28)的学习任务之一:安装bowtie2并学习其使用方法&参数设置 所以,啃文档咯,官方文档Version 2.2.9 http://bowtie-bio ...

  5. MySQL数据库1 - 基本概念及安装

    一.数据管理技术的产生和发展: 1.人工管理阶段 - 效率低,成本高(文字) 2.文件系统阶段 - 易于存储,处理速度快,数据形式丰富(文字,声音,图片...磁带,磁盘) 3.数据库系统阶段 - 易于 ...

  6. android技巧(一):如何方便知晓当前Activity?如何管理应用中的Activity?如何最佳的启动一个Activity?

    1.如何方便知晓当前Activity? 可以不看代码根据当前界面就知道界面所在Activity的写法: 建立BaseActivity,继承自Activity,在BaseActivity的OnCreat ...

  7. 【LeetCode OJ】Convert Sorted Array to Binary Search Tree

    Problem Link: http://oj.leetcode.com/problems/convert-sorted-array-to-binary-search-tree/ Same idea ...

  8. A strange lift_BFS

    Problem Description There is a strange lift.The lift can stop can at every floor as you want, and th ...

  9. 一行代码从表中选取N行到另一个表

    private void Form1_Load(object sender, EventArgs e) {            DataTable dt = new DataTable();     ...

  10. C++学习笔记16:Linux系统编程基础1

    参数列表 Linux命令行规范 短参数:以单横开头,后跟单一字符,例如:ls -h 长参数:以双横开头,后跟字符串,例如:ls --help 程序访问参数列表的方法: 主函数的参数argc和argv ...