title: Why don't applications typically use int to internally represent currency values?
body: <p>Why don't applications typically use an integer datatype (such as <code>int</code> or <code>long</code> in C++/Java/C#) to represent currency values internally, as opposed to using a floating-point datatype (<code>float</code>, <code>double</code>) or something like Java's <code>BigDecimal</code>?</p>
  
  <p>For example, if I'm writing a Java application and I have a variable that I want to represent an actual value in U.S. dollars (no need to represent fractions of pennies), I could declare an <code>int</code> value that represents the number of cents. For example, a value of "$1.00" would be represented as 100.  This seems like a good alternative to using a <code>double</code> (see question <a href="https://stackoverflow.com/questions/3730019/why-not-use-double-or-float-to-represent-currency">Why not use Double or Float to represent currency?</a>) or a <code>BigDecimal</code> (which is a more heavyweight object than a simple primitive <code>int</code>).</p>
  
  <p>Obviously, the integer value would need to be "translated" (i.e. from 100 to "$1" or "$1.00") before displaying it to a user, or upon user input of a currency value, but this doing this doesn't seem significantly more burdensome than formatting a <code>double</code> or a <code>BigDecimal</code> for display.</p>
  
  <p>Why isn't this approach a best practice among applications that don't need to represent fractions of cents (or the equivalent in other currency types)?</p>