<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
  <meta name="generator" content=
  "HTML Tidy for OS/2 (vers 1 September 2005), see www.w3.org">
<style type="text/css">
      del { font-weight:bold;background-color:#ffa0a0 }
      ins { font-weight:bold;background-color:#a0ffa0 }
      blockquote {
      display: block;
      font-family: "Times New Roman";
      background-color:lightgray;
      margin-top: 1em;
      margin-bottom: 1em;
      margin-left: 40px;
      margin-right: 40px
      }
</style>

  <title>26zz: Quantum exponent of NaN</title>
</head>

<body>
  <p><br>
  <!-- Who are the authors... -->
   <b>Submitter:</b>CFP group<br>
  <!-- What is the date of submission. yyyy-mm-dd -->
   <b>Submission Date:</b> 2021-??-??<br>
  <b>Document:</b> WG14 26zz<br>
  <b>Title:</b> 26zz: Quantum exponent of NaN<br>
  <b>Reference Documents:</b> N2596, IEEE 754-2019</p>

  <p>Summary: Q(x) is used to denote the quantum exponent of
  decimal floating-point x. Q(infinity) is defined as infinity.
  Some math functions make reference to Q(NAN). However, Q(NAN) is
  not defined in either C23 or IEEE 754-2019.</p>

  <p>5.2.4.2.3 paragraph 9 says the preferred quantum exponent is
  specified by IEEE 754-2019.</p>

  <p>The table of Preferred quantum exponents in paragraph 10 of
  5.2.4.2.3 makes reference to Q(x) and preferred quantum exponent
  of the result.</p>

  <p>There are five cases where a NaN operand does not produce a
  NaN result for math functions. While the result's value is
  defined, the quantum exponent of that result is not well defined
  -- mainly because Q(NAN) is not defined.</p>

  <ul>
    <li>compoundn(NAN,0) -- F.10.4.2 says value is 1. The table in
    5.2.4.2.3 says its quantum exponent is
    floor(0*min(0,Q(NAN))).</li>

    <li>hypot(+/-INFINITY,NAN) -- F.10.4.4 says value is +INFINITY.
    The table in 5.2.4.2.3 says its quantum exponent is
    min(Q(+/-INFINITY),Q(NAN)).</li>

    <li>pow(1,NAN) -- F.10.4.5 says value is 1. The table in
    5.2.4.2.3 says its quantum exponent is floor(NAN*Q(1)).</li>

    <li>pow(NAN,0) -- F.10.4.5 says value is 1. The table in
    5.2.4.2.3 says its quantum exponent is floor(0*Q(NAN)).</li>

    <li>pown(NAN,0) -- F.10.4.6 says value is 1. The table in
    5.2.4.2.3 says its quantum exponent is floor(0*Q(NAN)).</li>
  </ul>

  <p>There are many cases where an infinity operand does not
  produce an infinity result for math functions. While the result's
  value is defined, the quantum exponent of that result is
  sometimes not well defined -- mainly because zero*infinity is not
  defined.</p>

  <ul>
    <li>pow(1,infinity) -- F.10.4.5 says value is 1. The table in
    5.2.4.2.3 says its quantum exponent is floor(infinity*Q(1)) --
    which could be infinity*zero.</li>

    <li>pow(infinity,0) -- F.10.4.5 says value is 1. The table in
    5.2.4.2.3 says its quantum exponent is floor(0*Q(infinity)) --
    which is zero*infinity.</li>

    <li>pown(infinity,0) -- F.10.4.6 says value is 1. The table in
    5.2.4.2.3 says its quantum exponent is floor(0*Q(infinity)) --
    which is zero*infinity.</li>
  </ul>

  <p>These appear to be defects in IEEE 754-2019.</p>

  <p>Suggested changes to C23: Change 5.2.4.2.3, paragraph 10
  from:</p>

  <blockquote>
    The following table shows, for each operation delivering a
    result in decimal floating-point format, how the preferred
    quantum exponents of the operands, Q(x), Q(y), etc., determine
    the preferred quantum exponent of the operation result.
  </blockquote>to

  <blockquote>
    The following table shows, for each operation delivering a
    result in decimal floating-point format, how the preferred
    quantum exponents of the operands, Q(x), Q(y), etc., determine
    the preferred quantum exponent of the operation
    result<del>.</del><ins>, provided the table formula is defined
    for the arguments. Cases where the formula is undefined
    (because of infinities and NaNs) are covered by the observation
    that an infinite result always has a quantum exponent of
    infinity (so its preferred quantum exponent is immaterial), and
    the additional rule:</ins>

    <p><ins>A finite result from a NaN or infinity operand has a
    preferred quantum exponent of 0.</ins></p>
  </blockquote>
</body>
</html>