asp 取一个数的整数 但不是四舍五入,只要有小数,就取大于这个数的整数
asp 取一个数的整数 但不是四舍五入,只要有小数,就取大于这个数的整数
发布时间:2016-12-29 来源:查字典编辑
摘要:如:0.625取12.1取33.6取4athenb=fix(a)elseb=fix(a)+1response.writebendif%>或者...

如:

0.625 取 1

2.1 取3

3.6 取4

<%

if fix(a)>a then

b=fix(a)

else

b=fix(a)+1

response.write b

end if

%>

或者:

<%

a=0.625

if a<>fix(a) then

a=fix(a)+1

else

a=fix(a)

end if

response.write a

%>

(注:这个测试成功!)

-------------

如果用:

<%

a=0.625

if a<>cint(a) then

a=cint(a)+1

response.write a

end if

%>

(注:这个如果a=0.625,返回的就变成2,而不是变成1.)

推荐文章
猜你喜欢
附近的人在看
推荐阅读
拓展阅读
相关阅读
网友关注
最新ASP教程学习
热门ASP教程学习
编程开发子分类