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
160a4c53
Commit
160a4c53
authored
10 years ago
by
Michael Haupt
Browse files
Options
Downloads
Patches
Plain Diff
fix NaN checks in unary arithmetic
parent
848c43de
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.runtime/src/com/oracle/truffle/r/runtime/ops/UnaryArithmetic.java
+3
-3
3 additions, 3 deletions
...src/com/oracle/truffle/r/runtime/ops/UnaryArithmetic.java
with
3 additions
and
3 deletions
com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ops/UnaryArithmetic.java
+
3
−
3
View file @
160a4c53
...
...
@@ -147,7 +147,7 @@ public abstract class UnaryArithmetic extends Operation {
double
intx
;
int
dig
;
if
(
x
==
Double
.
NaN
||
digits
==
Double
.
NaN
)
{
if
(
Double
.
is
NaN
(
x
)
||
Double
.
is
NaN
(
digits
)
)
{
return
x
+
digits
;
}
if
(!
RRuntime
.
isFinite
(
x
))
{
...
...
@@ -189,7 +189,7 @@ public abstract class UnaryArithmetic extends Operation {
private
double
rpowdi
(
double
x
,
int
n
)
{
double
result
=
1.0
;
if
(
x
==
Double
.
NaN
)
{
if
(
Double
.
is
NaN
(
x
)
)
{
return
x
;
}
if
(
n
!=
0
)
{
...
...
@@ -238,7 +238,7 @@ public abstract class UnaryArithmetic extends Operation {
}
return
pow
.
op
(
x
,
y
);
}
if
(
x
==
Double
.
NaN
||
y
==
Double
.
NaN
)
{
if
(
Double
.
is
NaN
(
x
)
||
Double
.
is
NaN
(
y
)
)
{
return
x
+
y
;
// assuming IEEE 754; otherwise return NaN
}
if
(!
RRuntime
.
isFinite
(
x
))
{
...
...
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