title: How to Map a double value to a float one In Java?
body: <p>At first glance, my question could seem a bit odd; but casting a double to a float value is not what i want. Since when you cast it, you just lose some precision with respect to the rules defined IEEE-754 and can't achieve actual mapping of a double value to the range of float; it is useless. The following expression works, but it is very very expensive when you have a great amount of input: </p>
  
  <pre><code>float mappedVal = (float)((val * MAX_FLOAT_VALUE + 1) / MAX_DOUBLE_VALUE);
  </code></pre>
  
  <p>Can I approximate the result to the "mappedVal" mentioned above via some sort of bitwise operations to speed-up the very same computation?</p>