格式为双倍至8位小数

格式为双倍至8位小数

本文介绍了格式为双倍至8位小数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个方法,我想以8 dp的双倍返回。

I have a method that i want to return as a double with 8 dp.

所以我有一个值从一个sp回来,在代码我是简单地做一个

so i have a value coming back from a sp and in the code i am simply doing

CheckSum = double.Parse(cmd.ExecuteScalar().ToString());

但是,如果sp返回这个:1541338.2349537
返回的double只有那些7dp,当我想要把尾随零。
喜欢这个.. 1541338.23495370

however, if the sp returns this :1541338.2349537the returned double only has those 7dp, when i would like it to put a trailing zero on.like this.. 1541338.23495370

我无法找到一个方法来双重格式化 - 即强制它为8dp,而不是返回格式化的字符串。
我不想做。
可以有人解释:)

i cant find a method on the double to format it - ie force it to 8dp, other than to return a formatted string.which i dont want to do.can someone explain please :)

谢谢

nat

推荐答案

double d = 0.123456789;
string sDisplayValue = d.ToString("0.00000000");

这篇关于格式为双倍至8位小数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-24 08:35