asp中的几个取整函数fix(),int(),round()的用法
asp中的几个取整函数是:fix(),int(),round();
Int(number)、Fix(number)函数返回数字的整数部分。number 参数可以是任意有效的数值表达式。如果 number 参数包含 Null,则返回 Null。
例:
response.write int(2.14) '2
response.write fix(2.14) '2
response.write int(2.54) '2
response.write int(2.54) '2
Int 和 Fix 函数都删除 number 参数的小数部分并返回以整数表示的结果。Int 和 Fix 函数的区别在于如果 number 参数为负数时,Int 函数返回小于或等于 number 的第一个负整数,而 Fix 函数返回大于或等于 number 参数的第一个负整数。例如,Int 将 -8.4 转换为 -9,而 Fix 函数将 -8.4 转换为 -8。 round(Expression[, numdecimalplaces])返回按指定位数进行四舍五入的数值。Expression是必选项。数值表达式 被四舍五入。Numdecimalplaces是可选项。数字表明小数点右边有多少位进行四舍五入。如果省略,则 Round 函数返回整数。
在这里举几个例子:
response.write round(3.14) '3
response.write round(3.55) '4
response.write round(3.1415,3) ' 3.142
asp中的几个取整函数fix(),int(),round()的用法的更多相关文章
- PHP取整函数:ceil,floor,round,intval的区别详细解析
floor -- 舍去法取整说明float floor ( float value ) 返回不大于 value 的下一个整数,将 value 的小数部分舍去取整.floor() 返回的类型仍然是 fl ...
- MATLAB中取整函数(fix, floor, ceil, round)的使用
MATLAB取整函数 1)fix(x) : 截尾取整. >> fix( [3.12 -3.12]) ans = 3 -3(2)floor(x):不超过x 的最大整数.(高斯取整) & ...
- paper 68 :MATLAB中取整函数(fix, floor, ceil, round)的使用
MATLAB取整函数 1)fix(x) : 截尾取整. >> fix( [3.12 -3.12]) ans = 3 -3 (2)floor(x):不超过x 的最大整数.(高 ...
- java中的几种取整函数
舍掉小数取整:Math.floor(2)=2 舍掉小数取整:Math.floor(2.1)=2 舍掉小数取整:Math.floor(2.5)=2 舍掉小数取整:Math.floor(2.9)=2 负数 ...
- java中的三种取整函数
舍掉小数取整:Math.floor(3.5)=3 四舍五入取整:Math.rint(3.5)=4 进位取整:Math.ceil(3.1)=4
- php学习笔记-PHP中的几个取整函数
floor是向下取整,比如4.5,它是在4和5之间的一个数,那么结果就是4. ceil是向上取整,比如3.7,它是在3和4之间的一个数,那么结果就是4. round是对一个数四舍五入,小数部分如果小于 ...
- SQL中的取整函数FLOOR、ROUND、CEIL、TRUNC、SIGN
1 trunc(value,precision)按精度(precision)截取某个数字,不进行舍入操作.2 round(value,precision)根据给定的精度(precision)输入数值. ...
- 【转】SQL中的取整函数FLOOR、ROUND、CEIL、TRUNC、SIGN
--------------------------------------------------------------------------1 trunc(value,precision)按精 ...
- 关于取整函数ceil(),floor(),round()函数得应用
ceil()返回向上取整最接近的整数. double ceil(double); floor()返回向下取整最接近的整数. double floor(double); round()用于对浮点数的四舍 ...
随机推荐
- Ext.useShims=true
Extjs的panel中嵌套ActiveX的插件,如PDF,但是Ext控件被遮罩 eg.在panel的tbar中加入下拉框,结果其下拉值看不到,原因就是被PDF给遮住了, 此时只需设置Ext.useS ...
- 访问修饰符(access modifier)。
1)public(公共的):被 public所修饰的属性和方法可以被有类访问. 所修饰的属性和方法可以被有类访问. 2)protected (受保护的):被protected所修饰的属性和方法可以在类 ...
- leetcode@ [131/132] Palindrome Partitioning & Palindrome Partitioning II
https://leetcode.com/problems/palindrome-partitioning/ Given a string s, partition s such that every ...
- HDU-4662 MU Puzzle 水题
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4662 倒推考虑长度就可以了. //STATUS:C++_AC_31MS_240KB #include ...
- A Tour of Go Methods with pointer receivers
Methods can be associated with a named type or a pointer to a named type. We just saw two Abs method ...
- iOS---RunLoop深度剖析
RunLoop 前言 RunLoop是iOS/OS开发中比较基础的一个概念,在苹果开发中用在事件处理,延迟加载,屏幕刷新等功能的处理,其实抛开语言,RunLoop是一个的架构模式,也就是RunLoop ...
- 用Modelsim仿真QuartusII综合后网表时库的添加方法(转)
这两天做综合后仿真,发现FPGA器件库又不会加了,无奈上网找方法.说起来不好意思,很早就接触Modelsim这个仿真软件了,可是没有好好琢磨.把这两天找的方法贴出来,再加上自己的理解,以后忘了可以上博 ...
- RocketMQ常用命令
转自:http://jameswxx.iteye.com/blog/2091971 1.1. 控制台使用 RocketMQ 提供有控制台及一系列控制台命令,用于管理员对主题,集群,broker 等信息 ...
- iOS 键盘框架IQKeyboardManager使用
框架地址:https://github.com/hackiftekhar/IQKeyboardManager AppDelegate.m文件中 #import <IQKeyboardMana ...
- Spring Quartz结合Spring mail定期发送邮件
文件配置例如以下: <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="htt ...