r-lib / slider

Sliding Window Functions
https://slider.r-lib.org
Other
295 stars 12 forks source link

Fix `NA` vs `NaN` propagation differences on valgrind #199

Closed DavisVaughan closed 9 months ago

DavisVaughan commented 9 months ago

Closes #198

Basically, if a test combined both NA and NaN in the same sum/mean/prod calculation then the result is essentially up in the air as to whether it will be another NA or NaN.

While I was actually trying to test this difference before by using expect_identical(), it isn't really worth the effort since the base equivalents don't make any promises about it either.

The easiest fix is to just switch to expect_equal() where NA_real_ and NaN are considered equivalent.