Sage: Ticket #31984: Can pynac's calculations of special functions cause std::abs to overflow?
https://trac.sagemath.org/ticket/31984
<p>
The C++ function <code>std::abs</code> can overflow, because the twos-complement binary representation of an integer has a negative number (<code>-2^k</code>, where <code>k + 1</code> is the number of bits) whose negative requires an additional bit. Some bugs resulting from this are fixed in <a class="closed ticket" href="https://trac.sagemath.org/ticket/31585" title="#31585: defect: Wrong result due to integer overflow (in pynac?) (closed: fixed)">#31585</a>, but the other occurrences of <code>std::abs</code> in the pynac source code should also be examined, to determine whether they are also buggy.
</p>
<p>
There is one other occurrence of <code>std::abs</code> in numeric.cpp, but it seems to be safe, because it is taking the absolute value of a floating-point <code>double</code>, not an integer. (Furthermore, this <code>double</code> is known to be less than <code>10^200</code>.)
</p>
<p>
I think the remaining occurrences of <code>std::abs</code> are all in the file <strong>inifcns_nstdsums.cpp</strong>. (In particular, <code>std::abs(scale)</code> appears a few times, where <code>scale</code> is an <code>int</code> variable.) I think this code is computing the values of special functions that are defined by nested sums. (There is mention of "G transformation" and "Hoelder convolution".) It would be great if someone who understands this would take a look at the occurrences of <code>std::abs</code> in the file.
</p>
en-usSagehttps://trac.sagemath.org/chrome/site/logo_sagemath_trac.png
https://trac.sagemath.org/ticket/31984
Trac 1.2Dave MorrisWed, 16 Jun 2021 14:04:40 GMTdescription changed
https://trac.sagemath.org/ticket/31984#comment:1
https://trac.sagemath.org/ticket/31984#comment:1
<ul>
<li><strong>description</strong>
modified (<a href="/ticket/31984?action=diff&version=1">diff</a>)
</li>
</ul>
TicketDave MorrisThu, 17 Jun 2021 02:22:39 GMTkeywords, description, summary changed
https://trac.sagemath.org/ticket/31984#comment:2
https://trac.sagemath.org/ticket/31984#comment:2
<ul>
<li><strong>keywords</strong>
<em>special</em> <em>functions</em> added
</li>
<li><strong>description</strong>
modified (<a href="/ticket/31984?action=diff&version=2">diff</a>)
</li>
<li><strong>summary</strong>
changed from <em>Pynac should be more careful when it uses std::abs</em> to <em>Can pynac's calculations of special functions cause std::abs to overflow?</em>
</li>
</ul>
TicketMatthias KöppeSun, 22 Aug 2021 20:35:10 GMTmilestone changed
https://trac.sagemath.org/ticket/31984#comment:3
https://trac.sagemath.org/ticket/31984#comment:3
<ul>
<li><strong>milestone</strong>
changed from <em>sage-9.4</em> to <em>sage-9.5</em>
</li>
</ul>
TicketMatthias KöppeSat, 18 Dec 2021 20:12:32 GMTmilestone changed
https://trac.sagemath.org/ticket/31984#comment:4
https://trac.sagemath.org/ticket/31984#comment:4
<ul>
<li><strong>milestone</strong>
changed from <em>sage-9.5</em> to <em>sage-9.6</em>
</li>
</ul>
TicketMatthias KöppeTue, 03 May 2022 15:17:06 GMTmilestone changed
https://trac.sagemath.org/ticket/31984#comment:5
https://trac.sagemath.org/ticket/31984#comment:5
<ul>
<li><strong>milestone</strong>
changed from <em>sage-9.6</em> to <em>sage-9.7</em>
</li>
</ul>
TicketMatthias KöppeMon, 19 Sep 2022 18:58:47 GMTmilestone changed
https://trac.sagemath.org/ticket/31984#comment:6
https://trac.sagemath.org/ticket/31984#comment:6
<ul>
<li><strong>milestone</strong>
changed from <em>sage-9.7</em> to <em>sage-9.8</em>
</li>
</ul>
Ticket