title: How can I (safely) divide a maximum value, resulting in a floating point value?
body: <p>I want to calculate conversion factors. For this I have to divide the maximum value of e.g. ushort by the maximum value of uchar. </p>
  
  <p>I want to do this dynamically, by passing a parameter into a function or  a typename. Then I want to select the max values and perform the calculation.</p>
  
  <p>There are two problems: </p>
  
  <ol>
  <li>How do I dynamically select the max value?</li>
  <li>How can I safely divide the two values?</li>
  </ol>
  
  <p>All values are known to fit into the range of double.</p>
  
  <p>Ideally I would want to do something like:</p>
  
  <pre><code>double x = numeric_limits&lt;T&gt;::max / numeric_limits&lt;T2&gt;::max;
  </code></pre>
  
  <p>However that is not correct/possible.</p>