ELIFE-ASU/Inform

Unexpected NaN for reasonable history lengths

Closed this issue · 0 comments

The Bug
The active information algorithm fails and returns an untagged NaN when the requested history length is 29 or greater.

Confirmed on Platforms

  • OS X 10.11 (Apple LLVM 7.3.0)
  • Debian 8 (GCC 4.9.2).

Sample Code

#include "inform/inform.h"
#include "assert.h"

uint64_t* random_series(size_t size, uint64_t base);

int main()
{
    uint64_t *series = random_series(1000, 2);
    assert!(isnan(inform_active_info(series, 1000, 2, 28))); // succeeds
    assert(isnan(inform_active_info(series, 1000, 2, 28))); // fails
}

There is probably a 32-bit integer somewhere that is overflowing.

Possible Fixes

  • Fix the (hypothetical) overflow
  • Make the NaN return explicit and tag it with an error code.