Access开发培训
网站公告
·Access专家课堂QQ群号:151711184    ·Access快速开发平台下载地址及教程    ·欢迎加入Access专家课堂微信群!    ·如何快速搜索本站文章|示例|资料    
您的位置: 首页 > 技术文章 > Access数据库-模块/函数/VBA

[分享]真正的四舍五入的函数

时 间:2007-10-22 12:54:50
作 者:zhuyiwen   ID:42  城市:广州
摘 要:[分享]真正的四舍五入的函数
正 文:

public function roundtolarger(dblinput as double, intdecimals as integer) as double

'implements a variant of the round() function, that rounds-to-larger
'rather than rounds-to-even:

dim strformatstring as string 'format string

'if input is zero, just return zero. else format as appropriate:
if dblinput <> 0 then
strformatstring = "#." & string(intdecimals, "#")
roundtolarger = format(dblinput, strformatstring)
else
roundtolarger = 0
end if

end function
=====================================
? round(2.385, 2)
2.38
? roundtolarger(2.385, 2)
2.39

转自: www.tek-tips.com/faqs.cfm?spid=705&rat1=10&sfid=3734
本站来源: ACCESS中国 zhuyiwen

Access软件网官方交流QQ群 (群号:483923997)       Access源码网店

常见问答:

技术分类:

相关资源:

专栏作家

关于我们 | 服务条款 | 在线投稿 | 友情链接 | 网站统计 | 网站帮助