title: Converting a long double to double with upward (or downward) rounding
body: <p>Assume that we are working on a platform where the type <code>long double</code> has a strictly greater precision than 64 bits. What is the fastest way to convert a given <code>long double</code> to an ordinary double-precision number with some prescribed rounding (upward, downward, round-to-nearest, etc.)?</p>
  
  <p>To make the question more precise, let me give a concrete example: Let <code>N</code> be a given <code>long double</code>, and <code>M</code> be the <code>double</code> whose value minimizes the (real) value <code>M - N</code> such that <code>M</code> > <code>N</code>. This <code>M</code> would be the upward rounded conversion I want to find.</p>
  
  <p>Can I get away with setting the rounding mode of the FP environment appropriately and performing a simple cast (e.g. <code>(double) N</code>)?</p>
  
  <p><em>Clarification</em>: You can assume that the platform supports the IEEE Standard for Floating-Point Arithmetic (IEEE 754).</p>