冷灌 - 圆整至最接近5美分 [英] coldfusion - rounding to nearest 5 cents

查看:123
本文介绍了冷灌 - 圆整至最接近5美分的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在冷灌输中,如何将一个小数舍入到最接近的5美分?所以0.39675的数字将上舍入到0.40。如果数字是0.3690,它将下降到0.35。
我似乎找不到任何通过谷歌有用的东西。

In coldfusion, how does one round a decimal to the nearest 5 cents? So that a figure of 0.39675 would round up to 0.40. And if the figure was 0.3690, it would round down to 0.35. I can't seem to find anything useful via google.

对于简短的问题,但我认为这是我可以真正输入。 >

Sorry for the brief question, but I think that's all I can really input.

推荐答案

乘以20,再除以20:

Multiply by 20, round it, divide by 20:

  RoundedNumber = ( Round( Number * 20 ) / 20 )

这篇关于冷灌 - 圆整至最接近5美分的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆