I'm thinking floats. For the record I'm also using NHibernate.
For (0.00% to 100.00%) you need decimal(5,2) and for (0% to 100%) it's better to use int if you don't need decimal points.
CSharp Online Training The percent ("P") format specifier is used to multiply a number by 100. It converts the number into a string representing a % (percentage). In the same way, using (“P1”), would only include a single vale after decimal-point.
The most common way to represent a percentage is with floating-point numbers, that way you have some decimal precision such as 33.25 percent. The thing to always remember is what percent really means. It means Per 100.
decimal
You won't lose precision due to rounding.
The answer is application-dependent.
Others have pointed out that decimal is better than float for representing an exact value. But sometimes it's better to use a float for the increased precision (e.g. a set of calculated weights that add up to 100% is probably better represented as a float)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With