Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Yes, <a href="http://msdn.microsoft.com/en-us/library/364x0z75.aspx" rel="nofollow"><code>decimal</code></a> is designed for just that.</p> <p>However, do be aware that the range of the decimal type is smaller than a double. That is double can hold a larger value, but it does so by losing precision. Or, as stated on MSDN:</p> <blockquote> <p>The decimal keyword denotes a 128-bit data type. Compared to floating-point types, the decimal type has a greater precision and a smaller range, which makes it suitable for financial and monetary calculations. The approximate range and precision for the decimal type are shown in the following table.</p> </blockquote> <p>The primary difference between <code>decimal</code> and <code>double</code> is that <a href="http://floating-point-gui.de/" rel="nofollow"><code>decimal</code> is fixed-point and <code>double</code> is floating point</a>. That means that decimal stores an exact value, while <code>double</code> represents a value represented by a fraction, and is less precise. A <code>decimal</code>is 128 bits, so it takes the double space to store. Calculations on <code>decimal</code> is also slower (measure !).</p> <p>If you need even larger precision, then <code>BigInteger</code> can be used from .NET 4. (You will need to handle decimal points yourself). Here you should be aware, that BigInteger is immutable, so any arithmetic operation on it will create a new instance - if numbers are large, this might be crippling for performance.</p> <p>I suggest you look into exactly how precise you need to be. Perhaps your algorithm can work with normalized values, that can be smaller ? If performance is an issue, one of the built in floating point types are likely to be faster.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload