我正在寻找一种方法将数字的小数部分向上或向下舍入到最接近的 .25、.5、.75 或整数 [英] I am looking for a way to round the decimal portion of numbers up or down to the nearest .25, .5, .75, or whole number

查看:47
本文介绍了我正在寻找一种方法将数字的小数部分向上或向下舍入到最接近的 .25、.5、.75 或整数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果小数部分为 0.1 到 0.12,则向下舍入到下一个较小的整数如果小数部分是 0.13 到 0.37,则四舍五入为 0.25如果小数部分是 0.38 到 0.62,则四舍五入为 0.5如果小数部分是 0.63 到 0.87,则四舍五入为 0.75如果小数部分为 0.88 或更大,则四舍五入到下一个更高的整数

If the decimal part is 0.1 to 0.12, it rounds down to the next lower integer If the decimal part is 0.13 to 0.37 it rounds to 0.25 If the decimal part is 0.38 to 0.62 it rounds to 0.5 If the decimal part is 0.63 to 0.87 it rounds to 0.75 If the decimal part is 0.88 or more, it rounds up to the next higher integer

推荐答案

乘以 4,四舍五入到最接近的整数,除以 4?

Multiply by 4, round to the nearest integer, divide by 4?

这篇关于我正在寻找一种方法将数字的小数部分向上或向下舍入到最接近的 .25、.5、.75 或整数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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