<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Issue 3964: std::atan2 and std::pow overloads that take two std::valarray parameters 
should require the arguments to have the same length</title>
<meta property="og:title" content="Issue 3964: std::atan2 and std::pow overloads that take two std::valarray parameters 
should require the arguments to have the same length">
<meta property="og:description" content="C++ library issue. Status: New">
<meta property="og:url" content="https://cplusplus.github.io/LWG/issue3964.html">
<meta property="og:type" content="website">
<meta property="og:image" content="http://cplusplus.github.io/LWG/images/cpp_logo.png">
<meta property="og:image:alt" content="C++ logo">
<style>
  p {text-align:justify}
  li {text-align:justify}
  pre code.backtick::before { content: "`" }
  pre code.backtick::after { content: "`" }
  blockquote.note
  {
    background-color:#E0E0E0;
    padding-left: 15px;
    padding-right: 15px;
    padding-top: 1px;
    padding-bottom: 1px;
  }
  ins {background-color:#A0FFA0}
  del {background-color:#FFA0A0}
  table.issues-index { border: 1px solid; border-collapse: collapse; }
  table.issues-index th { text-align: center; padding: 4px; border: 1px solid; }
  table.issues-index td { padding: 4px; border: 1px solid; }
  table.issues-index td:nth-child(1) { text-align: right; }
  table.issues-index td:nth-child(2) { text-align: left; }
  table.issues-index td:nth-child(3) { text-align: left; }
  table.issues-index td:nth-child(4) { text-align: left; }
  table.issues-index td:nth-child(5) { text-align: center; }
  table.issues-index td:nth-child(6) { text-align: center; }
  table.issues-index td:nth-child(7) { text-align: left; }
  table.issues-index td:nth-child(5) span.no-pr { color: red; }
  @media (prefers-color-scheme: dark) {
     html {
        color: #ddd;
        background-color: black;
     }
     ins {
        background-color: #225522
     }
     del {
        background-color: #662222
     }
     a {
        color: #6af
     }
     a:visited {
        color: #6af
     }
     blockquote.note
     {
        background-color: rgba(255, 255, 255, .10)
     }
  }
</style>
</head>
<body>
<hr>
<p><em>This page is a snapshot from the LWG issues list, see the <a href="lwg-active.html">Library Active Issues List</a> for more information and the meaning of <a href="lwg-active.html#New">New</a> status.</em></p>
<h3 id="3964"><a href="lwg-active.html#3964">3964</a>. <code>std::atan2</code> and <code>std::pow</code> overloads that take two <code>std::valarray</code> parameters 
should require the arguments to have the same length</h3>
<p><b>Section:</b> 29.6.3.3 <a href="https://wg21.link/valarray.transcend">[valarray.transcend]</a> <b>Status:</b> <a href="lwg-active.html#New">New</a>
 <b>Submitter:</b> Jiang An <b>Opened:</b> 2023-07-28 <b>Last modified:</b> 2023-10-30</p>
<p><b>Priority: </b>4
</p>
<p><b>View all issues with</b> <a href="lwg-status.html#New">New</a> status.</p>
<p><b>Discussion:</b></p>
<p>
All binary operation between <code>std::valarray</code>s expect them to have the same length. 
But <code>std::atan2</code> and <code>std::pow</code> lack such <i>Preconditions</i>.
</p>

<p><i>[2023-10-30; Reflector poll]</i></p>

<p>
Set priority to 4 after reflector poll.
"Also need to say what those functions return."
"Paragraph 1 needs a correction for the functions that takes two operands."
"And those are arguments not operands."
</p>



<p id="res-3964"><b>Proposed resolution:</b></p>
<p>
This wording is relative to <a href="https://wg21.link/N4950" title=" Working Draft, Standard for Programming Language C++">N4950</a>.
</p>

<ol>

<li><p>Modify 29.6.3.3 <a href="https://wg21.link/valarray.transcend">[valarray.transcend]</a> as indicated:</p>

<blockquote>
<pre>
template&lt;class T&gt; valarray&lt;T&gt; abs (const valarray&lt;T&gt;&amp;);
template&lt;class T&gt; valarray&lt;T&gt; acos (const valarray&lt;T&gt;&amp;);
template&lt;class T&gt; valarray&lt;T&gt; asin (const valarray&lt;T&gt;&amp;);
template&lt;class T&gt; valarray&lt;T&gt; atan (const valarray&lt;T&gt;&amp;);
template&lt;class T&gt; valarray&lt;T&gt; atan2(const valarray&lt;T&gt;&amp;, const valarray&lt;T&gt;&amp;);
template&lt;class T&gt; valarray&lt;T&gt; atan2(const valarray&lt;T&gt;&amp;, const typename valarray&lt;T&gt;::value_type&amp;);
template&lt;class T&gt; valarray&lt;T&gt; atan2(const typename valarray&lt;T&gt;::value_type&amp;, const valarray&lt;T&gt;&amp;);
template&lt;class T&gt; valarray&lt;T&gt; cos (const valarray&lt;T&gt;&amp;);
template&lt;class T&gt; valarray&lt;T&gt; cosh (const valarray&lt;T&gt;&amp;);
template&lt;class T&gt; valarray&lt;T&gt; exp (const valarray&lt;T&gt;&amp;);
template&lt;class T&gt; valarray&lt;T&gt; log (const valarray&lt;T&gt;&amp;);
template&lt;class T&gt; valarray&lt;T&gt; log10(const valarray&lt;T&gt;&amp;);
template&lt;class T&gt; valarray&lt;T&gt; pow (const valarray&lt;T&gt;&amp;, const valarray&lt;T&gt;&amp;);
template&lt;class T&gt; valarray&lt;T&gt; pow (const valarray&lt;T&gt;&amp;, const typename valarray&lt;T&gt;::value_type&amp;);
template&lt;class T&gt; valarray&lt;T&gt; pow (const typename valarray&lt;T&gt;::value_type&amp;, const valarray&lt;T&gt;&amp;);
template&lt;class T&gt; valarray&lt;T&gt; sin (const valarray&lt;T&gt;&amp;);
template&lt;class T&gt; valarray&lt;T&gt; sinh (const valarray&lt;T&gt;&amp;);
template&lt;class T&gt; valarray&lt;T&gt; sqrt (const valarray&lt;T&gt;&amp;);
template&lt;class T&gt; valarray&lt;T&gt; tan (const valarray&lt;T&gt;&amp;);
template&lt;class T&gt; valarray&lt;T&gt; tanh (const valarray&lt;T&gt;&amp;);
</pre>
<blockquote>
<p>
-1- <i>Mandates</i>: A unique function with the indicated name can be applied (unqualified) to an operand of
type <code>T</code>. This function returns a value of type <code>T</code> or which can be unambiguously implicitly converted to
type <code>T</code>.
<p/>
<ins>-?- <i>Preconditions</i>: For <code>atan2</code> and <code>pow</code> overloads that take two <code>valarray</code> parameters, 
the corresponding array arguments have the same length.</ins>
</p>
</blockquote>
</blockquote>
</li>
</ol>





</body>
</html>
