Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Q
QueryR
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Julien Lopez
QueryR
Commits
b410472f
Commit
b410472f
authored
8 years ago
by
stepan
Browse files
Options
Downloads
Patches
Plain Diff
Fix BinaryArithmeticSpecial for NaN vs NA values
parent
668dce1a
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/binary/BinaryArithmeticSpecial.java
+7
-2
7 additions, 2 deletions
...racle/truffle/r/nodes/binary/BinaryArithmeticSpecial.java
with
7 additions
and
2 deletions
com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/binary/BinaryArithmeticSpecial.java
+
7
−
2
View file @
b410472f
...
...
@@ -70,7 +70,7 @@ public abstract class BinaryArithmeticSpecial extends RNode {
protected
double
doDoubles
(
double
left
,
double
right
)
{
if
(
RRuntime
.
isNA
(
left
)
||
RRuntime
.
isNA
(
right
))
{
checkFullCallNeededOnNA
();
return
RRuntime
.
DOUBLE_NA
;
return
isNaN
(
left
)
?
Double
.
NaN
:
RRuntime
.
DOUBLE_NA
;
}
return
getOperation
().
op
(
left
,
right
);
}
...
...
@@ -92,9 +92,14 @@ public abstract class BinaryArithmeticSpecial extends RNode {
}
}
protected
static
boolean
isNaN
(
double
value
)
{
return
Double
.
isNaN
(
value
)
&&
!
RRuntime
.
isNA
(
value
);
}
/**
* Adds integers handling.
*/
@TypeSystemReference
(
EmptyTypeSystemFlatLayout
.
class
)
abstract
static
class
IntegerBinaryArithmeticSpecial
extends
BinaryArithmeticSpecial
{
IntegerBinaryArithmeticSpecial
(
BinaryArithmetic
op
,
boolean
handleNA
)
{
...
...
@@ -123,7 +128,7 @@ public abstract class BinaryArithmeticSpecial extends RNode {
public
double
doDoubleInt
(
double
left
,
int
right
,
@Cached
(
"createBinaryProfile()"
)
ConditionProfile
naProfile
)
{
if
(
naProfile
.
profile
(
RRuntime
.
isNA
(
left
)
||
RRuntime
.
isNA
(
right
)))
{
checkFullCallNeededOnNA
();
return
RRuntime
.
DOUBLE_NA
;
return
isNaN
(
left
)
?
Double
.
NaN
:
RRuntime
.
DOUBLE_NA
;
}
return
getOperation
().
op
(
left
,
right
);
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment