简体   繁体   English

在使用Linq-to-SQL进行浮点运算的数据库和对象中应该使用哪种类型?

[英]What type should I use in Database and Objects using Linq-to-SQL for floating point?

I have 2 fields and I need these to be a floating decimal point. 我有2个字段,我需要将它们作为一个浮动的小数点。 I wonder what data type to use while I'm designing bottom-up Linq-to-SQL classes. 我想知道在设计自底向上的Linq-to-SQL类时要使用哪种数据类型。

EG: one value is 1.427600, another value is 1765.030, both would be in the same property/column. EG:一个值是1.427600,另一个值是1765.030,两者都在同一个属性/列中。

Use System.Decimal , if you require the accuracy. 如果需要精度,请使用System.Decimal

Decimal will represent both your example values accurately. 小数将准确表示两个示例值。

为什么不使用浮点型或十进制类型?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM