数据库中的最佳货币格式 [英] Best Currency format in database
问题描述
什么是我的数据库连同我的ASP.NET web应用程序使用最好的货币格式。我不知道是否浮动或十进制更好。请注意,我不需要文化的特定设置。
What is the best currency format to use in my database in conjunction with my ASP.NET web app. I am not sure if float or decimal is better. Please note, I will not need culture specific settings.
推荐答案
如果您正在使用SQL Server,你有'钱'型,转化为在.NET小数类型。
If you're using SQL Server, you have the 'money' type, which translates to a decimal type in .NET.
十进制是128bit的基座10浮点数,而不是一个二进制浮点数(它浮/长是),这使得它使得在大多数情况下,它不会失去precision,不同于二进制浮点数,其中有精度损失作为其设计的一部分。
Decimal is a 128bit base 10 floating point number, rather than a binary floating point (which float/long are), which makes it so that in most cases it doesn't lose precision, unlike binary floating point numbers, which have accuracy loss as part of their design.
这篇关于数据库中的最佳货币格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!