title: Representing probability in C++
body: <p>I'm trying to represent a simple set of 3 probabilities in C++. For example:</p>
  
  <pre><code>a = 0.1  
  b = 0.2  
  c = 0.7
  </code></pre>
  
  <p>(As far as I know probabilities must add up to 1)</p>
  
  <p>My problem is that when I try to represent 0.7 in C++ as a float I end up with 0.69999999, which won't help when I am doing my calculations later. The same for 0.8, 0.80000001.</p>
  
  <p>Is there a better way of representing numbers between 0.0 and 1.0 in C++?</p>
  
  <p>Bear in mind that this relates to how the numbers are stored in memory so that when it comes to doing tests on the values they are correct, I'm not concerned with how they are display/printed out.</p>