防止 Math.Round(95.55555555,2) 在 VB.NET 中四舍五入到 95.56 [英] Prevent Math.Round(95.55555555,2) from rounding to 95.56 in VB.NET

查看:35
本文介绍了防止 Math.Round(95.55555555,2) 在 VB.NET 中四舍五入到 95.56的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我在 VB.NET 中执行 Math.Round(95.55555555,2),结果是 95.56,但我希望结果是 95.55.有没有办法在 VB.NET 中做到这一点?我想我只想保留小数位,而不是四舍五入

If I do Math.Round(95.55555555,2) in VB.NET, the result is 95.56, but I want it the result the be 95.55. Is there a way to do this in VB.NET? I guess I just want to keep the decimal places, but not round them

推荐答案

看起来像 Math.Truncate(95.5555555 * 100)/100.
请参阅截断十进制数而不是四舍五入

这篇关于防止 Math.Round(95.55555555,2) 在 VB.NET 中四舍五入到 95.56的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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