title: Largest value representable by a floating-point type smaller than 1
body: <p>Is there a way to obtain the greatest value representable by the floating-point type <code>float</code> which is smaller than <code>1</code>.</p>
  <p>I've <a href="https://www.pbr-book.org/" rel="noreferrer">seen the following definition</a>:</p>
  <pre><code>static const double DoubleOneMinusEpsilon = 0x1.fffffffffffffp-1;
  static const float FloatOneMinusEpsilon = 0x1.fffffep-1;
  </code></pre>
  <p>But is this really how we should define these values?</p>
  <p>According to the Standard, <code>std::numeric_limits&lt;T&gt;::epsilon</code> is the machine epsilon, that is, the difference between 1.0 and the next value representable by the floating-point type <code>T</code>. But that doesn't necessarily mean that defining <code>T(1) - std::numeric_limits&lt;T&gt;::epsilon</code> would be better.</p>