title: JAVA - double issue - ceil and floor functions
body: <p>I need to solve the issue related to the double representation.
  For example, I have the following set of values:</p>
  
  <pre><code>id: 1 val: 8.11               floor: 8.109999  ceil: 8.11
  id: 2 val: 8.31               floor: 8.31      ceil: 8.310001
  id: 3 val: 8.27               floor: 8.27      ceil: 8.27
  id: 4 val: 12.469999999999999 floor: 12.469999 ceil: 12.47
  id: 5 val: 1.9700000000000002 floor: 1.97      ceil: 1.970001
  </code></pre>
  
  <p>where </p>
  
  <pre><code>val = value coming from a certain operation,
  value_ceil = Math.ceil(value * 1000000)/1000000;
  value_floor = Math.floor(value * 1000000)/1000000;
  </code></pre>
  
  <p>As you can see, there are different "scenarios" which fit my needs:</p>
  
  <pre><code>* when the initial value is "ready" (= as expected):
      - all of them give me the desired output (id 3)
      - val and floor give me the desired output (id 2)
      - val and ceil give me the desired output (id 1)
  * when the initial value has to be "adjusted":
      - floor provides the desired output (id 5)
      - ceil provides the desired output (id 4 )
  </code></pre>
  
  <p>Is there a unique way to manage all the cases obtaining the desired double value?</p>
  
  <p>Thanks</p>
  
  <p>EDIT: Could</p>
  
  <pre><code>Math.round(value * 1000000.0)/1000000.0
  </code></pre>
  
  <p>solve the issue?</p>