Changes between Version 1 and Version 2 of Ticket #31984
 Timestamp:
 Jun 17, 2021, 2:22:39 AM (18 months ago)
Legend:
 Unmodified
 Added
 Removed
 Modified

Ticket #31984
 Property Keywords special functions added

Property
Summary
changed from
Pynac should be more careful when it uses std::abs
toCan pynac's calculations of special functions cause std::abs to overflow?

Ticket #31984 – Description
v1 v2 1 The C++ function `std::abs` can overflow, because the twoscomplement binary representation has a negative number (`2^k`, where `k + 1` is the number of bits) whose negative requires an additional bit. Some bugs resulting from this are fixed in #31585, but the other occurrences of `std::abs` in the pynac source code should also be examined, to determine whether they are also buggy.1 The C++ function `std::abs` can overflow, because the twoscomplement binary representation of an integer has a negative number (`2^k`, where `k + 1` is the number of bits) whose negative requires an additional bit. Some bugs resulting from this are fixed in #31585, but the other occurrences of `std::abs` in the pynac source code should also be examined, to determine whether they are also buggy. 2 2 3 (There is one other occurrence of `std::abs` in numeric.cpp, and several in inifcns_nstdsums.cpp.) 3 There is one other occurrence of `std::abs` in numeric.cpp, but it seems to be safe, because it is taking the absolute value of a floatingpoint `double`, not an integer. (Furthermore, this `double` is known to be less than `10^200`.) 4 5 I think the remaining occurrences of `std::abs` are all in the file **inifcns_nstdsums.cpp**. (In particular, `std::abs(scale)` appears a few times, where `scale` is an `int` 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 `std::abs` in the file.