From 5913bafeba400de9e8ecc5d38a0c0e70c1158214 Mon Sep 17 00:00:00 2001
From: stepan <stepan.sindelar@oracle.com>
Date: Fri, 30 Dec 2016 18:02:17 +0100
Subject: [PATCH] Refactor common quantile search code from QPois and QBinom +
 tests

---
 .../oracle/truffle/r/library/stats/QPois.java |   54 +-
 .../truffle/r/library/stats/Qbinom.java       |   51 +-
 .../r/library/stats/QuantileSearch.java       |  120 ++
 .../oracle/truffle/r/library/stats/RMath.java |    8 +
 .../truffle/r/library/stats/Wilcox.java       |    4 +-
 .../builtin/base/BaseGammaFunctions.java      |    3 +-
 .../truffle/r/test/ExpectedTestOutput.test    | 1236 +++++++++--------
 .../test/library/stats/TestDistributions.java |   15 +-
 .../test/library/stats/TestStatFunctions.java |    6 +-
 mx.fastr/copyrights/overrides                 |    1 +
 10 files changed, 805 insertions(+), 693 deletions(-)
 create mode 100644 com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/QuantileSearch.java

diff --git a/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/QPois.java b/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/QPois.java
index 95f1096a5d..ff6ee1915e 100644
--- a/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/QPois.java
+++ b/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/QPois.java
@@ -41,7 +41,6 @@ public final class QPois implements Function2_2 {
             return e.result;
         }
 
-        double mu = lambda;
         double sigma = Math.sqrt(lambda);
         /* gamma = sigma; PR#8058 should be kurtosis which is mu^-0.5 */
         double gamma = 1.0 / sigma;
@@ -70,61 +69,18 @@ public final class QPois implements Function2_2 {
         // #ifdef HAVE_NEARBYINT
         // y = nearbyint(mu + sigma * (z + gamma * (z*z - 1) / 6));
         // #else
-        double y = Math.round(mu + sigma * (z + gamma * (z * z - 1) / 6));
-
-        z = ppois.evaluate(y, lambda, /* lower_tail */true, /* log_p */false);
+        double y = RMath.round(lambda + sigma * (z + gamma * (z * z - 1) / 6));
 
         /* fuzz to ensure left continuity; 1 - 1e-7 may lose too much : */
         p *= 1 - 64 * DBL_EPSILON;
 
-        /* If the mean is not too large a simple search is OK */
+        QuantileSearch search = new QuantileSearch((quantile, lt, lp) -> ppois.evaluate(quantile, lambda, lt, lp));
         if (lambda < 1e5) {
-            return search(y, z, p, lambda, 1).y;
+            /* If the mean is not too large a simple search is OK */
+            return search.simpleSearch(y, p, 1);
         } else {
             /* Otherwise be a bit cleverer in the search */
-            double incr = Math.floor(y * 0.001);
-            double oldincr;
-            do {
-                oldincr = incr;
-                SearchResult searchResult = search(y, z, p, lambda, incr);
-                y = searchResult.y;
-                z = searchResult.z;
-                incr = RMath.fmax2(1, Math.floor(incr / 100));
-            } while (oldincr > 1 && incr > lambda * 1e-15);
-            return y;
-        }
-    }
-
-    private SearchResult search(double yIn, double zIn, double p, double lambda, double incr) {
-        if (zIn >= p) {
-            /* search to the left */
-            double y = yIn;
-            for (;;) {
-                double z = zIn;
-                if (y == 0 || (z = ppois.evaluate(y - incr, lambda, /* l._t. */true, /* log_p */false)) < p) {
-                    return new SearchResult(y, z);
-                }
-                y = RMath.fmax2(0, y - incr);
-            }
-        } else { /* search to the right */
-            double y = yIn;
-            for (;;) {
-                y = y + incr;
-                double z;
-                if ((z = ppois.evaluate(y, lambda, /* l._t. */true, /* log_p */false)) >= p) {
-                    return new SearchResult(y, z);
-                }
-            }
-        }
-    }
-
-    private static final class SearchResult {
-        final double y;
-        final double z;
-
-        SearchResult(double y, double z) {
-            this.y = y;
-            this.z = z;
+            return search.iterativeSearch(y, p);
         }
     }
 }
diff --git a/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/Qbinom.java b/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/Qbinom.java
index 32e4f1df57..a11cdcb201 100644
--- a/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/Qbinom.java
+++ b/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/Qbinom.java
@@ -19,42 +19,9 @@ import com.oracle.truffle.r.runtime.RRuntime;
 // transcribed from qbinom.c
 
 public final class Qbinom implements StatsFunctions.Function3_2 {
-
-    private static final class Search {
-        private double z;
-
-        Search(double z) {
-            this.z = z;
-        }
-
-        double doSearch(double initialY, double p, double n, double pr, double incr, Pbinom pbinom1, Pbinom pbinom2) {
-            double y = initialY;
-            if (z >= p) {
-                /* search to the left */
-                for (;;) {
-                    double newz;
-                    if (y == 0 || (newz = pbinom1.evaluate(y - incr, n, pr, true, false)) < p) {
-                        return y;
-                    }
-                    y = Math.max(0, y - incr);
-                    z = newz;
-                }
-            } else { /* search to the right */
-                for (;;) {
-                    y = Math.min(y + incr, n);
-                    if (y == n || (z = pbinom2.evaluate(y, n, pr, true, false)) >= p) {
-                        return y;
-                    }
-                }
-            }
-        }
-    }
-
     private final BranchProfile nanProfile = BranchProfile.create();
     private final ConditionProfile smallNProfile = ConditionProfile.createBinaryProfile();
     private final Pbinom pbinom = new Pbinom();
-    private final Pbinom pbinomSearch1 = new Pbinom();
-    private final Pbinom pbinomSearch2 = new Pbinom();
 
     @Override
     public double evaluate(double initialP, double n, double pr, boolean lowerTail, boolean logProb) {
@@ -149,24 +116,14 @@ public final class Qbinom implements StatsFunctions.Function3_2 {
             y = n;
         }
 
-        z = pbinom.evaluate(y, n, pr, /* lowerTail */true, /* logP */false);
-
         /* fuzz to ensure left continuity: */
         p *= 1 - 64 * RRuntime.EPSILON;
 
-        Search search = new Search(z);
-
+        QuantileSearch search = new QuantileSearch(n, (quantile, lt, lp) -> pbinom.evaluate(quantile, n, pr, lt, lp));
         if (smallNProfile.profile(n < 1e5)) {
-            return search.doSearch(y, p, n, pr, 1, pbinomSearch1, pbinomSearch2);
+            return search.simpleSearch(y, p, 1);
+        } else {
+            return search.iterativeSearch(y, p, Math.floor(n * 0.001), 1e-15, 100);
         }
-        /* Otherwise be a bit cleverer in the search */
-        double incr = Math.floor(n * 0.001);
-        double oldincr;
-        do {
-            oldincr = incr;
-            y = search.doSearch(y, p, n, pr, incr, pbinomSearch1, pbinomSearch2);
-            incr = Math.max(1, Math.floor(incr / 100));
-        } while (oldincr > 1 && incr > n * 1e-15);
-        return y;
     }
 }
diff --git a/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/QuantileSearch.java b/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/QuantileSearch.java
new file mode 100644
index 0000000000..8ccd4a0070
--- /dev/null
+++ b/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/QuantileSearch.java
@@ -0,0 +1,120 @@
+/*
+ * This material is distributed under the GNU General Public License
+ * Version 2. You may review the terms of this license at
+ * http://www.gnu.org/licenses/gpl-2.0.html
+ *
+ * Copyright (C) 1998 Ross Ihaka
+ * Copyright (c) 2000-2016, The R Core Team
+ * Copyright (c) 2003-2016, The R Foundation
+ * Copyright (c) 2016, Oracle and/or its affiliates
+ *
+ * All rights reserved.
+ */
+package com.oracle.truffle.r.library.stats;
+
+/**
+ * Searches for a quantile of given random variable using it's distribution function. The search
+ * takes steps of given size until it reaches the quantile or until it steps over it. This class and
+ * its {@code {@link #simpleSearch(double, double, double)}} method correspond to several
+ * {@code do_search} functions in GnuR.
+ */
+public final class QuantileSearch {
+    /**
+     * This is the value of the distribution function where the search finished last time.
+     */
+    private double z;
+    private final double rightSearchLimit;
+    private final DistributionFunc distributionFunc;
+
+    /**
+     * @param rightSearchLimit If set to non-negative value, then the search to the right will be
+     *            limited by it
+     * @param distributionFunc The distribution function, all parameters except the quantile,
+     *            lowerTail, and logP are fixed.
+     */
+    public QuantileSearch(double rightSearchLimit, DistributionFunc distributionFunc) {
+        this.rightSearchLimit = rightSearchLimit;
+        this.distributionFunc = distributionFunc;
+    }
+
+    /**
+     * Constructs the object without {@code rightSearchLimit}.
+     */
+    public QuantileSearch(DistributionFunc distributionFunc) {
+        this.rightSearchLimit = -1;
+        this.distributionFunc = distributionFunc;
+    }
+
+    public double simpleSearch(double yIn, double p, double incr) {
+        z = distributionFunc.eval(yIn, true, false);
+        return search(yIn, p, incr);
+    }
+
+    /**
+     * Invokes {@link #simpleSearch(double, double, double)} iteratively dividing the increment step
+     * by {@code incrDenominator} until the step is greater than the result times the
+     * {@code resultFactor}, then the result is deemed 'close enough' and returned.
+     * 
+     * @param initialY where to start the search (quantile)
+     * @param p the target of the search (probability)
+     * @param initialIncr initial value for the increment step
+     * @param resultFactor see the method doc.
+     * @param incrDenominator see the method doc.
+     * @return the quantile (number close to it) for {@code p}.
+     */
+    public double iterativeSearch(double initialY, double p, double initialIncr, double resultFactor, double incrDenominator) {
+        assert initialIncr > 0. : "initialIncr zero or negative. Maybe result of too small initialY?";
+        double result;
+        double oldIncr;
+        double incr = initialIncr;
+        z = distributionFunc.eval(initialY, true, false);
+        do {
+            oldIncr = incr;
+            result = search(initialY, p, incr);
+            incr = RMath.fmax2(1, Math.floor(incr / incrDenominator));
+        } while (oldIncr > 1 && incr > result * resultFactor);
+        return result;
+    }
+
+    /**
+     * The same as {@link #iterativeSearch(double, double, double, double, double)}, but with
+     * default values for the missing parameters.
+     */
+    public double iterativeSearch(double initialY, double p) {
+        return iterativeSearch(initialY, p, Math.floor(initialY * 0.001), 1e-15, 100);
+    }
+
+    private double search(double yIn, double p, double incr) {
+        double y = yIn;
+        // are we to the left or right of the desired value -> move to the right or left to get
+        // closer
+        if (z >= p) {
+            while (true) {
+                if (y == 0 || (z = distributionFunc.eval(y - incr, true, false)) < p) {
+                    return y;
+                }
+                y = RMath.fmax2(0, y - incr);
+            }
+        } else {
+            while (true) {
+                y = moveRight(y, incr);
+                if ((rightSearchLimit > 0 && y == rightSearchLimit) || (z = distributionFunc.eval(y, true, false)) >= p) {
+                    return y;
+                }
+            }
+        }
+    }
+
+    private double moveRight(double y, double incr) {
+        if (rightSearchLimit < 0) {
+            return y + incr;
+        } else {
+            return RMath.fmin2(y + incr, rightSearchLimit);
+        }
+    }
+
+    @FunctionalInterface
+    public interface DistributionFunc {
+        double eval(double quantile, boolean lowerTail, boolean logP);
+    }
+}
diff --git a/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/RMath.java b/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/RMath.java
index 68347359d0..c3f9b54793 100644
--- a/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/RMath.java
+++ b/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/RMath.java
@@ -49,6 +49,14 @@ public final class RMath {
         return Math.floor(x + 0.5);
     }
 
+    /**
+     * Implementation of C routine {@code round}, which is not equal to {@code Math.round}, because
+     * it returns {@code double} and so it can handle values that do not fit into long.
+     */
+    public static double round(double x) {
+        return forceint(x);
+    }
+
     public static double fsign(double x, double y) {
         if (Double.isNaN(x) || Double.isNaN(y)) {
             return x + y;
diff --git a/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/Wilcox.java b/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/Wilcox.java
index 85ba665990..7f36653c93 100644
--- a/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/Wilcox.java
+++ b/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/Wilcox.java
@@ -41,8 +41,8 @@ public final class Wilcox {
                 throw RError.error(RError.SHOW_CALLER, CALLOC_COULD_NOT_ALLOCATE_INF);
             }
 
-            double m = Math.round(mIn);
-            double n = Math.round(nIn);
+            double m = RMath.round(mIn);
+            double n = RMath.round(nIn);
             if ((m < 0) || (n < 0)) {
                 // TODO: for some reason the macro in GNUR here returns NA instead of NaN...
                 // return StatsUtil.mlError();
diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/BaseGammaFunctions.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/BaseGammaFunctions.java
index 5b82397a22..6ddf11b6b0 100644
--- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/BaseGammaFunctions.java
+++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/BaseGammaFunctions.java
@@ -32,6 +32,7 @@ import com.oracle.truffle.api.dsl.NodeChild;
 import com.oracle.truffle.api.dsl.NodeChildren;
 import com.oracle.truffle.api.dsl.Specialization;
 import com.oracle.truffle.r.library.stats.GammaFunctions;
+import com.oracle.truffle.r.library.stats.RMath;
 import com.oracle.truffle.r.nodes.builtin.CastBuilder;
 import com.oracle.truffle.r.nodes.builtin.RBuiltinNode;
 import com.oracle.truffle.r.nodes.builtin.base.BaseGammaFunctionsFactory.DpsiFnCalcNodeGen;
@@ -235,7 +236,7 @@ public class BaseGammaFunctions {
                  * use Abramowitz & Stegun 6.4.7 "Reflection Formula" psi(k, x) = (-1)^k psi(k, 1-x)
                  * - pi^{n+1} (d/dx)^n cot(x)
                  */
-                if (x == Math.round(x)) {
+                if (x == RMath.round(x)) {
                     /* non-positive integer : +Inf or NaN depends on n */
                     // for(j=0; j < m; j++) /* k = j + n : */
                     // ans[j] = ((j+n) % 2) ? ML_POSINF : ML_NAN;
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 dc3c97220c..a737b28c29 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
@@ -111780,6 +111780,93 @@ In dbeta(0, Inf, 15, 0) : NaNs produced
 [1]      -Inf      -Inf      -Inf      -Inf      -Inf      -Inf -408.3969
 [8]      -Inf       NaN
 
+##com.oracle.truffle.r.test.library.stats.TestDistributions.testDensityFunctions#Output.MayIgnoreWarningContext#
+#dbinom(0, -1,  0.3)
+[1] NaN
+Warning message:
+In dbinom(0, -1, 0.3) : NaNs produced
+
+##com.oracle.truffle.r.test.library.stats.TestDistributions.testDensityFunctions#Output.MayIgnoreWarningContext#
+#dbinom(0, -Inf,  0.3)
+[1] NaN
+Warning message:
+In dbinom(0, -Inf, 0.3) : NaNs produced
+
+##com.oracle.truffle.r.test.library.stats.TestDistributions.testDensityFunctions#Output.MayIgnoreWarningContext#
+#dbinom(0, 20, -1)
+[1] NaN
+Warning message:
+In dbinom(0, 20, -1) : NaNs produced
+
+##com.oracle.truffle.r.test.library.stats.TestDistributions.testDensityFunctions#Output.MayIgnoreWarningContext#
+#dbinom(0, 20, -Inf)
+[1] NaN
+Warning message:
+In dbinom(0, 20, -Inf) : NaNs produced
+
+##com.oracle.truffle.r.test.library.stats.TestDistributions.testDensityFunctions#Output.MayIgnoreWarningContext#
+#dbinom(0, 20, Inf)
+[1] NaN
+Warning message:
+In dbinom(0, 20, Inf) : NaNs produced
+
+##com.oracle.truffle.r.test.library.stats.TestDistributions.testDensityFunctions#Output.MayIgnoreWarningContext#
+#dbinom(0, 20, NaN)
+[1] NaN
+
+##com.oracle.truffle.r.test.library.stats.TestDistributions.testDensityFunctions#Output.MayIgnoreWarningContext#
+#dbinom(0, Inf,  0.3)
+[1] 0
+
+##com.oracle.truffle.r.test.library.stats.TestDistributions.testDensityFunctions#Output.MayIgnoreWarningContext#
+#dbinom(0, NaN,  0.3)
+[1] NaN
+
+##com.oracle.truffle.r.test.library.stats.TestDistributions.testDensityFunctions#Output.MayIgnoreWarningContext#
+#dbinom(c(1, 10, 100, 500, 900, 1000), 10000, 0.01, log=F)
+[1]  2.271490e-42  6.821440e-31  4.006181e-02 8.661377e-182  0.000000e+00
+[6]  0.000000e+00
+
+##com.oracle.truffle.r.test.library.stats.TestDistributions.testDensityFunctions#Output.MayIgnoreWarningContext#
+#dbinom(c(1, 10, 100, 500, 900, 1000), 10000, 0.01, log=T)
+[1]   -95.888138   -69.460067    -3.217332  -416.911613 -1215.006067
+[6] -1449.113695
+
+##com.oracle.truffle.r.test.library.stats.TestDistributions.testDensityFunctions#Output.MayIgnoreWarningContext#
+#dbinom(c(1, 2, 10, 20, 21, -Inf, -0.42e-30, 0, 0.42e-30, Inf, NaN), 20, 0.3, log=F)
+ [1] 6.839337e-03 2.784587e-02 3.081708e-02 3.486784e-11 0.000000e+00
+ [6] 0.000000e+00 0.000000e+00 7.979227e-04 7.979227e-04 0.000000e+00
+[11]          NaN
+
+##com.oracle.truffle.r.test.library.stats.TestDistributions.testDensityFunctions#Output.MayIgnoreWarningContext#
+#dbinom(c(1, 2, 10, 20, 21, -Inf, -0.42e-30, 0, 0.42e-30, Inf, NaN), 20, 0.3, log=T)
+ [1]  -4.985064  -3.581071  -3.479686 -24.079456       -Inf       -Inf
+ [7]       -Inf  -7.133499  -7.133499       -Inf        NaN
+
+##com.oracle.truffle.r.test.library.stats.TestDistributions.testDensityFunctions#Output.MayIgnoreWarningContext#
+#dbinom(c(2), 10, -0.1, log=F)
+[1] NaN
+Warning message:
+In dbinom(c(2), 10, -0.1, log = F) : NaNs produced
+
+##com.oracle.truffle.r.test.library.stats.TestDistributions.testDensityFunctions#Output.MayIgnoreWarningContext#
+#dbinom(c(2), 10, -0.1, log=T)
+[1] NaN
+Warning message:
+In dbinom(c(2), 10, -0.1, log = T) : NaNs produced
+
+##com.oracle.truffle.r.test.library.stats.TestDistributions.testDensityFunctions#Output.MayIgnoreWarningContext#
+#dbinom(c(2), 10, 5, log=F)
+[1] NaN
+Warning message:
+In dbinom(c(2), 10, 5, log = F) : NaNs produced
+
+##com.oracle.truffle.r.test.library.stats.TestDistributions.testDensityFunctions#Output.MayIgnoreWarningContext#
+#dbinom(c(2), 10, 5, log=T)
+[1] NaN
+Warning message:
+In dbinom(c(2), 10, 5, log = T) : NaNs produced
+
 ##com.oracle.truffle.r.test.library.stats.TestDistributions.testDensityFunctions#Output.MayIgnoreWarningContext#
 #dcauchy(0, -Inf,  -1)
 [1] NaN
@@ -112392,6 +112479,63 @@ In dnorm(c(0), 0, -1, log = T) : NaNs produced
 #dnorm(c(4, -100, 0), 4, 4, log=T)
 [1]   -2.305233 -340.305233   -2.805233
 
+##com.oracle.truffle.r.test.library.stats.TestDistributions.testDensityFunctions#Output.MayIgnoreWarningContext#
+#dpois(0, -1)
+[1] NaN
+Warning message:
+In dpois(0, -1) : NaNs produced
+
+##com.oracle.truffle.r.test.library.stats.TestDistributions.testDensityFunctions#Output.MayIgnoreWarningContext#
+#dpois(0, -Inf)
+[1] NaN
+Warning message:
+In dpois(0, -Inf) : NaNs produced
+
+##com.oracle.truffle.r.test.library.stats.TestDistributions.testDensityFunctions#Output.MayIgnoreWarningContext#
+#dpois(0, 0)
+[1] 1
+
+##com.oracle.truffle.r.test.library.stats.TestDistributions.testDensityFunctions#Output.MayIgnoreWarningContext#
+#dpois(0, Inf)
+[1] 0
+
+##com.oracle.truffle.r.test.library.stats.TestDistributions.testDensityFunctions#Output.MayIgnoreWarningContext#
+#dpois(0, NaN)
+[1] NaN
+
+##com.oracle.truffle.r.test.library.stats.TestDistributions.testDensityFunctions#Output.MayIgnoreWarningContext#
+#dpois(c(0.1e-10, 0.1, 1, 10), 0.1e-6, log=F)
+[1] 9.999999e-01 0.000000e+00 9.999999e-08 2.755732e-77
+Warning message:
+In dpois(c(1e-11, 0.1, 1, 10), 1e-07, log = F) : non-integer x = 0.100000
+
+##com.oracle.truffle.r.test.library.stats.TestDistributions.testDensityFunctions#Output.MayIgnoreWarningContext#
+#dpois(c(0.1e-10, 0.1, 1, 10), 0.1e-6, log=T)
+[1]   -0.0000001         -Inf  -16.1180958 -176.2853692
+Warning message:
+In dpois(c(1e-11, 0.1, 1, 10), 1e-07, log = T) : non-integer x = 0.100000
+
+##com.oracle.truffle.r.test.library.stats.TestDistributions.testDensityFunctions#Output.MayIgnoreWarningContext#
+#dpois(c(1e99, 1e99*9.999, 1e100-1, 1e100, 1e100+100, 1e101), 1e100, log=F)
+[1] 0.000000e+00 0.000000e+00 3.989423e-51 3.989423e-51 3.989423e-51
+[6] 0.000000e+00
+
+##com.oracle.truffle.r.test.library.stats.TestDistributions.testDensityFunctions#Output.MayIgnoreWarningContext#
+#dpois(c(1e99, 1e99*9.999, 1e100-1, 1e100, 1e100+100, 1e101), 1e100, log=T)
+[1]  -6.697415e+99  -5.000167e+91  -1.160482e+02  -1.160482e+02  -1.160482e+02
+[6] -1.402585e+101
+
+##com.oracle.truffle.r.test.library.stats.TestDistributions.testDensityFunctions#Output.MayIgnoreWarningContext#
+#dpois(c(5, 10, 15, 20, 30, -Inf, -0.42e-30, 0, 0.42e-30, Inf, NaN), 10, log=F)
+ [1] 3.783327e-02 1.251100e-01 3.471807e-02 1.866081e-03 1.711572e-07
+ [6] 0.000000e+00 0.000000e+00 4.539993e-05 4.539993e-05 0.000000e+00
+[11]          NaN
+
+##com.oracle.truffle.r.test.library.stats.TestDistributions.testDensityFunctions#Output.MayIgnoreWarningContext#
+#dpois(c(5, 10, 15, 20, 30, -Inf, -0.42e-30, 0, 0.42e-30, Inf, NaN), 10, log=T)
+ [1]  -3.274566  -2.078562  -3.360495  -6.283915 -15.580684       -Inf
+ [7]       -Inf -10.000000 -10.000000       -Inf        NaN
+
 ##com.oracle.truffle.r.test.library.stats.TestDistributions.testDensityFunctions#Output.MayIgnoreWarningContext#
 #dunif(0, -3, -Inf)
 [1] NaN
@@ -112728,6 +112872,140 @@ In pbeta(0, 0.5, -Inf) : NaNs produced
 [1]    0.0000    0.0000    0.0000      -Inf      -Inf      -Inf -480.2879
 [8]    0.0000       NaN
 
+##com.oracle.truffle.r.test.library.stats.TestDistributions.testDistributionFunctions#Output.MayIgnoreWarningContext#
+#pbinom(0, -1,  0.3)
+[1] NaN
+Warning message:
+In pbinom(0, -1, 0.3) : NaNs produced
+
+##com.oracle.truffle.r.test.library.stats.TestDistributions.testDistributionFunctions#Output.MayIgnoreWarningContext#
+#pbinom(0, -Inf,  0.3)
+[1] NaN
+Warning message:
+In pbinom(0, -Inf, 0.3) : NaNs produced
+
+##com.oracle.truffle.r.test.library.stats.TestDistributions.testDistributionFunctions#Output.MayIgnoreWarningContext#
+#pbinom(0, 20, -1)
+[1] NaN
+Warning message:
+In pbinom(0, 20, -1) : NaNs produced
+
+##com.oracle.truffle.r.test.library.stats.TestDistributions.testDistributionFunctions#Output.MayIgnoreWarningContext#
+#pbinom(0, 20, -Inf)
+[1] NaN
+Warning message:
+In pbinom(0, 20, -Inf) : NaNs produced
+
+##com.oracle.truffle.r.test.library.stats.TestDistributions.testDistributionFunctions#Output.MayIgnoreWarningContext#
+#pbinom(0, 20, Inf)
+[1] NaN
+Warning message:
+In pbinom(0, 20, Inf) : NaNs produced
+
+##com.oracle.truffle.r.test.library.stats.TestDistributions.testDistributionFunctions#Output.MayIgnoreWarningContext#
+#pbinom(0, 20, NaN)
+[1] NaN
+
+##com.oracle.truffle.r.test.library.stats.TestDistributions.testDistributionFunctions#Output.MayIgnoreWarningContext#
+#pbinom(0, Inf,  0.3)
+[1] NaN
+Warning message:
+In pbinom(0, Inf, 0.3) : NaNs produced
+
+##com.oracle.truffle.r.test.library.stats.TestDistributions.testDistributionFunctions#Output.MayIgnoreWarningContext#
+#pbinom(0, NaN,  0.3)
+[1] NaN
+
+##com.oracle.truffle.r.test.library.stats.TestDistributions.testDistributionFunctions#Output.MayIgnoreWarningContext#
+#pbinom(c(1, 10, 100, 500, 900, 1000), 10000, 0.01, lower.tail=F, log.p=F)
+[1]  1.000000e+00  1.000000e+00  4.734375e-01 2.050740e-182  0.000000e+00
+[6]  0.000000e+00
+
+##com.oracle.truffle.r.test.library.stats.TestDistributions.testDistributionFunctions#Output.MayIgnoreWarningContext#
+#pbinom(c(1, 10, 100, 500, 900, 1000), 10000, 0.01, lower.tail=F, log.p=T)
+[1] -2.293977e-42 -7.562773e-31 -7.477354e-01 -4.183523e+02 -1.217181e+03
+[6] -1.451418e+03
+
+##com.oracle.truffle.r.test.library.stats.TestDistributions.testDistributionFunctions#Output.MayIgnoreWarningContext#
+#pbinom(c(1, 10, 100, 500, 900, 1000), 10000, 0.01, lower.tail=T, log.p=F)
+[1] 2.293977e-42 7.562773e-31 5.265625e-01 1.000000e+00 1.000000e+00
+[6] 1.000000e+00
+
+##com.oracle.truffle.r.test.library.stats.TestDistributions.testDistributionFunctions#Output.MayIgnoreWarningContext#
+#pbinom(c(1, 10, 100, 500, 900, 1000), 10000, 0.01, lower.tail=T, log.p=T)
+[1]  -9.587829e+01  -6.935690e+01  -6.413852e-01 -2.050740e-182   0.000000e+00
+[6]   0.000000e+00
+
+##com.oracle.truffle.r.test.library.stats.TestDistributions.testDistributionFunctions#Output.MayIgnoreWarningContext#
+#pbinom(c(1, 2, 10, 20, 21, -Inf, -0.42e-30, 0, 0.42e-30, Inf, NaN), 20, 0.3, lower.tail=F, log.p=F)
+ [1] 0.99236274 0.96451687 0.01714482 0.00000000 0.00000000 1.00000000
+ [7] 1.00000000 0.99920208 0.99920208 0.00000000        NaN
+
+##com.oracle.truffle.r.test.library.stats.TestDistributions.testDistributionFunctions#Output.MayIgnoreWarningContext#
+#pbinom(c(1, 2, 10, 20, 21, -Inf, -0.42e-30, 0, 0.42e-30, Inf, NaN), 20, 0.3, lower.tail=F, log.p=T)
+ [1] -0.0076665730 -0.0361279582 -4.0660594000          -Inf          -Inf
+ [6]  0.0000000000  0.0000000000 -0.0007982412 -0.0007982412          -Inf
+[11]           NaN
+
+##com.oracle.truffle.r.test.library.stats.TestDistributions.testDistributionFunctions#Output.MayIgnoreWarningContext#
+#pbinom(c(1, 2, 10, 20, 21, -Inf, -0.42e-30, 0, 0.42e-30, Inf, NaN), 20, 0.3, lower.tail=T, log.p=F)
+ [1] 0.0076372598 0.0354831323 0.9828551836 1.0000000000 1.0000000000
+ [6] 0.0000000000 0.0000000000 0.0007979227 0.0007979227 1.0000000000
+[11]          NaN
+
+##com.oracle.truffle.r.test.library.stats.TestDistributions.testDistributionFunctions#Output.MayIgnoreWarningContext#
+#pbinom(c(1, 2, 10, 20, 21, -Inf, -0.42e-30, 0, 0.42e-30, Inf, NaN), 20, 0.3, lower.tail=T, log.p=T)
+ [1] -4.87471641 -3.33869784 -0.01729349  0.00000000  0.00000000        -Inf
+ [7]        -Inf -7.13349888 -7.13349888  0.00000000         NaN
+
+##com.oracle.truffle.r.test.library.stats.TestDistributions.testDistributionFunctions#Output.MayIgnoreWarningContext#
+#pbinom(c(2), 10, -0.1, lower.tail=F, log.p=F)
+[1] NaN
+Warning message:
+In pbinom(c(2), 10, -0.1, lower.tail = F, log.p = F) : NaNs produced
+
+##com.oracle.truffle.r.test.library.stats.TestDistributions.testDistributionFunctions#Output.MayIgnoreWarningContext#
+#pbinom(c(2), 10, -0.1, lower.tail=F, log.p=T)
+[1] NaN
+Warning message:
+In pbinom(c(2), 10, -0.1, lower.tail = F, log.p = T) : NaNs produced
+
+##com.oracle.truffle.r.test.library.stats.TestDistributions.testDistributionFunctions#Output.MayIgnoreWarningContext#
+#pbinom(c(2), 10, -0.1, lower.tail=T, log.p=F)
+[1] NaN
+Warning message:
+In pbinom(c(2), 10, -0.1, lower.tail = T, log.p = F) : NaNs produced
+
+##com.oracle.truffle.r.test.library.stats.TestDistributions.testDistributionFunctions#Output.MayIgnoreWarningContext#
+#pbinom(c(2), 10, -0.1, lower.tail=T, log.p=T)
+[1] NaN
+Warning message:
+In pbinom(c(2), 10, -0.1, lower.tail = T, log.p = T) : NaNs produced
+
+##com.oracle.truffle.r.test.library.stats.TestDistributions.testDistributionFunctions#Output.MayIgnoreWarningContext#
+#pbinom(c(2), 10, 5, lower.tail=F, log.p=F)
+[1] NaN
+Warning message:
+In pbinom(c(2), 10, 5, lower.tail = F, log.p = F) : NaNs produced
+
+##com.oracle.truffle.r.test.library.stats.TestDistributions.testDistributionFunctions#Output.MayIgnoreWarningContext#
+#pbinom(c(2), 10, 5, lower.tail=F, log.p=T)
+[1] NaN
+Warning message:
+In pbinom(c(2), 10, 5, lower.tail = F, log.p = T) : NaNs produced
+
+##com.oracle.truffle.r.test.library.stats.TestDistributions.testDistributionFunctions#Output.MayIgnoreWarningContext#
+#pbinom(c(2), 10, 5, lower.tail=T, log.p=F)
+[1] NaN
+Warning message:
+In pbinom(c(2), 10, 5, lower.tail = T, log.p = F) : NaNs produced
+
+##com.oracle.truffle.r.test.library.stats.TestDistributions.testDistributionFunctions#Output.MayIgnoreWarningContext#
+#pbinom(c(2), 10, 5, lower.tail=T, log.p=T)
+[1] NaN
+Warning message:
+In pbinom(c(2), 10, 5, lower.tail = T, log.p = T) : NaNs produced
+
 ##com.oracle.truffle.r.test.library.stats.TestDistributions.testDistributionFunctions#Output.MayIgnoreWarningContext#
 #pcauchy(0, -Inf,  -1)
 [1] NaN
@@ -113524,6 +113802,88 @@ In pnorm(c(0), 0, -1, lower.tail = T, log.p = T) : NaNs produced
 #pnorm(c(4, -100, 0), 4, 4, lower.tail=T, log.p=T)
 [1]   -0.6931472 -342.1785089   -1.8410216
 
+##com.oracle.truffle.r.test.library.stats.TestDistributions.testDistributionFunctions#Output.MayIgnoreWarningContext#
+#ppois(0, -1)
+[1] NaN
+Warning message:
+In ppois(0, -1) : NaNs produced
+
+##com.oracle.truffle.r.test.library.stats.TestDistributions.testDistributionFunctions#Output.MayIgnoreWarningContext#
+#ppois(0, -Inf)
+[1] NaN
+Warning message:
+In ppois(0, -Inf) : NaNs produced
+
+##com.oracle.truffle.r.test.library.stats.TestDistributions.testDistributionFunctions#Output.MayIgnoreWarningContext#
+#ppois(0, 0)
+[1] 1
+
+##com.oracle.truffle.r.test.library.stats.TestDistributions.testDistributionFunctions#Output.MayIgnoreWarningContext#
+#ppois(0, Inf)
+[1] 0
+
+##com.oracle.truffle.r.test.library.stats.TestDistributions.testDistributionFunctions#Output.MayIgnoreWarningContext#
+#ppois(0, NaN)
+[1] NaN
+
+##com.oracle.truffle.r.test.library.stats.TestDistributions.testDistributionFunctions#Output.MayIgnoreWarningContext#
+#ppois(c(0.1e-10, 0.1, 1, 10), 0.1e-6, lower.tail=F, log.p=F)
+[1] 1.000000e-07 1.000000e-07 5.000000e-15 2.505211e-85
+
+##com.oracle.truffle.r.test.library.stats.TestDistributions.testDistributionFunctions#Output.MayIgnoreWarningContext#
+#ppois(c(0.1e-10, 0.1, 1, 10), 0.1e-6, lower.tail=F, log.p=T)
+[1]  -16.11810  -16.11810  -32.92934 -194.80136
+
+##com.oracle.truffle.r.test.library.stats.TestDistributions.testDistributionFunctions#Output.MayIgnoreWarningContext#
+#ppois(c(0.1e-10, 0.1, 1, 10), 0.1e-6, lower.tail=T, log.p=F)
+[1] 0.9999999 0.9999999 1.0000000 1.0000000
+
+##com.oracle.truffle.r.test.library.stats.TestDistributions.testDistributionFunctions#Output.MayIgnoreWarningContext#
+#ppois(c(0.1e-10, 0.1, 1, 10), 0.1e-6, lower.tail=T, log.p=T)
+[1] -1.000000e-07 -1.000000e-07 -5.000000e-15 -2.505211e-85
+
+##com.oracle.truffle.r.test.library.stats.TestDistributions.testDistributionFunctions#Output.MayIgnoreWarningContext#
+#ppois(c(1e99, 1e99*9.999, 1e100-1, 1e100, 1e100+100, 1e101), 1e100, lower.tail=F, log.p=F)
+[1] 1.0 1.0 0.5 0.5 0.5 0.0
+
+##com.oracle.truffle.r.test.library.stats.TestDistributions.testDistributionFunctions#Output.MayIgnoreWarningContext#
+#ppois(c(1e99, 1e99*9.999, 1e100-1, 1e100, 1e100+100, 1e101), 1e100, lower.tail=F, log.p=T)
+[1]   0.000000e+00   0.000000e+00  -6.931472e-01  -6.931472e-01  -6.931472e-01
+[6] -1.402585e+101
+
+##com.oracle.truffle.r.test.library.stats.TestDistributions.testDistributionFunctions#Output.MayIgnoreWarningContext#
+#ppois(c(1e99, 1e99*9.999, 1e100-1, 1e100, 1e100+100, 1e101), 1e100, lower.tail=T, log.p=F)
+[1] 0.0 0.0 0.5 0.5 0.5 1.0
+
+##com.oracle.truffle.r.test.library.stats.TestDistributions.testDistributionFunctions#Output.MayIgnoreWarningContext#
+#ppois(c(1e99, 1e99*9.999, 1e100-1, 1e100, 1e100+100, 1e101), 1e100, lower.tail=T, log.p=T)
+[1] -6.697415e+99 -5.000167e+91 -6.931472e-01 -6.931472e-01 -6.931472e-01
+[6]  0.000000e+00
+
+##com.oracle.truffle.r.test.library.stats.TestDistributions.testDistributionFunctions#Output.MayIgnoreWarningContext#
+#ppois(c(5, 10, 15, 20, 30, -Inf, -0.42e-30, 0, 0.42e-30, Inf, NaN), 10, lower.tail=F, log.p=F)
+ [1] 9.329140e-01 4.169602e-01 4.874040e-02 1.588261e-03 7.983795e-08
+ [6] 1.000000e+00 1.000000e+00 9.999546e-01 9.999546e-01 0.000000e+00
+[11]          NaN
+
+##com.oracle.truffle.r.test.library.stats.TestDistributions.testDistributionFunctions#Output.MayIgnoreWarningContext#
+#ppois(c(5, 10, 15, 20, 30, -Inf, -0.42e-30, 0, 0.42e-30, Inf, NaN), 10, lower.tail=F, log.p=T)
+ [1] -6.944222e-02 -8.747644e-01 -3.021247e+00 -6.445116e+00 -1.634327e+01
+ [6]  0.000000e+00  0.000000e+00 -4.540096e-05 -4.540096e-05          -Inf
+[11]           NaN
+
+##com.oracle.truffle.r.test.library.stats.TestDistributions.testDistributionFunctions#Output.MayIgnoreWarningContext#
+#ppois(c(5, 10, 15, 20, 30, -Inf, -0.42e-30, 0, 0.42e-30, Inf, NaN), 10, lower.tail=T, log.p=F)
+ [1] 6.708596e-02 5.830398e-01 9.512596e-01 9.984117e-01 9.999999e-01
+ [6] 0.000000e+00 0.000000e+00 4.539993e-05 4.539993e-05 1.000000e+00
+[11]          NaN
+
+##com.oracle.truffle.r.test.library.stats.TestDistributions.testDistributionFunctions#Output.MayIgnoreWarningContext#
+#ppois(c(5, 10, 15, 20, 30, -Inf, -0.42e-30, 0, 0.42e-30, Inf, NaN), 10, lower.tail=T, log.p=T)
+ [1] -2.701780e+00 -5.394999e-01 -4.996828e-02 -1.589523e-03 -7.983795e-08
+ [6]          -Inf          -Inf -1.000000e+01 -1.000000e+01  0.000000e+00
+[11]           NaN
+
 ##com.oracle.truffle.r.test.library.stats.TestDistributions.testDistributionFunctions#Output.MayIgnoreWarningContext#
 #punif(0, -3, -Inf)
 [1] NaN
@@ -113954,6 +114314,166 @@ In qbeta(Inf, 10, 15, 0) : NaNs produced
 #qbeta(log(c(0, 42e-80, 0.1, 0.5, 0.7, 1-42e-80, 1)), Inf, 0, lower.tail=T, log.p=T)
 [1] 0 1 1 1 1 1 1
 
+##com.oracle.truffle.r.test.library.stats.TestDistributions.testQuantileFunctions#Output.MayIgnoreWarningContext#
+#qbinom(-0.42e-38, 20, 0.3)
+[1] NaN
+Warning message:
+In qbinom(-4.2e-39, 20, 0.3) : NaNs produced
+
+##com.oracle.truffle.r.test.library.stats.TestDistributions.testQuantileFunctions#Output.MayIgnoreWarningContext#
+#qbinom(-42, 20, 0.3)
+[1] NaN
+Warning message:
+In qbinom(-42, 20, 0.3) : NaNs produced
+
+##com.oracle.truffle.r.test.library.stats.TestDistributions.testQuantileFunctions#Output.MayIgnoreWarningContext#
+#qbinom(-Inf, 20, 0.3)
+[1] NaN
+Warning message:
+In qbinom(-Inf, 20, 0.3) : NaNs produced
+
+##com.oracle.truffle.r.test.library.stats.TestDistributions.testQuantileFunctions#Output.MayIgnoreWarningContext#
+#qbinom(0, -1,  0.3)
+[1] NaN
+Warning message:
+In qbinom(0, -1, 0.3) : NaNs produced
+
+##com.oracle.truffle.r.test.library.stats.TestDistributions.testQuantileFunctions#Output.MayIgnoreWarningContext#
+#qbinom(0, -Inf,  0.3)
+[1] NaN
+Warning message:
+In qbinom(0, -Inf, 0.3) : NaNs produced
+
+##com.oracle.truffle.r.test.library.stats.TestDistributions.testQuantileFunctions#Output.MayIgnoreWarningContext#
+#qbinom(0, 20, -1)
+[1] NaN
+Warning message:
+In qbinom(0, 20, -1) : NaNs produced
+
+##com.oracle.truffle.r.test.library.stats.TestDistributions.testQuantileFunctions#Output.MayIgnoreWarningContext#
+#qbinom(0, 20, -Inf)
+[1] NaN
+Warning message:
+In qbinom(0, 20, -Inf) : NaNs produced
+
+##com.oracle.truffle.r.test.library.stats.TestDistributions.testQuantileFunctions#Output.MayIgnoreWarningContext#
+#qbinom(0, 20, Inf)
+[1] NaN
+Warning message:
+In qbinom(0, 20, Inf) : NaNs produced
+
+##com.oracle.truffle.r.test.library.stats.TestDistributions.testQuantileFunctions#Output.MayIgnoreWarningContext#
+#qbinom(0, 20, NaN)
+[1] NaN
+
+##com.oracle.truffle.r.test.library.stats.TestDistributions.testQuantileFunctions#Output.MayIgnoreWarningContext#
+#qbinom(0, Inf,  0.3)
+[1] NaN
+Warning message:
+In qbinom(0, Inf, 0.3) : NaNs produced
+
+##com.oracle.truffle.r.test.library.stats.TestDistributions.testQuantileFunctions#Output.MayIgnoreWarningContext#
+#qbinom(0, NaN,  0.3)
+[1] NaN
+
+##com.oracle.truffle.r.test.library.stats.TestDistributions.testQuantileFunctions#Output.MayIgnoreWarningContext#
+#qbinom(Inf, 20, 0.3)
+[1] NaN
+Warning message:
+In qbinom(Inf, 20, 0.3) : NaNs produced
+
+##com.oracle.truffle.r.test.library.stats.TestDistributions.testQuantileFunctions#Output.MayIgnoreWarningContext#
+#qbinom(NaN, 20, 0.3)
+[1] NaN
+
+##com.oracle.truffle.r.test.library.stats.TestDistributions.testQuantileFunctions#Output.MayIgnoreWarningContext#
+#qbinom(c(0, 42e-80, 0.1, 0.5, 0.7, 1-42e-80, 1), 10, -0.1, lower.tail=F, log.p=F)
+[1] NaN NaN NaN NaN NaN NaN NaN
+Warning message:
+In qbinom(c(0, 4.2e-79, 0.1, 0.5, 0.7, 1 - 4.2e-79, 1), 10, -0.1,  :
+  NaNs produced
+
+##com.oracle.truffle.r.test.library.stats.TestDistributions.testQuantileFunctions#Output.MayIgnoreWarningContext#
+#qbinom(c(0, 42e-80, 0.1, 0.5, 0.7, 1-42e-80, 1), 10, -0.1, lower.tail=T, log.p=F)
+[1] NaN NaN NaN NaN NaN NaN NaN
+Warning message:
+In qbinom(c(0, 4.2e-79, 0.1, 0.5, 0.7, 1 - 4.2e-79, 1), 10, -0.1,  :
+  NaNs produced
+
+##com.oracle.truffle.r.test.library.stats.TestDistributions.testQuantileFunctions#Output.MayIgnoreWarningContext#
+#qbinom(c(0, 42e-80, 0.1, 0.5, 0.7, 1-42e-80, 1), 10, 5, lower.tail=F, log.p=F)
+[1] NaN NaN NaN NaN NaN NaN NaN
+Warning message:
+In qbinom(c(0, 4.2e-79, 0.1, 0.5, 0.7, 1 - 4.2e-79, 1), 10, 5, lower.tail = F,  :
+  NaNs produced
+
+##com.oracle.truffle.r.test.library.stats.TestDistributions.testQuantileFunctions#Output.MayIgnoreWarningContext#
+#qbinom(c(0, 42e-80, 0.1, 0.5, 0.7, 1-42e-80, 1), 10, 5, lower.tail=T, log.p=F)
+[1] NaN NaN NaN NaN NaN NaN NaN
+Warning message:
+In qbinom(c(0, 4.2e-79, 0.1, 0.5, 0.7, 1 - 4.2e-79, 1), 10, 5, lower.tail = T,  :
+  NaNs produced
+
+##com.oracle.truffle.r.test.library.stats.TestDistributions.testQuantileFunctions#Output.MayIgnoreWarningContext#
+#qbinom(c(0, 42e-80, 0.1, 0.5, 0.7, 1-42e-80, 1), 10000, 0.01, lower.tail=F, log.p=F)
+[1] 10000 10000   113   100    95     0     0
+
+##com.oracle.truffle.r.test.library.stats.TestDistributions.testQuantileFunctions#Output.MayIgnoreWarningContext#
+#qbinom(c(0, 42e-80, 0.1, 0.5, 0.7, 1-42e-80, 1), 10000, 0.01, lower.tail=T, log.p=F)
+[1]     0     0    87   100   105 10000 10000
+
+##com.oracle.truffle.r.test.library.stats.TestDistributions.testQuantileFunctions#Output.MayIgnoreWarningContext#
+#qbinom(c(0, 42e-80, 0.1, 0.5, 0.7, 1-42e-80, 1), 20, 0.3, lower.tail=F, log.p=F)
+[1] 20 20  9  6  5  0  0
+
+##com.oracle.truffle.r.test.library.stats.TestDistributions.testQuantileFunctions#Output.MayIgnoreWarningContext#
+#qbinom(c(0, 42e-80, 0.1, 0.5, 0.7, 1-42e-80, 1), 20, 0.3, lower.tail=T, log.p=F)
+[1]  0  0  3  6  7 20 20
+
+##com.oracle.truffle.r.test.library.stats.TestDistributions.testQuantileFunctions#Output.MayIgnoreWarningContext#
+#qbinom(log(c(0, 42e-80, 0.1, 0.5, 0.7, 1-42e-80, 1)), 10, -0.1, lower.tail=F, log.p=T)
+[1] NaN NaN NaN NaN NaN NaN NaN
+Warning message:
+In qbinom(log(c(0, 4.2e-79, 0.1, 0.5, 0.7, 1 - 4.2e-79, 1)), 10,  :
+  NaNs produced
+
+##com.oracle.truffle.r.test.library.stats.TestDistributions.testQuantileFunctions#Output.MayIgnoreWarningContext#
+#qbinom(log(c(0, 42e-80, 0.1, 0.5, 0.7, 1-42e-80, 1)), 10, -0.1, lower.tail=T, log.p=T)
+[1] NaN NaN NaN NaN NaN NaN NaN
+Warning message:
+In qbinom(log(c(0, 4.2e-79, 0.1, 0.5, 0.7, 1 - 4.2e-79, 1)), 10,  :
+  NaNs produced
+
+##com.oracle.truffle.r.test.library.stats.TestDistributions.testQuantileFunctions#Output.MayIgnoreWarningContext#
+#qbinom(log(c(0, 42e-80, 0.1, 0.5, 0.7, 1-42e-80, 1)), 10, 5, lower.tail=F, log.p=T)
+[1] NaN NaN NaN NaN NaN NaN NaN
+Warning message:
+In qbinom(log(c(0, 4.2e-79, 0.1, 0.5, 0.7, 1 - 4.2e-79, 1)), 10,  :
+  NaNs produced
+
+##com.oracle.truffle.r.test.library.stats.TestDistributions.testQuantileFunctions#Output.MayIgnoreWarningContext#
+#qbinom(log(c(0, 42e-80, 0.1, 0.5, 0.7, 1-42e-80, 1)), 10, 5, lower.tail=T, log.p=T)
+[1] NaN NaN NaN NaN NaN NaN NaN
+Warning message:
+In qbinom(log(c(0, 4.2e-79, 0.1, 0.5, 0.7, 1 - 4.2e-79, 1)), 10,  :
+  NaNs produced
+
+##com.oracle.truffle.r.test.library.stats.TestDistributions.testQuantileFunctions#Output.MayIgnoreWarningContext#
+#qbinom(log(c(0, 42e-80, 0.1, 0.5, 0.7, 1-42e-80, 1)), 10000, 0.01, lower.tail=F, log.p=T)
+[1] 10000 10000   113   100    95     0     0
+
+##com.oracle.truffle.r.test.library.stats.TestDistributions.testQuantileFunctions#Output.MayIgnoreWarningContext#
+#qbinom(log(c(0, 42e-80, 0.1, 0.5, 0.7, 1-42e-80, 1)), 10000, 0.01, lower.tail=T, log.p=T)
+[1]     0     0    87   100   105 10000 10000
+
+##com.oracle.truffle.r.test.library.stats.TestDistributions.testQuantileFunctions#Output.MayIgnoreWarningContext#
+#qbinom(log(c(0, 42e-80, 0.1, 0.5, 0.7, 1-42e-80, 1)), 20, 0.3, lower.tail=F, log.p=T)
+[1] 20 20  9  6  5  0  0
+
+##com.oracle.truffle.r.test.library.stats.TestDistributions.testQuantileFunctions#Output.MayIgnoreWarningContext#
+#qbinom(log(c(0, 42e-80, 0.1, 0.5, 0.7, 1-42e-80, 1)), 20, 0.3, lower.tail=T, log.p=T)
+[1]  0  0  3  6  7 20 20
+
 ##com.oracle.truffle.r.test.library.stats.TestDistributions.testQuantileFunctions#Output.MayIgnoreWarningContext#
 #qcauchy(-0.42e-38, 0, -1)
 [1] NaN
@@ -114949,46 +115469,148 @@ In qnorm(c(0, 4.2e-79, 0.1, 0.5, 0.7, 1 - 4.2e-79, 1), 0, -1, lower.tail = T,  :
 [1]  Inf    0    0    0    0 -Inf -Inf
 
 ##com.oracle.truffle.r.test.library.stats.TestDistributions.testQuantileFunctions#Output.MayIgnoreWarningContext#
-#qnorm(c(0, 42e-80, 0.1, 0.5, 0.7, 1-42e-80, 1), 0, 0, lower.tail=T, log.p=F)
-[1] -Inf    0    0    0    0  Inf  Inf
+#qnorm(c(0, 42e-80, 0.1, 0.5, 0.7, 1-42e-80, 1), 0, 0, lower.tail=T, log.p=F)
+[1] -Inf    0    0    0    0  Inf  Inf
+
+##com.oracle.truffle.r.test.library.stats.TestDistributions.testQuantileFunctions#Output.MayIgnoreWarningContext#
+#qnorm(c(0, 42e-80, 0.1, 0.5, 0.7, 1-42e-80, 1), 4, 4, lower.tail=F, log.p=F)
+[1]       Inf 79.177408  9.126206  4.000000  1.902398      -Inf      -Inf
+
+##com.oracle.truffle.r.test.library.stats.TestDistributions.testQuantileFunctions#Output.MayIgnoreWarningContext#
+#qnorm(c(0, 42e-80, 0.1, 0.5, 0.7, 1-42e-80, 1), 4, 4, lower.tail=T, log.p=F)
+[1]       -Inf -71.177408  -1.126206   4.000000   6.097602        Inf        Inf
+
+##com.oracle.truffle.r.test.library.stats.TestDistributions.testQuantileFunctions#Output.MayIgnoreWarningContext#
+#qnorm(log(c(0, 42e-80, 0.1, 0.5, 0.7, 1-42e-80, 1)), 0, -1, lower.tail=F, log.p=T)
+[1]  Inf  NaN  NaN  NaN  NaN -Inf -Inf
+Warning message:
+In qnorm(log(c(0, 4.2e-79, 0.1, 0.5, 0.7, 1 - 4.2e-79, 1)), 0, -1,  :
+  NaNs produced
+
+##com.oracle.truffle.r.test.library.stats.TestDistributions.testQuantileFunctions#Output.MayIgnoreWarningContext#
+#qnorm(log(c(0, 42e-80, 0.1, 0.5, 0.7, 1-42e-80, 1)), 0, -1, lower.tail=T, log.p=T)
+[1] -Inf  NaN  NaN  NaN  NaN  Inf  Inf
+Warning message:
+In qnorm(log(c(0, 4.2e-79, 0.1, 0.5, 0.7, 1 - 4.2e-79, 1)), 0, -1,  :
+  NaNs produced
+
+##com.oracle.truffle.r.test.library.stats.TestDistributions.testQuantileFunctions#Output.MayIgnoreWarningContext#
+#qnorm(log(c(0, 42e-80, 0.1, 0.5, 0.7, 1-42e-80, 1)), 0, 0, lower.tail=F, log.p=T)
+[1]  Inf    0    0    0    0 -Inf -Inf
+
+##com.oracle.truffle.r.test.library.stats.TestDistributions.testQuantileFunctions#Output.MayIgnoreWarningContext#
+#qnorm(log(c(0, 42e-80, 0.1, 0.5, 0.7, 1-42e-80, 1)), 0, 0, lower.tail=T, log.p=T)
+[1] -Inf    0    0    0    0  Inf  Inf
+
+##com.oracle.truffle.r.test.library.stats.TestDistributions.testQuantileFunctions#Output.MayIgnoreWarningContext#
+#qnorm(log(c(0, 42e-80, 0.1, 0.5, 0.7, 1-42e-80, 1)), 4, 4, lower.tail=F, log.p=T)
+[1]       Inf 79.177408  9.126206  4.000000  1.902398      -Inf      -Inf
+
+##com.oracle.truffle.r.test.library.stats.TestDistributions.testQuantileFunctions#Output.MayIgnoreWarningContext#
+#qnorm(log(c(0, 42e-80, 0.1, 0.5, 0.7, 1-42e-80, 1)), 4, 4, lower.tail=T, log.p=T)
+[1]       -Inf -71.177408  -1.126206   4.000000   6.097602        Inf        Inf
+
+##com.oracle.truffle.r.test.library.stats.TestDistributions.testQuantileFunctions#Output.MayIgnoreWarningContext#
+#qpois(-0.42e-38, 10)
+[1] NaN
+Warning message:
+In qpois(-4.2e-39, 10) : NaNs produced
+
+##com.oracle.truffle.r.test.library.stats.TestDistributions.testQuantileFunctions#Output.MayIgnoreWarningContext#
+#qpois(-42, 10)
+[1] NaN
+Warning message:
+In qpois(-42, 10) : NaNs produced
+
+##com.oracle.truffle.r.test.library.stats.TestDistributions.testQuantileFunctions#Output.MayIgnoreWarningContext#
+#qpois(-Inf, 10)
+[1] NaN
+Warning message:
+In qpois(-Inf, 10) : NaNs produced
+
+##com.oracle.truffle.r.test.library.stats.TestDistributions.testQuantileFunctions#Output.MayIgnoreWarningContext#
+#qpois(0, -1)
+[1] NaN
+Warning message:
+In qpois(0, -1) : NaNs produced
+
+##com.oracle.truffle.r.test.library.stats.TestDistributions.testQuantileFunctions#Output.MayIgnoreWarningContext#
+#qpois(0, -Inf)
+[1] NaN
+Warning message:
+In qpois(0, -Inf) : NaNs produced
+
+##com.oracle.truffle.r.test.library.stats.TestDistributions.testQuantileFunctions#Output.MayIgnoreWarningContext#
+#qpois(0, 0)
+[1] 0
+
+##com.oracle.truffle.r.test.library.stats.TestDistributions.testQuantileFunctions#Output.MayIgnoreWarningContext#
+#qpois(0, Inf)
+[1] NaN
+Warning message:
+In qpois(0, Inf) : NaNs produced
+
+##com.oracle.truffle.r.test.library.stats.TestDistributions.testQuantileFunctions#Output.MayIgnoreWarningContext#
+#qpois(0, NaN)
+[1] NaN
+
+##com.oracle.truffle.r.test.library.stats.TestDistributions.testQuantileFunctions#Output.MayIgnoreWarningContext#
+#qpois(Inf, 10)
+[1] NaN
+Warning message:
+In qpois(Inf, 10) : NaNs produced
+
+##com.oracle.truffle.r.test.library.stats.TestDistributions.testQuantileFunctions#Output.MayIgnoreWarningContext#
+#qpois(NaN, 10)
+[1] NaN
+
+##com.oracle.truffle.r.test.library.stats.TestDistributions.testQuantileFunctions#Output.MayIgnoreWarningContext#
+#qpois(c(0, 42e-80, 0.1, 0.5, 0.7, 1-42e-80, 1), 0.1e-6, lower.tail=F, log.p=F)
+[1] Inf Inf   0   0   0   0   0
+
+##com.oracle.truffle.r.test.library.stats.TestDistributions.testQuantileFunctions#Output.MayIgnoreWarningContext#
+#qpois(c(0, 42e-80, 0.1, 0.5, 0.7, 1-42e-80, 1), 0.1e-6, lower.tail=T, log.p=F)
+[1]   0   0   0   0   0 Inf Inf
+
+##com.oracle.truffle.r.test.library.stats.TestDistributions.testQuantileFunctions#Output.MayIgnoreWarningContext#
+#qpois(c(0, 42e-80, 0.1, 0.5, 0.7, 1-42e-80, 1), 10, lower.tail=F, log.p=F)
+[1] Inf Inf  14  10   8   0   0
+
+##com.oracle.truffle.r.test.library.stats.TestDistributions.testQuantileFunctions#Output.MayIgnoreWarningContext#
+#qpois(c(0, 42e-80, 0.1, 0.5, 0.7, 1-42e-80, 1), 10, lower.tail=T, log.p=F)
+[1]   0   0   6  10  12 Inf Inf
 
 ##com.oracle.truffle.r.test.library.stats.TestDistributions.testQuantileFunctions#Output.MayIgnoreWarningContext#
-#qnorm(c(0, 42e-80, 0.1, 0.5, 0.7, 1-42e-80, 1), 4, 4, lower.tail=F, log.p=F)
-[1]       Inf 79.177408  9.126206  4.000000  1.902398      -Inf      -Inf
+#qpois(c(0, 42e-80, 0.1, 0.5, 0.7, 1-42e-80, 1), 1e100, lower.tail=F, log.p=F)
+[1]    Inf    Inf 1e+100 1e+100 1e+100  0e+00  0e+00
 
 ##com.oracle.truffle.r.test.library.stats.TestDistributions.testQuantileFunctions#Output.MayIgnoreWarningContext#
-#qnorm(c(0, 42e-80, 0.1, 0.5, 0.7, 1-42e-80, 1), 4, 4, lower.tail=T, log.p=F)
-[1]       -Inf -71.177408  -1.126206   4.000000   6.097602        Inf        Inf
+#qpois(c(0, 42e-80, 0.1, 0.5, 0.7, 1-42e-80, 1), 1e100, lower.tail=T, log.p=F)
+[1]  0e+00 1e+100 1e+100 1e+100 1e+100    Inf    Inf
 
 ##com.oracle.truffle.r.test.library.stats.TestDistributions.testQuantileFunctions#Output.MayIgnoreWarningContext#
-#qnorm(log(c(0, 42e-80, 0.1, 0.5, 0.7, 1-42e-80, 1)), 0, -1, lower.tail=F, log.p=T)
-[1]  Inf  NaN  NaN  NaN  NaN -Inf -Inf
-Warning message:
-In qnorm(log(c(0, 4.2e-79, 0.1, 0.5, 0.7, 1 - 4.2e-79, 1)), 0, -1,  :
-  NaNs produced
+#qpois(log(c(0, 42e-80, 0.1, 0.5, 0.7, 1-42e-80, 1)), 0.1e-6, lower.tail=F, log.p=T)
+[1] Inf Inf   0   0   0   0   0
 
 ##com.oracle.truffle.r.test.library.stats.TestDistributions.testQuantileFunctions#Output.MayIgnoreWarningContext#
-#qnorm(log(c(0, 42e-80, 0.1, 0.5, 0.7, 1-42e-80, 1)), 0, -1, lower.tail=T, log.p=T)
-[1] -Inf  NaN  NaN  NaN  NaN  Inf  Inf
-Warning message:
-In qnorm(log(c(0, 4.2e-79, 0.1, 0.5, 0.7, 1 - 4.2e-79, 1)), 0, -1,  :
-  NaNs produced
+#qpois(log(c(0, 42e-80, 0.1, 0.5, 0.7, 1-42e-80, 1)), 0.1e-6, lower.tail=T, log.p=T)
+[1]   0   0   0   0   0 Inf Inf
 
 ##com.oracle.truffle.r.test.library.stats.TestDistributions.testQuantileFunctions#Output.MayIgnoreWarningContext#
-#qnorm(log(c(0, 42e-80, 0.1, 0.5, 0.7, 1-42e-80, 1)), 0, 0, lower.tail=F, log.p=T)
-[1]  Inf    0    0    0    0 -Inf -Inf
+#qpois(log(c(0, 42e-80, 0.1, 0.5, 0.7, 1-42e-80, 1)), 10, lower.tail=F, log.p=T)
+[1] Inf Inf  14  10   8   0   0
 
 ##com.oracle.truffle.r.test.library.stats.TestDistributions.testQuantileFunctions#Output.MayIgnoreWarningContext#
-#qnorm(log(c(0, 42e-80, 0.1, 0.5, 0.7, 1-42e-80, 1)), 0, 0, lower.tail=T, log.p=T)
-[1] -Inf    0    0    0    0  Inf  Inf
+#qpois(log(c(0, 42e-80, 0.1, 0.5, 0.7, 1-42e-80, 1)), 10, lower.tail=T, log.p=T)
+[1]   0   0   6  10  12 Inf Inf
 
 ##com.oracle.truffle.r.test.library.stats.TestDistributions.testQuantileFunctions#Output.MayIgnoreWarningContext#
-#qnorm(log(c(0, 42e-80, 0.1, 0.5, 0.7, 1-42e-80, 1)), 4, 4, lower.tail=F, log.p=T)
-[1]       Inf 79.177408  9.126206  4.000000  1.902398      -Inf      -Inf
+#qpois(log(c(0, 42e-80, 0.1, 0.5, 0.7, 1-42e-80, 1)), 1e100, lower.tail=F, log.p=T)
+[1]    Inf    Inf 1e+100 1e+100 1e+100  0e+00  0e+00
 
 ##com.oracle.truffle.r.test.library.stats.TestDistributions.testQuantileFunctions#Output.MayIgnoreWarningContext#
-#qnorm(log(c(0, 42e-80, 0.1, 0.5, 0.7, 1-42e-80, 1)), 4, 4, lower.tail=T, log.p=T)
-[1]       -Inf -71.177408  -1.126206   4.000000   6.097602        Inf        Inf
+#qpois(log(c(0, 42e-80, 0.1, 0.5, 0.7, 1-42e-80, 1)), 1e100, lower.tail=T, log.p=T)
+[1]  0e+00 1e+100 1e+100 1e+100 1e+100    Inf    Inf
 
 ##com.oracle.truffle.r.test.library.stats.TestDistributions.testQuantileFunctions#Output.MayIgnoreWarningContext#
 #qunif(-0.42e-38, -3, 3.3)
@@ -118115,62 +118737,6 @@ Warning message:
 In dgeom(c(NA, 0, NaN, 1/0, -1/0), rep(c(1, 0, 0.1), 5), log = FALSE) :
   NaNs produced
 
-##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions21#Output.IgnoreWhitespace#
-#set.seed(1); dpois(0, c(0.0653, 0.000123, 32e-80, 8833, 79e70, 0, -1), log=FALSE)
-[1] 0.9367864 0.9998770 1.0000000 0.0000000 0.0000000 1.0000000       NaN
-Warning message:
-In dpois(0, c(0.0653, 0.000123, 3.2e-79, 8833, 7.9e+71, 0, -1),  :
-  NaNs produced
-
-##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions21#Output.IgnoreWhitespace#
-#set.seed(1); dpois(10, 10, log=TRUE)
-[1] -2.078562
-
-##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions21#Output.IgnoreWhitespace#
-#set.seed(1); dpois(3, 3, log=FALSE)
-[1] 0.2240418
-
-##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions21#Output.IgnoreWhitespace#
-#set.seed(1); dpois(c(-1, 0, 0.2, 2), rep(c(-1, 0, 0.1, 0.9, 3), 4), log=FALSE)
- [1]         NaN 1.000000000 0.000000000 0.164660712 0.000000000         NaN
- [7] 0.000000000 0.004524187 0.000000000 0.049787068         NaN 0.000000000
-[13] 0.000000000 0.406569660 0.000000000         NaN 0.000000000 0.904837418
-[19] 0.000000000 0.224041808
-Warning messages:
-1: In dpois(c(-1, 0, 0.2, 2), rep(c(-1, 0, 0.1, 0.9, 3), 4), log = FALSE) :
-  non-integer x = 0.200000
-2: In dpois(c(-1, 0, 0.2, 2), rep(c(-1, 0, 0.1, 0.9, 3), 4), log = FALSE) :
-  non-integer x = 0.200000
-3: In dpois(c(-1, 0, 0.2, 2), rep(c(-1, 0, 0.1, 0.9, 3), 4), log = FALSE) :
-  non-integer x = 0.200000
-4: In dpois(c(-1, 0, 0.2, 2), rep(c(-1, 0, 0.1, 0.9, 3), 4), log = FALSE) :
-  non-integer x = 0.200000
-5: In dpois(c(-1, 0, 0.2, 2), rep(c(-1, 0, 0.1, 0.9, 3), 4), log = FALSE) :
-  NaNs produced
-
-##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions21#Output.IgnoreWhitespace#
-#set.seed(1); dpois(c(-1, 0, 0.2, 2), rep(c(-1, 0, 0.1, 0.9, 3), 4), log=TRUE)
- [1]       NaN  0.000000      -Inf -1.803868      -Inf       NaN      -Inf
- [8] -5.398317      -Inf -3.000000       NaN      -Inf      -Inf -0.900000
-[15]      -Inf       NaN      -Inf -0.100000      -Inf -1.495923
-Warning messages:
-1: In dpois(c(-1, 0, 0.2, 2), rep(c(-1, 0, 0.1, 0.9, 3), 4), log = TRUE) :
-  non-integer x = 0.200000
-2: In dpois(c(-1, 0, 0.2, 2), rep(c(-1, 0, 0.1, 0.9, 3), 4), log = TRUE) :
-  non-integer x = 0.200000
-3: In dpois(c(-1, 0, 0.2, 2), rep(c(-1, 0, 0.1, 0.9, 3), 4), log = TRUE) :
-  non-integer x = 0.200000
-4: In dpois(c(-1, 0, 0.2, 2), rep(c(-1, 0, 0.1, 0.9, 3), 4), log = TRUE) :
-  non-integer x = 0.200000
-5: In dpois(c(-1, 0, 0.2, 2), rep(c(-1, 0, 0.1, 0.9, 3), 4), log = TRUE) :
-  NaNs produced
-
-##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions21#Output.IgnoreWhitespace#
-#set.seed(1); dpois(c(NA, 0, NaN, 1/0, -1/0), rep(c(1, 0, 0.1), 5), log=FALSE)
- [1]        NA 1.0000000       NaN 0.0000000 0.0000000        NA 0.3678794
- [8]       NaN 0.0000000 0.0000000        NA 0.9048374       NaN 0.0000000
-[15] 0.0000000
-
 ##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions21#Output.IgnoreWhitespace#
 #set.seed(1); dt(0, c(0.0653, 0.000123, 32e-80, 8833, 79e70, 0, -1), log=FALSE)
 [1] 1.223197e-01 5.544796e-03 2.828427e-40 3.989310e-01 3.989423e-01
@@ -118415,104 +118981,6 @@ In pgeom(c(NA, 0, NaN, 1/0, -1/0), rep(c(1, 0, 0.1), 5)) : NaNs produced
 Warning message:
 In pgeom(rep(c(1, 0, 0.1), 5), c(NA, 0, NaN, 1/0, -1/0)) : NaNs produced
 
-##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions22#Output.IgnoreWhitespace#
-#set.seed(1); ppois(0, 10, lower.tail=FALSE, log.p=FALSE)
-[1] 0.9999546
-
-##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions22#Output.IgnoreWhitespace#
-#set.seed(1); ppois(0, 10, lower.tail=FALSE, log.p=TRUE)
-[1] -4.540096e-05
-
-##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions22#Output.IgnoreWhitespace#
-#set.seed(1); ppois(0, 10, lower.tail=TRUE, log.p=FALSE)
-[1] 4.539993e-05
-
-##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions22#Output.IgnoreWhitespace#
-#set.seed(1); ppois(0, 10, lower.tail=TRUE, log.p=TRUE)
-[1] -10
-
-##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions22#Output.IgnoreWhitespace#
-#set.seed(1); ppois(0, c(0.0653, 0.000123, 32e-80, 8833, 79e70, 0, -1), lower.tail=FALSE, log.p=FALSE)
-[1] 6.321361e-02 1.229924e-04 3.200000e-79 1.000000e+00 1.000000e+00
-[6] 0.000000e+00          NaN
-Warning message:
-In ppois(0, c(0.0653, 0.000123, 3.2e-79, 8833, 7.9e+71, 0, -1),  :
-  NaNs produced
-
-##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions22#Output.IgnoreWhitespace#
-#set.seed(1); ppois(0, c(0.0653, 0.000123, 32e-80, 8833, 79e70, 0, -1), lower.tail=FALSE, log.p=TRUE)
-[1]   -2.761236   -9.003388 -180.741072    0.000000    0.000000        -Inf
-[7]         NaN
-Warning message:
-In ppois(0, c(0.0653, 0.000123, 3.2e-79, 8833, 7.9e+71, 0, -1),  :
-  NaNs produced
-
-##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions22#Output.IgnoreWhitespace#
-#set.seed(1); ppois(0, c(0.0653, 0.000123, 32e-80, 8833, 79e70, 0, -1), lower.tail=TRUE, log.p=FALSE)
-[1] 0.9367864 0.9998770 1.0000000 0.0000000 0.0000000 1.0000000       NaN
-Warning message:
-In ppois(0, c(0.0653, 0.000123, 3.2e-79, 8833, 7.9e+71, 0, -1),  :
-  NaNs produced
-
-##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions22#Output.IgnoreWhitespace#
-#set.seed(1); ppois(0, c(0.0653, 0.000123, 32e-80, 8833, 79e70, 0, -1), lower.tail=TRUE, log.p=TRUE)
-[1] -6.530e-02 -1.230e-04 -3.200e-79 -8.833e+03 -7.900e+71  0.000e+00        NaN
-Warning message:
-In ppois(0, c(0.0653, 0.000123, 3.2e-79, 8833, 7.9e+71, 0, -1),  :
-  NaNs produced
-
-##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions22#Output.IgnoreWhitespace#
-#set.seed(1); ppois(c(-1, 0, 0.2, 2), rep(c(-1, 0, 0.1, 0.9, 3), 4), lower.tail=FALSE, log.p=FALSE)
- [1]          NaN 0.0000000000 0.0951625820 0.0628569343 1.0000000000
- [6]          NaN 0.0000000000 0.0001546531 1.0000000000 0.9502129316
-[11]          NaN 0.0000000000 1.0000000000 0.5934303403 0.9502129316
-[16]          NaN 1.0000000000 0.0951625820 0.5934303403 0.5768099189
-Warning message:
-In ppois(c(-1, 0, 0.2, 2), rep(c(-1, 0, 0.1, 0.9, 3), 4), lower.tail = FALSE,  :
-  NaNs produced
-
-##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions22#Output.IgnoreWhitespace#
-#set.seed(1); ppois(c(-1, 0, 0.2, 2), rep(c(-1, 0, 0.1, 0.9, 3), 4), lower.tail=FALSE, log.p=TRUE)
- [1]         NaN        -Inf -2.35216846 -2.76689402  0.00000000         NaN
- [7]        -Inf -8.77432621  0.00000000 -0.05106918         NaN        -Inf
-[13]  0.00000000 -0.52183544 -0.05106918         NaN  0.00000000 -2.35216846
-[19] -0.52183544 -0.55024250
-Warning message:
-In ppois(c(-1, 0, 0.2, 2), rep(c(-1, 0, 0.1, 0.9, 3), 4), lower.tail = FALSE,  :
-  NaNs produced
-
-##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions22#Output.IgnoreWhitespace#
-#set.seed(1); ppois(c(-1, 0, 0.2, 2), rep(c(-1, 0, 0.1, 0.9, 3), 4), lower.tail=TRUE, log.p=FALSE)
- [1]        NaN 1.00000000 0.90483742 0.93714307 0.00000000        NaN
- [7] 1.00000000 0.99984535 0.00000000 0.04978707        NaN 1.00000000
-[13] 0.00000000 0.40656966 0.04978707        NaN 0.00000000 0.90483742
-[19] 0.40656966 0.42319008
-Warning message:
-In ppois(c(-1, 0, 0.2, 2), rep(c(-1, 0, 0.1, 0.9, 3), 4), lower.tail = TRUE,  :
-  NaNs produced
-
-##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions22#Output.IgnoreWhitespace#
-#set.seed(1); ppois(c(-1, 0, 0.2, 2), rep(c(-1, 0, 0.1, 0.9, 3), 4), lower.tail=TRUE, log.p=TRUE)
- [1]          NaN  0.000000000 -0.100000000 -0.064919324         -Inf
- [6]          NaN  0.000000000 -0.000154665         -Inf -3.000000000
-[11]          NaN  0.000000000         -Inf -0.900000000 -3.000000000
-[16]          NaN         -Inf -0.100000000 -0.900000000 -0.859933837
-Warning message:
-In ppois(c(-1, 0, 0.2, 2), rep(c(-1, 0, 0.1, 0.9, 3), 4), lower.tail = TRUE,  :
-  NaNs produced
-
-##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions22#Output.IgnoreWhitespace#
-#set.seed(1); ppois(c(NA, 0, NaN, 1/0, -1/0), rep(c(1, 0, 0.1), 5))
- [1]        NA 1.0000000       NaN 1.0000000 0.0000000        NA 0.3678794
- [8]       NaN 1.0000000 0.0000000        NA 0.9048374       NaN 1.0000000
-[15] 0.0000000
-
-##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions22#Output.IgnoreWhitespace#
-#set.seed(1); ppois(rep(c(1, 0, 0.1), 5), c(NA, 0, NaN, 1/0, -1/0))
- [1]  NA   1 NaN   0 NaN  NA   1 NaN   0 NaN  NA   1 NaN   0 NaN
-Warning message:
-In ppois(rep(c(1, 0, 0.1), 5), c(NA, 0, NaN, 1/0, -1/0)) : NaNs produced
-
 ##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions22#Output.IgnoreWhitespace#
 #set.seed(1); pt(0, 10, lower.tail=FALSE, log.p=FALSE)
 [1] 0.5
@@ -118792,94 +119260,6 @@ In qgeom(c(NA, 0, NaN, 1/0, -1/0), rep(c(1, 0, 0.1), 5)) : NaNs produced
 Warning message:
 In qgeom(rep(c(1, 0, 0.1), 5), c(NA, 0, NaN, 1/0, -1/0)) : NaNs produced
 
-##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions22#Output.IgnoreWhitespace#
-#set.seed(1); qpois(0, 10, lower.tail=FALSE, log.p=FALSE)
-[1] Inf
-
-##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions22#Output.IgnoreWhitespace#
-#set.seed(1); qpois(0, 10, lower.tail=FALSE, log.p=TRUE)
-[1] 0
-
-##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions22#Output.IgnoreWhitespace#
-#set.seed(1); qpois(0, 10, lower.tail=TRUE, log.p=FALSE)
-[1] 0
-
-##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions22#Output.IgnoreWhitespace#
-#set.seed(1); qpois(0, 10, lower.tail=TRUE, log.p=TRUE)
-[1] Inf
-
-##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions22#Output.IgnoreWhitespace#
-#set.seed(1); qpois(0, c(0.0653, 0.000123, 32e-80, 8833, 79e70, 0, -1), lower.tail=FALSE, log.p=FALSE)
-[1] Inf Inf Inf Inf Inf   0 NaN
-Warning message:
-In qpois(0, c(0.0653, 0.000123, 3.2e-79, 8833, 7.9e+71, 0, -1),  :
-  NaNs produced
-
-##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions22#Output.IgnoreWhitespace#
-#set.seed(1); qpois(0, c(0.0653, 0.000123, 32e-80, 8833, 79e70, 0, -1), lower.tail=FALSE, log.p=TRUE)
-[1]   0   0   0   0   0   0 NaN
-Warning message:
-In qpois(0, c(0.0653, 0.000123, 3.2e-79, 8833, 7.9e+71, 0, -1),  :
-  NaNs produced
-
-##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions22#Output.IgnoreWhitespace#
-#set.seed(1); qpois(0, c(0.0653, 0.000123, 32e-80, 8833, 79e70, 0, -1), lower.tail=TRUE, log.p=FALSE)
-[1]   0   0   0   0   0   0 NaN
-Warning message:
-In qpois(0, c(0.0653, 0.000123, 3.2e-79, 8833, 7.9e+71, 0, -1),  :
-  NaNs produced
-
-##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions22#Output.IgnoreWhitespace#
-#set.seed(1); qpois(0, c(0.0653, 0.000123, 32e-80, 8833, 79e70, 0, -1), lower.tail=TRUE, log.p=TRUE)
-[1] Inf Inf Inf Inf Inf   0 NaN
-Warning message:
-In qpois(0, c(0.0653, 0.000123, 3.2e-79, 8833, 7.9e+71, 0, -1),  :
-  NaNs produced
-
-##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions22#Output.IgnoreWhitespace#
-#set.seed(1); qpois(c(-1, 0, 0.2, 2), rep(c(-1, 0, 0.1, 0.9, 3), 4), lower.tail=FALSE, log.p=FALSE)
- [1] NaN   0   0 NaN NaN NaN   0 NaN NaN Inf NaN   0 NaN Inf   4 NaN   0 Inf   2
-[20] NaN
-Warning message:
-In qpois(c(-1, 0, 0.2, 2), rep(c(-1, 0, 0.1, 0.9, 3), 4), lower.tail = FALSE,  :
-  NaNs produced
-
-##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions22#Output.IgnoreWhitespace#
-#set.seed(1); qpois(c(-1, 0, 0.2, 2), rep(c(-1, 0, 0.1, 0.9, 3), 4), lower.tail=FALSE, log.p=TRUE)
- [1] NaN   0 NaN NaN   3 NaN   0 NaN   1   0 NaN   0   0   0 NaN NaN   0   0 NaN
-[20] NaN
-Warning message:
-In qpois(c(-1, 0, 0.2, 2), rep(c(-1, 0, 0.1, 0.9, 3), 4), lower.tail = FALSE,  :
-  NaNs produced
-
-##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions22#Output.IgnoreWhitespace#
-#set.seed(1); qpois(c(-1, 0, 0.2, 2), rep(c(-1, 0, 0.1, 0.9, 3), 4), lower.tail=TRUE, log.p=FALSE)
- [1] NaN   0   0 NaN NaN NaN   0 NaN NaN   0 NaN   0 NaN   0   2 NaN   0   0   0
-[20] NaN
-Warning message:
-In qpois(c(-1, 0, 0.2, 2), rep(c(-1, 0, 0.1, 0.9, 3), 4), lower.tail = TRUE,  :
-  NaNs produced
-
-##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions22#Output.IgnoreWhitespace#
-#set.seed(1); qpois(c(-1, 0, 0.2, 2), rep(c(-1, 0, 0.1, 0.9, 3), 4), lower.tail=TRUE, log.p=TRUE)
- [1] NaN   0 NaN NaN   2 NaN   0 NaN   0 Inf NaN   0   0 Inf NaN NaN   0 Inf NaN
-[20] NaN
-Warning message:
-In qpois(c(-1, 0, 0.2, 2), rep(c(-1, 0, 0.1, 0.9, 3), 4), lower.tail = TRUE,  :
-  NaNs produced
-
-##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions22#Output.IgnoreWhitespace#
-#set.seed(1); qpois(c(NA, 0, NaN, 1/0, -1/0), rep(c(1, 0, 0.1), 5))
- [1]  NA   0 NaN NaN   0  NA   0 NaN NaN NaN  NA   0 NaN   0 NaN
-Warning message:
-In qpois(c(NA, 0, NaN, 1/0, -1/0), rep(c(1, 0, 0.1), 5)) : NaNs produced
-
-##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions22#Output.IgnoreWhitespace#
-#set.seed(1); qpois(rep(c(1, 0, 0.1), 5), c(NA, 0, NaN, 1/0, -1/0))
- [1]  NA   0 NaN NaN NaN  NA   0 NaN NaN NaN  NA   0 NaN NaN NaN
-Warning message:
-In qpois(rep(c(1, 0, 0.1), 5), c(NA, 0, NaN, 1/0, -1/0)) : NaNs produced
-
 ##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions22#Output.IgnoreWhitespace#
 #set.seed(1); qt(0, 10, lower.tail=FALSE, log.p=FALSE)
 [1] Inf
@@ -119087,195 +119467,6 @@ In dlogis(c(-1, 0, 1), c(-1, 0, 0.2, 2:5), rep(c(-1, 0, 0.1, 0.9,  :
 #set.seed(1); dlogis(c(NA, NaN, 1/0, -1/0), 2, 2, log=FALSE)
 [1]  NA NaN   0   0
 
-##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext#
-#set.seed(1); pbinom(0, 10, 10, lower.tail=FALSE, log.p=FALSE)
-[1] NaN
-Warning message:
-In pbinom(0, 10, 10, lower.tail = FALSE, log.p = FALSE) : NaNs produced
-
-##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext#
-#set.seed(1); pbinom(0, 10, 10, lower.tail=FALSE, log.p=TRUE)
-[1] NaN
-Warning message:
-In pbinom(0, 10, 10, lower.tail = FALSE, log.p = TRUE) : NaNs produced
-
-##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext#
-#set.seed(1); pbinom(0, 10, 10, lower.tail=TRUE, log.p=FALSE)
-[1] NaN
-Warning message:
-In pbinom(0, 10, 10, lower.tail = TRUE, log.p = FALSE) : NaNs produced
-
-##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext#
-#set.seed(1); pbinom(0, 10, 10, lower.tail=TRUE, log.p=TRUE)
-[1] NaN
-Warning message:
-In pbinom(0, 10, 10, lower.tail = TRUE, log.p = TRUE) : NaNs produced
-
-##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext#
-#set.seed(1); pbinom(0, c(0.0653, 0.000123, 32e-80, 8833, 79e70, 0, -1), rep(c(0.0653, 0.000123, 32e-80, 8833, 79e70), 7), lower.tail=FALSE, log.p=FALSE)
- [1]          NaN          NaN 0.000000e+00          NaN          NaN
- [6] 0.000000e+00          NaN          NaN          NaN          NaN
-[11] 1.000000e+00 1.000000e+00 0.000000e+00          NaN          NaN
-[16]          NaN 0.000000e+00 2.826560e-75          NaN          NaN
-[21]          NaN          NaN          NaN          NaN          NaN
-[26] 1.000000e+00 0.000000e+00          NaN          NaN          NaN
-[31] 0.000000e+00 6.626134e-01 2.528000e-07          NaN          NaN
-There were 11 warnings (use warnings() to see them)
-
-##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext#
-#set.seed(1); pbinom(0, c(0.0653, 0.000123, 32e-80, 8833, 79e70, 0, -1), rep(c(0.0653, 0.000123, 32e-80, 8833, 79e70), 7), lower.tail=FALSE, log.p=TRUE)
- [1]            NaN            NaN           -Inf            NaN            NaN
- [6]           -Inf            NaN            NaN            NaN            NaN
-[11] -8.869919e-260   0.000000e+00           -Inf            NaN            NaN
-[16]            NaN           -Inf  -1.716548e+02            NaN            NaN
-[21]            NaN            NaN            NaN            NaN            NaN
-[26]   0.000000e+00           -Inf            NaN            NaN            NaN
-[31]           -Inf  -4.115636e-01  -1.519067e+01            NaN            NaN
-There were 11 warnings (use warnings() to see them)
-
-##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext#
-#set.seed(1); pbinom(0, c(0.0653, 0.000123, 32e-80, 8833, 79e70, 0, -1), rep(c(0.0653, 0.000123, 32e-80, 8833, 79e70), 7), lower.tail=TRUE, log.p=FALSE)
- [1]           NaN           NaN  1.000000e+00           NaN           NaN
- [6]  1.000000e+00           NaN           NaN           NaN           NaN
-[11] 8.869919e-260  0.000000e+00  1.000000e+00           NaN           NaN
-[16]           NaN  1.000000e+00  1.000000e+00           NaN           NaN
-[21]           NaN           NaN           NaN           NaN           NaN
-[26]  0.000000e+00  1.000000e+00           NaN           NaN           NaN
-[31]  1.000000e+00  3.373866e-01  9.999997e-01           NaN           NaN
-There were 11 warnings (use warnings() to see them)
-
-##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext#
-#set.seed(1); pbinom(0, c(0.0653, 0.000123, 32e-80, 8833, 79e70, 0, -1), rep(c(0.0653, 0.000123, 32e-80, 8833, 79e70), 7), lower.tail=TRUE, log.p=TRUE)
- [1]           NaN           NaN  0.000000e+00           NaN           NaN
- [6]  0.000000e+00           NaN           NaN           NaN           NaN
-[11] -5.964895e+02 -9.717598e+67  0.000000e+00           NaN           NaN
-[16]           NaN  0.000000e+00 -2.826560e-75           NaN           NaN
-[21]           NaN           NaN           NaN           NaN           NaN
-[26] -5.334843e+70  0.000000e+00           NaN           NaN           NaN
-[31]  0.000000e+00 -1.086526e+00 -2.528000e-07           NaN           NaN
-There were 11 warnings (use warnings() to see them)
-
-##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext#
-#set.seed(1); pbinom(c(-1, 0, 0.2, 2), c(-1, 0, 0.1, 0.9, 3), rep(c(-1, 0, 1, 0.1, -0.1, 0.0001), 20), lower.tail=FALSE, log.p=FALSE)
-  [1]        NaN 0.0000e+00        NaN        NaN        NaN        NaN
-  [7]        NaN        NaN        NaN 2.7100e-01        NaN 0.0000e+00
- [13]        NaN        NaN 1.0000e+00        NaN        NaN        NaN
- [19]        NaN 0.0000e+00        NaN 0.0000e+00        NaN        NaN
- [25]        NaN        NaN 0.0000e+00        NaN        NaN 2.9997e-04
- [31]        NaN 0.0000e+00        NaN        NaN        NaN        NaN
- [37]        NaN        NaN        NaN 1.0000e-03        NaN 0.0000e+00
- [43]        NaN        NaN 1.0000e+00        NaN        NaN        NaN
- [49]        NaN 0.0000e+00        NaN 0.0000e+00        NaN        NaN
- [55]        NaN        NaN 1.0000e+00        NaN        NaN 1.0000e-12
- [61]        NaN 0.0000e+00        NaN        NaN        NaN        NaN
- [67]        NaN        NaN        NaN 2.7100e-01        NaN 0.0000e+00
- [73]        NaN        NaN 1.0000e+00        NaN        NaN        NaN
- [79]        NaN 0.0000e+00        NaN 0.0000e+00        NaN        NaN
- [85]        NaN        NaN 0.0000e+00        NaN        NaN 2.9997e-04
- [91]        NaN 0.0000e+00        NaN        NaN        NaN        NaN
- [97]        NaN        NaN        NaN 1.0000e-03        NaN 0.0000e+00
-[103]        NaN        NaN 1.0000e+00        NaN        NaN        NaN
-[109]        NaN 0.0000e+00        NaN 0.0000e+00        NaN        NaN
-[115]        NaN        NaN 1.0000e+00        NaN        NaN 1.0000e-12
-There were 49 warnings (use warnings() to see them)
-
-##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext#
-#set.seed(1); pbinom(c(-1, 0, 0.2, 2), c(-1, 0, 0.1, 0.9, 3), rep(c(-1, 0, 1, 0.1, -0.1, 0.0001), 20), lower.tail=FALSE, log.p=TRUE)
-  [1]        NaN       -Inf        NaN        NaN        NaN        NaN
-  [7]        NaN        NaN        NaN  -1.305636        NaN       -Inf
- [13]        NaN        NaN   0.000000        NaN        NaN        NaN
- [19]        NaN       -Inf        NaN       -Inf        NaN        NaN
- [25]        NaN        NaN       -Inf        NaN        NaN  -8.111828
- [31]        NaN       -Inf        NaN        NaN        NaN        NaN
- [37]        NaN        NaN        NaN  -6.907755        NaN       -Inf
- [43]        NaN        NaN   0.000000        NaN        NaN        NaN
- [49]        NaN       -Inf        NaN       -Inf        NaN        NaN
- [55]        NaN        NaN   0.000000        NaN        NaN -27.631021
- [61]        NaN       -Inf        NaN        NaN        NaN        NaN
- [67]        NaN        NaN        NaN  -1.305636        NaN       -Inf
- [73]        NaN        NaN   0.000000        NaN        NaN        NaN
- [79]        NaN       -Inf        NaN       -Inf        NaN        NaN
- [85]        NaN        NaN       -Inf        NaN        NaN  -8.111828
- [91]        NaN       -Inf        NaN        NaN        NaN        NaN
- [97]        NaN        NaN        NaN  -6.907755        NaN       -Inf
-[103]        NaN        NaN   0.000000        NaN        NaN        NaN
-[109]        NaN       -Inf        NaN       -Inf        NaN        NaN
-[115]        NaN        NaN   0.000000        NaN        NaN -27.631021
-There were 49 warnings (use warnings() to see them)
-
-##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext#
-#set.seed(1); pbinom(c(-1, 0, 0.2, 2), c(-1, 0, 0.1, 0.9, 3), rep(c(-1, 0, 1, 0.1, -0.1, 0.0001), 20), lower.tail=TRUE, log.p=FALSE)
-  [1]    NaN 1.0000    NaN    NaN    NaN    NaN    NaN    NaN    NaN 0.7290
- [11]    NaN 1.0000    NaN    NaN 0.0000    NaN    NaN    NaN    NaN 1.0000
- [21]    NaN 1.0000    NaN    NaN    NaN    NaN 1.0000    NaN    NaN 0.9997
- [31]    NaN 1.0000    NaN    NaN    NaN    NaN    NaN    NaN    NaN 0.9990
- [41]    NaN 1.0000    NaN    NaN 0.0000    NaN    NaN    NaN    NaN 1.0000
- [51]    NaN 1.0000    NaN    NaN    NaN    NaN 0.0000    NaN    NaN 1.0000
- [61]    NaN 1.0000    NaN    NaN    NaN    NaN    NaN    NaN    NaN 0.7290
- [71]    NaN 1.0000    NaN    NaN 0.0000    NaN    NaN    NaN    NaN 1.0000
- [81]    NaN 1.0000    NaN    NaN    NaN    NaN 1.0000    NaN    NaN 0.9997
- [91]    NaN 1.0000    NaN    NaN    NaN    NaN    NaN    NaN    NaN 0.9990
-[101]    NaN 1.0000    NaN    NaN 0.0000    NaN    NaN    NaN    NaN 1.0000
-[111]    NaN 1.0000    NaN    NaN    NaN    NaN 0.0000    NaN    NaN 1.0000
-There were 49 warnings (use warnings() to see them)
-
-##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext#
-#set.seed(1); pbinom(c(-1, 0, 0.2, 2), c(-1, 0, 0.1, 0.9, 3), rep(c(-1, 0, 1, 0.1, -0.1, 0.0001), 20), lower.tail=TRUE, log.p=TRUE)
-  [1]           NaN  0.000000e+00           NaN           NaN           NaN
-  [6]           NaN           NaN           NaN           NaN -3.160815e-01
- [11]           NaN  0.000000e+00           NaN           NaN          -Inf
- [16]           NaN           NaN           NaN           NaN  0.000000e+00
- [21]           NaN  0.000000e+00           NaN           NaN           NaN
- [26]           NaN  0.000000e+00           NaN           NaN -3.000150e-04
- [31]           NaN  0.000000e+00           NaN           NaN           NaN
- [36]           NaN           NaN           NaN           NaN -1.000500e-03
- [41]           NaN  0.000000e+00           NaN           NaN          -Inf
- [46]           NaN           NaN           NaN           NaN  0.000000e+00
- [51]           NaN  0.000000e+00           NaN           NaN           NaN
- [56]           NaN          -Inf           NaN           NaN -1.000000e-12
- [61]           NaN  0.000000e+00           NaN           NaN           NaN
- [66]           NaN           NaN           NaN           NaN -3.160815e-01
- [71]           NaN  0.000000e+00           NaN           NaN          -Inf
- [76]           NaN           NaN           NaN           NaN  0.000000e+00
- [81]           NaN  0.000000e+00           NaN           NaN           NaN
- [86]           NaN  0.000000e+00           NaN           NaN -3.000150e-04
- [91]           NaN  0.000000e+00           NaN           NaN           NaN
- [96]           NaN           NaN           NaN           NaN -1.000500e-03
-[101]           NaN  0.000000e+00           NaN           NaN          -Inf
-[106]           NaN           NaN           NaN           NaN  0.000000e+00
-[111]           NaN  0.000000e+00           NaN           NaN           NaN
-[116]           NaN          -Inf           NaN           NaN -1.000000e-12
-There were 49 warnings (use warnings() to see them)
-
-##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext#
-#set.seed(1); pbinom(c(NA, 0, NaN, 1/0, -1/0), rep(c(1, 0, 0.1), 5), rep(c(1, 0, 0.1), 5))
- [1]  NA   1 NaN   1   0  NA   0 NaN NaN   0  NA NaN NaN   1 NaN
-Warning messages:
-1: In pbinom(c(NA, 0, NaN, 1/0, -1/0), rep(c(1, 0, 0.1), 5), rep(c(1,  :
-  non-integer n = 0.100000
-2: In pbinom(c(NA, 0, NaN, 1/0, -1/0), rep(c(1, 0, 0.1), 5), rep(c(1,  :
-  non-integer n = 0.100000
-3: In pbinom(c(NA, 0, NaN, 1/0, -1/0), rep(c(1, 0, 0.1), 5), rep(c(1,  :
-  non-integer n = 0.100000
-4: In pbinom(c(NA, 0, NaN, 1/0, -1/0), rep(c(1, 0, 0.1), 5), rep(c(1,  :
-  NaNs produced
-
-##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext#
-#set.seed(1); pbinom(rep(c(1, 0, 0.1), 5), c(NA, 0, NaN, 1/0, -1/0), rep(c(1, 0, 0.1), 5))
- [1]  NA   1 NaN NaN NaN  NA   1 NaN NaN NaN  NA   1 NaN NaN NaN
-Warning message:
-In pbinom(rep(c(1, 0, 0.1), 5), c(NA, 0, NaN, 1/0, -1/0), rep(c(1,  :
-  NaNs produced
-
-##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext#
-#set.seed(1); pbinom(rep(c(1, 0, 0.1), 5), rep(c(1, 0, 0.1), 5), c(NA, 0, NaN, 1/0, -1/0))
- [1]  NA   1 NaN NaN NaN  NA   1 NaN NaN NaN  NA NaN NaN NaN NaN
-Warning messages:
-1: In pbinom(rep(c(1, 0, 0.1), 5), rep(c(1, 0, 0.1), 5), c(NA, 0, NaN,  :
-  non-integer n = 0.100000
-2: In pbinom(rep(c(1, 0, 0.1), 5), rep(c(1, 0, 0.1), 5), c(NA, 0, NaN,  :
-  NaNs produced
-
 ##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext#
 #set.seed(1); pf(0, 10, 10, lower.tail=FALSE, log.p=FALSE)
 [1] 1
@@ -119832,141 +120023,6 @@ Warning message:
 In plogis(rep(c(1, 0, 0.1), 5), rep(c(1, 0, 0.1), 5), c(NA, 0, NaN,  :
   NaNs produced
 
-##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext#
-#set.seed(1); qbinom(0, 10, 10, lower.tail=FALSE, log.p=FALSE)
-[1] NaN
-Warning message:
-In qbinom(0, 10, 10, lower.tail = FALSE, log.p = FALSE) : NaNs produced
-
-##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext#
-#set.seed(1); qbinom(0, 10, 10, lower.tail=FALSE, log.p=TRUE)
-[1] NaN
-Warning message:
-In qbinom(0, 10, 10, lower.tail = FALSE, log.p = TRUE) : NaNs produced
-
-##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext#
-#set.seed(1); qbinom(0, 10, 10, lower.tail=TRUE, log.p=FALSE)
-[1] NaN
-Warning message:
-In qbinom(0, 10, 10, lower.tail = TRUE, log.p = FALSE) : NaNs produced
-
-##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext#
-#set.seed(1); qbinom(0, 10, 10, lower.tail=TRUE, log.p=TRUE)
-[1] NaN
-Warning message:
-In qbinom(0, 10, 10, lower.tail = TRUE, log.p = TRUE) : NaNs produced
-
-##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext#
-#set.seed(1); qbinom(0, c(0.0653, 0.000123, 32e-80, 8833, 79e70, 0, -1), rep(c(0.0653, 0.000123, 32e-80, 8833, 79e70), 7), lower.tail=FALSE, log.p=FALSE)
- [1]       NaN       NaN       NaN       NaN       NaN 0.000e+00       NaN
- [8]       NaN       NaN       NaN 8.833e+03 7.900e+71 0.000e+00       NaN
-[15]       NaN       NaN       NaN 8.833e+03       NaN       NaN       NaN
-[22]       NaN       NaN       NaN       NaN 7.900e+71 0.000e+00       NaN
-[29]       NaN       NaN       NaN 8.833e+03 7.900e+71       NaN       NaN
-Warning message:
-In qbinom(0, c(0.0653, 0.000123, 3.2e-79, 8833, 7.9e+71, 0, -1),  :
-  NaNs produced
-
-##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext#
-#set.seed(1); qbinom(0, c(0.0653, 0.000123, 32e-80, 8833, 79e70, 0, -1), rep(c(0.0653, 0.000123, 32e-80, 8833, 79e70), 7), lower.tail=FALSE, log.p=TRUE)
- [1] NaN NaN NaN NaN NaN   0 NaN NaN NaN NaN   0   0   0 NaN NaN NaN NaN   0 NaN
-[20] NaN NaN NaN NaN NaN NaN   0   0 NaN NaN NaN NaN   0   0 NaN NaN
-Warning message:
-In qbinom(0, c(0.0653, 0.000123, 3.2e-79, 8833, 7.9e+71, 0, -1),  :
-  NaNs produced
-
-##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext#
-#set.seed(1); qbinom(0, c(0.0653, 0.000123, 32e-80, 8833, 79e70, 0, -1), rep(c(0.0653, 0.000123, 32e-80, 8833, 79e70), 7), lower.tail=TRUE, log.p=FALSE)
- [1] NaN NaN NaN NaN NaN   0 NaN NaN NaN NaN   0   0   0 NaN NaN NaN NaN   0 NaN
-[20] NaN NaN NaN NaN NaN NaN   0   0 NaN NaN NaN NaN   0   0 NaN NaN
-Warning message:
-In qbinom(0, c(0.0653, 0.000123, 3.2e-79, 8833, 7.9e+71, 0, -1),  :
-  NaNs produced
-
-##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext#
-#set.seed(1); qbinom(0, c(0.0653, 0.000123, 32e-80, 8833, 79e70, 0, -1), rep(c(0.0653, 0.000123, 32e-80, 8833, 79e70), 7), lower.tail=TRUE, log.p=TRUE)
- [1]       NaN       NaN       NaN       NaN       NaN 0.000e+00       NaN
- [8]       NaN       NaN       NaN 8.833e+03 7.900e+71 0.000e+00       NaN
-[15]       NaN       NaN       NaN 8.833e+03       NaN       NaN       NaN
-[22]       NaN       NaN       NaN       NaN 7.900e+71 0.000e+00       NaN
-[29]       NaN       NaN       NaN 8.833e+03 7.900e+71       NaN       NaN
-Warning message:
-In qbinom(0, c(0.0653, 0.000123, 3.2e-79, 8833, 7.9e+71, 0, -1),  :
-  NaNs produced
-
-##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext#
-#set.seed(1); qbinom(c(-1, 0, 0.2, 2), c(-1, 0, 0.1, 0.9, 3), rep(c(-1, 0, 1, 0.1, -0.1, 0.0001), 20), lower.tail=FALSE, log.p=FALSE)
-  [1] NaN   0 NaN NaN NaN NaN NaN NaN NaN   3 NaN NaN NaN NaN   3 NaN NaN NaN
- [19] NaN NaN NaN   0 NaN NaN NaN NaN   0 NaN NaN   3 NaN NaN NaN NaN NaN NaN
- [37] NaN NaN NaN NaN NaN   0 NaN NaN NaN NaN NaN NaN NaN   3 NaN NaN NaN NaN
- [55] NaN NaN NaN NaN NaN NaN NaN   0 NaN NaN NaN NaN NaN NaN NaN   3 NaN NaN
- [73] NaN NaN   3 NaN NaN NaN NaN NaN NaN   0 NaN NaN NaN NaN   0 NaN NaN   3
- [91] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN   0 NaN NaN NaN NaN NaN NaN
-[109] NaN   3 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
-Warning message:
-In qbinom(c(-1, 0, 0.2, 2), c(-1, 0, 0.1, 0.9, 3), rep(c(-1, 0,  :
-  NaNs produced
-
-##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext#
-#set.seed(1); qbinom(c(-1, 0, 0.2, 2), c(-1, 0, 0.1, 0.9, 3), rep(c(-1, 0, 1, 0.1, -0.1, 0.0001), 20), lower.tail=FALSE, log.p=TRUE)
-  [1] NaN   0 NaN NaN NaN NaN NaN NaN NaN   0 NaN NaN NaN NaN NaN NaN NaN NaN
- [19] NaN NaN NaN   0 NaN NaN NaN NaN NaN NaN NaN   0 NaN NaN NaN NaN NaN NaN
- [37] NaN NaN NaN NaN NaN   0 NaN NaN   3 NaN NaN NaN NaN   0 NaN NaN NaN NaN
- [55] NaN NaN   0 NaN NaN NaN NaN   0 NaN NaN NaN NaN NaN NaN NaN   0 NaN NaN
- [73] NaN NaN NaN NaN NaN NaN NaN NaN NaN   0 NaN NaN NaN NaN NaN NaN NaN   0
- [91] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN   0 NaN NaN   3 NaN NaN NaN
-[109] NaN   0 NaN NaN NaN NaN NaN NaN   0 NaN NaN NaN
-Warning message:
-In qbinom(c(-1, 0, 0.2, 2), c(-1, 0, 0.1, 0.9, 3), rep(c(-1, 0,  :
-  NaNs produced
-
-##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext#
-#set.seed(1); qbinom(c(-1, 0, 0.2, 2), c(-1, 0, 0.1, 0.9, 3), rep(c(-1, 0, 1, 0.1, -0.1, 0.0001), 20), lower.tail=TRUE, log.p=FALSE)
-  [1] NaN   0 NaN NaN NaN NaN NaN NaN NaN   0 NaN NaN NaN NaN   3 NaN NaN NaN
- [19] NaN NaN NaN   0 NaN NaN NaN NaN   0 NaN NaN   0 NaN NaN NaN NaN NaN NaN
- [37] NaN NaN NaN NaN NaN   0 NaN NaN NaN NaN NaN NaN NaN   0 NaN NaN NaN NaN
- [55] NaN NaN NaN NaN NaN NaN NaN   0 NaN NaN NaN NaN NaN NaN NaN   0 NaN NaN
- [73] NaN NaN   3 NaN NaN NaN NaN NaN NaN   0 NaN NaN NaN NaN   0 NaN NaN   0
- [91] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN   0 NaN NaN NaN NaN NaN NaN
-[109] NaN   0 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
-Warning message:
-In qbinom(c(-1, 0, 0.2, 2), c(-1, 0, 0.1, 0.9, 3), rep(c(-1, 0,  :
-  NaNs produced
-
-##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext#
-#set.seed(1); qbinom(c(-1, 0, 0.2, 2), c(-1, 0, 0.1, 0.9, 3), rep(c(-1, 0, 1, 0.1, -0.1, 0.0001), 20), lower.tail=TRUE, log.p=TRUE)
-  [1] NaN   0 NaN NaN NaN NaN NaN NaN NaN   3 NaN NaN NaN NaN NaN NaN NaN NaN
- [19] NaN NaN NaN   0 NaN NaN NaN NaN NaN NaN NaN   3 NaN NaN NaN NaN NaN NaN
- [37] NaN NaN NaN NaN NaN   0 NaN NaN   3 NaN NaN NaN NaN   3 NaN NaN NaN NaN
- [55] NaN NaN   0 NaN NaN NaN NaN   0 NaN NaN NaN NaN NaN NaN NaN   3 NaN NaN
- [73] NaN NaN NaN NaN NaN NaN NaN NaN NaN   0 NaN NaN NaN NaN NaN NaN NaN   3
- [91] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN   0 NaN NaN   3 NaN NaN NaN
-[109] NaN   3 NaN NaN NaN NaN NaN NaN   0 NaN NaN NaN
-Warning message:
-In qbinom(c(-1, 0, 0.2, 2), c(-1, 0, 0.1, 0.9, 3), rep(c(-1, 0,  :
-  NaNs produced
-
-##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext#
-#set.seed(1); qbinom(c(NA, 0, NaN, 1/0, -1/0), rep(c(1, 0, 0.1), 5), rep(c(1, 0, 0.1), 5))
- [1]  NA   0 NaN NaN NaN  NA   0 NaN NaN NaN  NA NaN NaN NaN NaN
-Warning message:
-In qbinom(c(NA, 0, NaN, 1/0, -1/0), rep(c(1, 0, 0.1), 5), rep(c(1,  :
-  NaNs produced
-
-##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext#
-#set.seed(1); qbinom(rep(c(1, 0, 0.1), 5), c(NA, 0, NaN, 1/0, -1/0), rep(c(1, 0, 0.1), 5))
- [1]  NA   0 NaN NaN NaN  NA   0 NaN NaN NaN  NA   0 NaN NaN NaN
-Warning message:
-In qbinom(rep(c(1, 0, 0.1), 5), c(NA, 0, NaN, 1/0, -1/0), rep(c(1,  :
-  NaNs produced
-
-##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext#
-#set.seed(1); qbinom(rep(c(1, 0, 0.1), 5), rep(c(1, 0, 0.1), 5), c(NA, 0, NaN, 1/0, -1/0))
- [1]  NA   0 NaN NaN NaN  NA   1 NaN NaN NaN  NA NaN NaN NaN NaN
-Warning message:
-In qbinom(rep(c(1, 0, 0.1), 5), rep(c(1, 0, 0.1), 5), c(NA, 0, NaN,  :
-  NaNs produced
-
 ##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext#
 #set.seed(1); qf(0, 10, 10, lower.tail=FALSE, log.p=FALSE)
 [1] Inf
diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/library/stats/TestDistributions.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/library/stats/TestDistributions.java
index b372e72180..60da23630a 100644
--- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/library/stats/TestDistributions.java
+++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/library/stats/TestDistributions.java
@@ -115,7 +115,20 @@ public class TestDistributions extends TestBase {
                     // this should show non-integer warnings for quantiles
                     test("5, 5, 5", withQuantiles("0.1", "-Inf", "Inf", "0.3e89")).
                     // too many drawn balls: should be error
-                    test("3, 4, 10", withQuantiles("2"))
+                    test("3, 4, 10", withQuantiles("2")),
+            distr("pois").
+                    addErrorParamValues("-1", "0").
+                    test("10", withDefaultQ("5", "10", "15", "20", "30")).
+                    // seems to be the smallest lambda for which we get some results other than 0/1
+                    test("0.1e-6", withQuantiles("0.1e-10", "0.1", "1", "10")).
+                    test("1e100", withQuantiles("1e99", "1e99*9.999", "1e100-1", "1e100", "1e100+100", "1e101")),
+            distr("binom").
+                    addErrorParamValues("-1").
+                    test("20, 0.3", withDefaultQ("1", "2", "10", "20", "21")).
+                    test("10000, 0.01", withQuantiles("1", "10", "100", "500", "900", "1000")).
+                    // non-probability value is error for the second parameter
+                    test("10, -0.1", withQuantiles("2")).
+                    test("10, 5", withQuantiles("2"))
     };
     // @formatter:on
 
diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/library/stats/TestStatFunctions.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/library/stats/TestStatFunctions.java
index ad81c967d4..26e02689fe 100644
--- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/library/stats/TestStatFunctions.java
+++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/library/stats/TestStatFunctions.java
@@ -46,7 +46,7 @@ public class TestStatFunctions extends TestBase {
         assertEval(Output.IgnoreWhitespace, template("set.seed(1); %0(%1)", FUNCTION3_1_NAMES, FUNCTION3_1_PARAMS));
     }
 
-    private static final String[] FUNCTION2_1_NAMES = {"dchisq", "dgeom", "dpois", "dt"};
+    private static final String[] FUNCTION2_1_NAMES = {"dchisq", "dgeom", "dt"};
     private static final String[] FUNCTION2_1_PARAMS = {
                     "10, 10, log=TRUE",
                     "3, 3, log=FALSE",
@@ -61,7 +61,7 @@ public class TestStatFunctions extends TestBase {
         assertEval(Output.IgnoreWhitespace, template("set.seed(1); %0(%1)", FUNCTION2_1_NAMES, FUNCTION2_1_PARAMS));
     }
 
-    private static final String[] FUNCTION2_2_NAMES = {"pchisq", "qgeom", "pgeom", "qt", "pt", "qpois", "ppois", "qchisq"};
+    private static final String[] FUNCTION2_2_NAMES = {"pchisq", "qgeom", "pgeom", "qt", "pt", "qchisq"};
     private static final String[] FUNCTION2_2_PARAMS = {
                     "0, 10",
                     "c(-1, 0, 0.2, 2), rep(c(-1, 0, 0.1, 0.9, 3), 4)",
@@ -80,7 +80,7 @@ public class TestStatFunctions extends TestBase {
         assertEval(Output.IgnoreWhitespace, template("set.seed(1); %0(%1)", FUNCTION2_2_NAMES, new String[]{"rep(c(1, 0, 0.1), 5), c(NA, 0, NaN, 1/0, -1/0)"}));
     }
 
-    private static final String[] FUNCTION3_2_NAMES = {"qlnorm", "plnorm", "qbinom", "qlogis", "pf", "pbinom", "plogis", "qf"};
+    private static final String[] FUNCTION3_2_NAMES = {"qlnorm", "plnorm", "qlogis", "pf", "plogis", "qf"};
     private static final String[] FUNCTION3_2_PARAMS = {
                     "0, 10, 10",
                     "c(-1, 0, 0.2, 2), c(-1, 0, 0.1, 0.9, 3), rep(c(-1, 0, 1, 0.1, -0.1, 0.0001), 20)",
diff --git a/mx.fastr/copyrights/overrides b/mx.fastr/copyrights/overrides
index 1e88b6c869..602b12154d 100644
--- a/mx.fastr/copyrights/overrides
+++ b/mx.fastr/copyrights/overrides
@@ -79,6 +79,7 @@ com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/SplineFuncti
 com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/StatsFunctions.java,gnu_r_gentleman_ihaka.copyright
 com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/RandGenerationFunctions.java,gnu_r_gentleman_ihaka.copyright
 com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/RMath.java,gnu_r_ihaka.copyright
+com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/QuantileSearch.java,gnu_r_ihaka.copyright
 com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/RMathError.java,gnu_r.core.copyright
 com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/LogNormal.java,gnu_r_ihaka.copyright
 com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/MathConstants.java,gnu_r_ihaka.copyright
-- 
GitLab