Skip to content
Snippets Groups Projects
Commit c5233106 authored by Lukas Stadler's avatar Lukas Stadler
Browse files

[GR-2738] Small fix in random functions.

parents 5a3ad189 67f34595
No related branches found
No related tags found
No related merge requests found
......@@ -188,7 +188,7 @@ public final class RandFunctionsNodes {
double bValue = b.getDataAt(i % bLength);
double cValue = c.getDataAt(i % cLength);
double value = function.execute(aValue, bValue, cValue, randProvider);
if (Double.isNaN(value) || value < Integer.MIN_VALUE || value > Integer.MAX_VALUE) {
if (Double.isNaN(value) || value <= Integer.MIN_VALUE || value > Integer.MAX_VALUE) {
nodeData.nan.enter();
nans = true;
result[i] = RRuntime.INT_NA;
......
......@@ -64267,7 +64267,7 @@ $`42`
[1] 2
 
 
##com.oracle.truffle.r.test.builtins.TestBuiltin_split.testSplitWithNames#Ignored.Unimplemented#
##com.oracle.truffle.r.test.builtins.TestBuiltin_split.testSplitWithNames#
#{ split(list(q=1, w=2L, e='x', r=T), as.factor(c('a', 'b', 'a')); }
Error: unexpected ';' in "{ split(list(q=1, w=2L, e='x', r=T), as.factor(c('a', 'b', 'a'));"
 
......@@ -138088,6 +138088,12 @@ Error in rbinom("aa", 10, 0.5) : invalid arguments
In addition: Warning message:
In rbinom("aa", 10, 0.5) : NAs introduced by coercion
 
##com.oracle.truffle.r.test.library.stats.TestExternal_rbinom.testRbinom#
#set.seed(42); rbinom(1, 2, 3)
[1] NA
Warning message:
In rbinom(1, 2, 3) : NAs produced
##com.oracle.truffle.r.test.library.stats.TestExternal_rbinom.testRbinom#
#set.seed(42); rbinom(10, 10, 0.5)
[1] 7 7 4 7 6 5 6 3 6 6
......@@ -36,5 +36,6 @@ public class TestExternal_rbinom extends TestBase {
assertEval("set.seed(42); rbinom(10, 2:10, c(0.1, 0.5, 0.9))");
assertEval("set.seed(42); rbinom(1:10, 2:10, c(0.1, 0.5, 0.9))");
assertEval("set.seed(42); rbinom(c(1,2), 11:12, c(0.1, 0.5, 0.9))");
assertEval("set.seed(42); rbinom(1, 2, 3)");
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment