有没有在.NET十进制值1M和1.0000米之间的实际差别? [英] Is there any practical difference between the .net decimal values 1m and 1.0000m?

查看:88
本文介绍了有没有在.NET十进制值1M和1.0000米之间的实际差别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有在.NET十进制值1M和1.0000米之间的实际差别

Is there any practical difference between the .net decimal values 1m and 1.0000m?

内部存储不同的是:

1m      : 0x00000001 0x00000000 0x00000000 0x00000000
1.0000m : 0x000186a0 0x00000000 0x00000000 0x00050000

但是,是在那里有的显著数字的知识将通过在BCL?

But, is there a situation where the knowledge of "significant digits" would be used by a method in the BCL?

我的方法中使用的情况下问,因为我正在压缩为磁盘存储或网络传输十进制值所需的空间的手段,并正与正常化的价值理念玩弄之前,我保存它来改善它​​的可压缩性。但是,我想知道这是否是容易造成上下行的问题。我猜测,它应该是罚款,但只是因为我没有看到暴露值的精度任何方法或属性。有谁知道,否则?

I ask because I'm working on a means of compressing the space required for decimal values for disk storage or network transport and am toying with the idea of "normalizing" the value before I store it to improve it's compressability. But, I'd like to know if it is likely to cause issues down the line. I'm guessing that it should be fine, but only because I don't see any methods or properties that expose the precision of the value. Does anyone know otherwise?

推荐答案

我能想到的唯一原因是为了调用'的ToString源返回确切的文字表述。代码

The only reason I can think of is so invoking `ToString returns the exact textual representation in the source code.

Console.WriteLine(1m); // 1
Console.WriteLine(1.000m); // 1.000

这篇关于有没有在.NET十进制值1M和1.0000米之间的实际差别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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