The MFI unit test in TTR fails when R is run under valgrind because the result of rowMeans is slightly different when R is run under valgrind. Specifically:
This causes x[63] > x[62] to be TRUE under valgrind when it's FALSE when running R without valgrind.
Prof Ripley explains the differences as,
One possible reason is that there will be more stores to memory and so the extended precision of x86_64 CPUs will be used less. I can confirm that via the use of flag -ffloat-store in gcc/gfortran...
A couple members of the CRAN team suggest having a tolerance for the logical comparison. While that would solve this specific issue, it wouldn't prevent a similar issue from occurring via a different logical comparison in another function. That would require adding a tolerance to all logical comparisons, which would be onerous.
The MFI unit test that fails under valgrind will succeed if the call to rowMeans(HLC) is replaced by a call to apply(HLC, 1, mean). rowMeans is also used in bollingerBands and CCI.
The
MFI
unit test in TTR fails when R is run under valgrind because the result ofrowMeans
is slightly different when R is run under valgrind. Specifically:This causes
x[63] > x[62]
to beTRUE
under valgrind when it'sFALSE
when running R without valgrind.Prof Ripley explains the differences as,
A couple members of the CRAN team suggest having a tolerance for the logical comparison. While that would solve this specific issue, it wouldn't prevent a similar issue from occurring via a different logical comparison in another function. That would require adding a tolerance to all logical comparisons, which would be onerous.
The
MFI
unit test that fails under valgrind will succeed if the call torowMeans(HLC)
is replaced by a call toapply(HLC, 1, mean)
.rowMeans
is also used inbollingerBands
andCCI
.