diff --git a/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/RandFunctionsNodes.java b/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/RandFunctionsNodes.java index a0792babded9bea59dbdce3bc98c75732dd23191..93cd847a3d3b093e9e1a5afe3530ebe9a3290052 100644 --- a/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/RandFunctionsNodes.java +++ b/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/RandFunctionsNodes.java @@ -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; diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/ExpectedTestOutput.test b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/ExpectedTestOutput.test index 97ee2e21c5d4fa5497739d8608f0cbc915a9f5fb..5a21cdda8a00bd854d68f8860b6a5867fe362d7c 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/ExpectedTestOutput.test +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/ExpectedTestOutput.test @@ -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 diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/library/stats/TestExternal_rbinom.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/library/stats/TestExternal_rbinom.java index 74edb90098582d5d455debbf565fd715f0b4b791..e4b346612af670838d4aa652b65c0b368db3f576 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/library/stats/TestExternal_rbinom.java +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/library/stats/TestExternal_rbinom.java @@ -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)"); } }