[英]How to get 6 decimal precision using vb.net
How to get 6 decimal precision using vb.net as in this example (7090982.885183 (6 decimal places precision)) ie i want to read the .885183 in my previous sample as 6 decimal only. 如何在本例中使用vb.net来获取6位小数精度(7090982.885183(6位小数精度)),即我想将上一个示例中的.885183读为6位小数。
The javascript for the above looks like : 上面的javascript看起来像:
//declare variables and assign calculated values
var HashA = OrdNo * Amt;
var HashB = MerchID * Amt;
var HashC = MerchID * OrdNo;
var TotalHash = String((HashA + HashB + HashC) / (parseInt(MerchID) + parseInt(RCode)));
//assign only 6 decimal places value
if (TotalHash.indexOf(".") != -1)
TotalHash = TotalHash.substr(0,TotalHash.indexOf(".")+7);
else
TotalHash = TotalHash + ".000000";
document.form1.HashCount.value = TotalHash;
} }
I need to read this no 7090982.8851830000011 as this format 7090982.885183 我需要阅读此编号7090982.8851830000011,因为此格式为7090982.885183
What about using % operater like 怎么样使用%operator这样
you have an variable a and variable decimalresult you should code it like this 你有一个变量a和一个十进制变量结果,你应该这样编码
decimalresult=a % 1000000
In this example it should be 在这个例子中应该是
decimalresult= 7090982.885183 % 1000000
decimalresult = 885183
如果您使用的是Decimal
并且想要获取小数点后的值,则可以
result = input - Math.Floor(input)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.