串翻番跳过最后一个小数,如果它是零? [英] string to double skips last decimal if it is zero?

查看:94
本文介绍了串翻番跳过最后一个小数,如果它是零?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下面是我的问题。

我需要转换说:5.550(字符串)为5.550
是双用3十进制数字将翻一番。
我已经试过的IFormatProvider在分析,但没有use.it保持跳过最后一个零()。
请指点。

I need to Convert say "5.550" (string) to double as 5.550 that is double with 3 decimal digits. i have tried IFormatProvider while parsing but no use.it keeps skipping last zero(). Please advice.

谢谢,
库马尔MA

Thanks, Kumar M A

推荐答案

双击不保留无关紧要的数字 - 据有1.5和1.50000之间没有差异为双击关注。

double doesn't keep insignificant digits - there's no difference between 1.5 and 1.50000 as far as double is concerned.

如果您想保留无关紧要的数字,使用小数来代替。这可能是更适合你的,这取决于您的具体内容。 (我们有很少的情况下在这里继续下去...)

If you want to preserve insignificant digits, use decimal instead. It may well be more appropriate for you anyway, depending on your exact context. (We have very little context to go on here...)

这篇关于串翻番跳过最后一个小数,如果它是零?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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