rafat / ctsa

A Univariate Time Series Analysis and ARIMA Modeling Package in ANSI C. Updated with SARIMAX and Auto ARIMA.
https://code.google.com/p/ctsa/
Other
58 stars 26 forks source link

Suspicious code triggers warnings #16

Open bavay opened 1 day ago

bavay commented 1 day ago

When enabling much more warnings, I get the following (with gcc version 11.4.0):

rafat commented 1 day ago

double params[0] is an old C convention and I am not sure how compatible it is with GCC 11.x so I'll have to check. As far as the floating point precision is concerned one way is to remove the lines 333-339 and set 340 to "} else if (x <= Float_Precision) {" but it might be a good idea to revisit the algorithm, which I haven't done in a few years, before doing that.

On Fri, Oct 25, 2024 at 10:06 PM Mathias Bavay @.***> wrote:

When enabling much more warnings, I get the following (with gcc version 11.4.0):

  • erfunc.c: warning: floating constant truncated to zero [-Woverflow] for lines 333 and 340
    • line 333 -> } else if( x < 1.0e-100 && x > 1.0e-1000 ) {
    • line 340 -> } else if (x <= 1.0e-1000) {
    • Are such comparisons required for some architectures that can handle such numbers? (the minimum value for a float is 2^31 - 1)
  • ctsa.h: warning: ISO C++ forbids zero-size array ‘params’ for lines 119, 146, 179, 199
    • all lines have the following: -> double params[0];
    • Is it something that should be replaced by a simple double? Or by double params[] ?

— Reply to this email directly, view it on GitHub https://github.com/rafat/ctsa/issues/16, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAI3RO4X3IPY2ZKZNLNVHXTZ5JXPRAVCNFSM6AAAAABQTUJVN6VHI2DSMVQWIX3LMV43ASLTON2WKOZSGYYTINJZGA4DGMI . You are receiving this because you are subscribed to this thread.Message ID: @.***>