-
-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make merge.xts error if index contains NA
There were cases where merge.xts would not throw an error if the index contained NA values. One case was if the index was integer, because the section of code that checked for integer NA was referencing the real_*index references instead of int_*index. After fixing that bug, the issue still remained for integer indexes. Now the issue is that NA_INTEGER = INT_MIN, so logical operations still work. But they don't give the results we want. Fix the issue by checking for NA_INTEGER before any other logical comparisons. Added similar checks for the real/double index case as well, and also moved the check to the top of the if/else branch. Note that the test now uses R_FINITE to check for NaN and +/-Inf as well. I really do not like these checks in the first position of the if/else branch because they should never happen in user space. For performance, the most commonly true if statements should come first. Need to look for an upstream place to check for NA in the index. Fixes #174.
- Loading branch information
1 parent
c24c682
commit 6401ccf
Showing
2 changed files
with
55 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters