Skip to main content
11 events
when toggle format what by license comment
Apr 4, 2019 at 6:00 history tweeted twitter.com/StackSciComp/status/1113682787645763584
Apr 3, 2019 at 13:01 vote accept user14717
Apr 3, 2019 at 4:30 answer added njuffa timeline score: 14
Apr 3, 2019 at 3:55 comment added njuffa I have repro and I think I have identified the culprit. sin of large arguments polluted by rounding error. Suggest switching sin to sin_pi: return y*sin(pi<Real>()*x)/pi<Real>(); --> return y*boost::math::sin_pi(x)/pi<Real>(); Note: I used my own sinpi from this answer instead of Boost.
Apr 2, 2019 at 23:16 comment added user14717 The compilation is with g++-8 -O3 -march=native; none of these flags break IEEE compliance. I feel like my reference function has no need for skepticism, esp. since I draw the test values away from it's problematic range as |x| -> 1.
Apr 2, 2019 at 20:38 comment added njuffa (1) Make sure you are compiling with strictest adherence to IEEE-754 (for my Intel compiler that is /fp:strict for example). (2) Try explicitly using of fma() as extensively as possible (convert divisions to multiplication if need be) to guard against subtractive cancellation when combining products. (3) Be skeptical of your reference function, as it may have numerical issues, too. I would suggest using triple the precision of the actual computation you are trying to implement.
Apr 2, 2019 at 19:48 comment added user14717 I believe (1) is discussed by Higham where he demonstrates it doesn't work; see doi.org/10.1137/0914050, I just tried (2), and it doesn't help. The summation condition number is not large at the abscissas where the unit tests fail (I computed it around to be ~5 at the problem abscissas.) There are abscissas where the condition number is ~3000, at those points, the unit tests pass.
Apr 2, 2019 at 18:20 comment added njuffa Have you tried (1) Accumulating positive and negative terms separately and subtracting at the end (2) Compensated addition (Kahan summation)?
Apr 2, 2019 at 15:38 history edited user14717 CC BY-SA 4.0
added 941 characters in body
Apr 2, 2019 at 15:00 history edited user14717 CC BY-SA 4.0
deleted 51 characters in body; edited tags
Apr 2, 2019 at 14:38 history asked user14717 CC BY-SA 4.0