title: Ways around using a double as a key in a std set/map
body: <p>The problem of using doubles as keys in maps/sets is floating point precision. </p>
  
  <p>Some people have suggested adding an epsilon in your compare function, but that means your keys will no longer fulfil the necessary <em>strict weak ordering</em> criterion. This means that you will get a different set/map depending on the order of inserting your elements. </p>
  
  <p>In the case where you want to aggregate/combine/merge data based on double values, and are willing to allow a certain level of rounding/epsilon (clearly, you'll have to), is the following solution a good idea?</p>
  
  <p>Convert all the doubles (where we intended as keys) into integers by multiplying them by the precision factor (e.g. 1e8) and rounding to the nearest integer <code>(int)i+0.5</code>(if i>0), then create a set/map that keys off these integers. When extracting the final values of the keys, divide the ints by the precision factor to get the double value back (albeit rounded). </p>