diff --git a/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/REngine.java b/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/REngine.java index ee090e1c1ac7134433c540a1242dc2a56006ab89..98257aacce7f7dcbbfba7046936ea787652cb8f0 100644 --- a/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/REngine.java +++ b/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/REngine.java @@ -40,6 +40,8 @@ import com.oracle.truffle.api.frame.FrameDescriptor; import com.oracle.truffle.api.frame.MaterializedFrame; import com.oracle.truffle.api.frame.VirtualFrame; import com.oracle.truffle.api.interop.TruffleObject; +import com.oracle.truffle.api.nodes.DirectCallNode; +import com.oracle.truffle.api.nodes.ExplodeLoop; import com.oracle.truffle.api.nodes.Node; import com.oracle.truffle.api.nodes.RootNode; import com.oracle.truffle.api.profiles.ConditionProfile; @@ -309,6 +311,7 @@ final class REngine implements Engine, Engine.Timings { private final class PolyglotEngineRootNode extends RootNode { private final List<RSyntaxNode> statements; + @Children private final DirectCallNode[] calls; private final boolean printResult; @Child private Node findContext = TruffleRLanguage.INSTANCE.actuallyCreateFindContextNode(); @@ -318,6 +321,7 @@ final class REngine implements Engine, Engine.Timings { // can't print if initializing the system in embedded mode (no builtins yet) this.printResult = !sourceSection.getSource().getName().equals(RSource.Internal.INIT_EMBEDDED.string); this.statements = statements; + this.calls = new DirectCallNode[statements.size()]; } /** @@ -326,6 +330,7 @@ final class REngine implements Engine, Engine.Timings { * control over what that might be when the call is initiated. */ @Override + @ExplodeLoop public Object execute(VirtualFrame frame) { RContext oldContext = RContext.getThreadLocalInstance(); RContext newContext = TruffleRLanguage.INSTANCE.actuallyFindContext0(findContext); @@ -334,8 +339,11 @@ final class REngine implements Engine, Engine.Timings { Object lastValue = RNull.instance; for (int i = 0; i < statements.size(); i++) { RSyntaxNode node = statements.get(i); - RootCallTarget callTarget = doMakeCallTarget(node.asRNode(), RSource.Internal.REPL_WRAPPER.string, printResult, true); - lastValue = callTarget.call(newContext.stateREnvironment.getGlobalFrame()); + if (calls[i] == null) { + CompilerDirectives.transferToInterpreterAndInvalidate(); + calls[i] = insert(Truffle.getRuntime().createDirectCallNode(doMakeCallTarget(node.asRNode(), RSource.Internal.REPL_WRAPPER.string, printResult, true))); + } + lastValue = calls[i].call(frame, new Object[]{newContext.stateREnvironment.getGlobalFrame()}); } return lastValue; } catch (ReturnException ex) { @@ -526,7 +534,7 @@ final class REngine implements Engine, Engine.Timings { if (topLevel) { RErrorHandling.printWarnings(suppressWarnings); } - setVisibility.executeEndOfFunction(vf); + setVisibility.executeEndOfFunction(vf, this); } catch (RError e) { CompilerDirectives.transferToInterpreter(); throw e; @@ -558,6 +566,11 @@ final class REngine implements Engine, Engine.Timings { return result; } + @Override + public String getName() { + return description; + } + @Override public String toString() { return description; diff --git a/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/Chisq.java b/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/Chisq.java index c39fa8c5e71ef0ff5c84add184ea21ccee6cd3df..62205497a7d92a5001454b1052b948a90fd643b7 100644 --- a/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/Chisq.java +++ b/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/Chisq.java @@ -13,11 +13,18 @@ package com.oracle.truffle.r.library.stats; import static com.oracle.truffle.r.library.stats.GammaFunctions.dgamma; import static com.oracle.truffle.r.library.stats.GammaFunctions.pgamma; +import static com.oracle.truffle.r.library.stats.GammaFunctions.qgamma; +import com.oracle.truffle.r.library.stats.RandGenerationFunctions.RandFunction1_Double; +import com.oracle.truffle.r.library.stats.RandGenerationFunctions.RandomNumberProvider; import com.oracle.truffle.r.library.stats.StatsFunctions.Function2_1; import com.oracle.truffle.r.library.stats.StatsFunctions.Function2_2; public final class Chisq { + private Chisq() { + // only static members + } + public static final class PChisq implements Function2_2 { @Override public double evaluate(double x, double df, boolean lowerTail, boolean logP) { @@ -31,4 +38,25 @@ public final class Chisq { return dgamma(x, df / 2., 2., giveLog); } } + + public static final class QChisq implements Function2_2 { + @Override + public double evaluate(double p, double df, boolean lowerTail, boolean logP) { + return qgamma(p, 0.5 * df, 2.0, lowerTail, logP); + } + } + + public static final class RChisq extends RandFunction1_Double { + public static double rchisq(double df, RandomNumberProvider rand) { + if (!Double.isFinite(df) || df < 0.0) { + return RMath.mlError(); + } + return new RGamma().execute(df / 2.0, 2.0, rand); + } + + @Override + public double execute(double a, RandomNumberProvider rand) { + return rchisq(a, rand); + } + } } diff --git a/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/DPQ.java b/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/DPQ.java index 24e3dfb71a5fcc398c73a54ba570045501f9ae2b..4509a1f64689f66db8aefc9e0e839648c10b4b84 100644 --- a/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/DPQ.java +++ b/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/DPQ.java @@ -43,7 +43,7 @@ public final class DPQ { // R >= 3.1.0: # define R_nonint(x) (fabs((x) - R_forceint(x)) > 1e-7) // Note: if true should be followed by "return d0(logP)", consider using nointCheck instead public static boolean nonint(double x) { - return Math.abs(x - Math.round(x)) > 1e-7 * Math.max(1., Math.abs(x)); + return Math.abs(x - RMath.forceint(x)) > 1e-7 * Math.max(1., Math.abs(x)); } // R_D__0 @@ -51,6 +51,11 @@ public final class DPQ { return logP ? Double.NEGATIVE_INFINITY : 0.; } + // R_D_half (log_p ? -M_LN2 : 0.5) + public static double rdhalf(boolean logP) { + return logP ? -M_LN2 : 0.5; + } + // R_D__1 public static double rd1(boolean logP) { return logP ? 0. : 1.; @@ -117,6 +122,11 @@ public final class DPQ { return logP ? RMath.log1p(-(p)) : (0.5 - (p) + 0.5); } + // R_D_qIv (log_p ? exp(p) : (p)) + public static double rdqiv(double p, boolean logP) { + return logP ? Math.exp(p) : p; + } + // R_DT_qIv public static double rdtqiv(double p, boolean lowerTail, boolean logP) { return logP ? lowerTail ? Math.exp(p) : -Math.expm1(p) : rdlval(p, lowerTail); @@ -156,7 +166,7 @@ public final class DPQ { // R_P_bounds_Inf_01 public static void rpboundsinf01(double x, boolean lowerTail, boolean logP) throws EarlyReturn { if (!Double.isFinite(x)) { - throw new EarlyReturn(x > 0 ? rdt0(lowerTail, logP) : rdt0(lowerTail, logP)); + throw new EarlyReturn(x > 0 ? rdt1(lowerTail, logP) : rdt0(lowerTail, logP)); } } diff --git a/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/DPois.java b/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/DPois.java index b01d2a4d75603a4b862849e498ef24a41ce0e167..c60b2f0bd5a45c0635872a019a956b6b54763e2e 100644 --- a/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/DPois.java +++ b/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/DPois.java @@ -13,7 +13,7 @@ package com.oracle.truffle.r.library.stats; import static com.oracle.truffle.r.library.stats.GammaFunctions.dpoisRaw; -import static com.oracle.truffle.r.library.stats.MathConstants.forceint; +import static com.oracle.truffle.r.library.stats.RMath.forceint; import com.oracle.truffle.r.library.stats.DPQ.EarlyReturn; import com.oracle.truffle.r.library.stats.StatsFunctions.Function2_1; diff --git a/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/Dbinom.java b/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/Dbinom.java index 509f543c81aeb163e1eb86ccf6725ea40a88f95d..0486d311a7cce855fd617c28224dae4a39454e27 100644 --- a/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/Dbinom.java +++ b/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/Dbinom.java @@ -88,6 +88,6 @@ public final class Dbinom implements StatsFunctions.Function3_1 { return DPQ.rd0(giveLog); } - return dbinomRaw(MathConstants.forceint(x), MathConstants.forceint(n), p, 1 - p, giveLog); + return dbinomRaw(RMath.forceint(x), RMath.forceint(n), p, 1 - p, giveLog); } } diff --git a/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/GammaFunctions.java b/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/GammaFunctions.java index 2a700e05a9605b176c60f1b734439fdcb02bb986..645d38b0cf9865ef4b9806138fdc8766a048a5f2 100644 --- a/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/GammaFunctions.java +++ b/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/GammaFunctions.java @@ -895,9 +895,8 @@ public abstract class GammaFunctions { if (logp) { return rlog1exp(RMath.log1p(sum) + lf2); } else { - double f1m1 = sum; double f2m1 = RMath.expm1(lf2); - return -(f1m1 + f2m1 + f1m1 * f2m1); + return -(sum + f2m1 + sum * f2m1); } } } /* pgamma_smallx() */ @@ -1382,7 +1381,7 @@ public abstract class GammaFunctions { // pnorm // - private static double pnorm(double x, double mu, double sigma, boolean lowerTail, boolean logp) { + static double pnorm(double x, double mu, double sigma, boolean lowerTail, boolean logp) { double p; double cp = 0; double localX = x; diff --git a/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/Geom.java b/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/Geom.java index 05443e198bffdfd8b79857b67b4ffbd56d6c5949..a01c809ff41a1f05c90d102784cf48b3c0b36356 100644 --- a/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/Geom.java +++ b/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/Geom.java @@ -27,7 +27,7 @@ */ package com.oracle.truffle.r.library.stats; -import static com.oracle.truffle.r.library.stats.MathConstants.forceint; +import static com.oracle.truffle.r.library.stats.RMath.forceint; import com.oracle.truffle.r.library.stats.DPQ.EarlyReturn; import com.oracle.truffle.r.library.stats.RandGenerationFunctions.RandFunction1_Double; @@ -91,6 +91,37 @@ public final class Geom { } } + public static final class PGeom implements Function2_2 { + @Override + public double evaluate(double xIn, double p, boolean lowerTail, boolean logP) { + if (Double.isNaN(xIn) || Double.isNaN(p)) { + return xIn + p; + } + if (p <= 0 || p > 1) { + return RMath.mlError(); + } + + if (xIn < 0.) { + return DPQ.rdt0(lowerTail, logP); + } + if (!Double.isFinite(xIn)) { + return DPQ.rdt1(lowerTail, logP); + } + double x = Math.floor(xIn + 1e-7); + + if (p == 1.) { /* we cannot assume IEEE */ + x = lowerTail ? 1 : 0; + return logP ? Math.log(x) : x; + } + x = RMath.log1p(-p) * (x + 1); + if (logP) { + return DPQ.rdtclog(x, lowerTail, logP); + } else { + return lowerTail ? -RMath.expm1(x) : Math.exp(x); + } + } + } + public static final class RGeom extends RandFunction1_Double { @Override public double execute(double p, RandomNumberProvider rand) { diff --git a/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/Logis.java b/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/Logis.java new file mode 100644 index 0000000000000000000000000000000000000000..45328c469331798c9b31b771a18ccb2fa49c477d --- /dev/null +++ b/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/Logis.java @@ -0,0 +1,137 @@ +/* + * 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) 1998--2008, The R Core Team + * Copyright (c) 2016, 2016, Oracle and/or its affiliates + * + * All rights reserved. + */ +/* + * Copyright (C) 1995, 1996 Robert Gentleman and Ross Ihaka + * Copyright (C) 2000 The R Core Team + */ +package com.oracle.truffle.r.library.stats; + +import com.oracle.truffle.r.library.stats.DPQ.EarlyReturn; +import com.oracle.truffle.r.library.stats.RandGenerationFunctions.RandFunction2_Double; +import com.oracle.truffle.r.library.stats.RandGenerationFunctions.RandomNumberProvider; +import com.oracle.truffle.r.library.stats.StatsFunctions.Function3_1; +import com.oracle.truffle.r.library.stats.StatsFunctions.Function3_2; + +public final class Logis { + private Logis() { + // only static members + } + + public static final class DLogis implements Function3_1 { + @Override + public double evaluate(double x, double location, double scale, boolean giveLog) { + if (Double.isNaN(x) || Double.isNaN(location) || Double.isNaN(scale)) { + return x + location + scale; + } + if (scale <= 0.0) { + return RMath.mlError(); + } + + x = TOMS708.fabs((x - location) / scale); + double e = Math.exp(-x); + double f = 1.0 + e; + return giveLog ? -(x + Math.log(scale * f * f)) : e / (scale * f * f); + } + } + + public static final class QLogis implements Function3_2 { + @Override + public double evaluate(double p, double location, double scale, boolean lowerTail, boolean logP) { + if (Double.isNaN(p) || Double.isNaN(location) || Double.isNaN(scale)) { + return p + location + scale; + } + + try { + DPQ.rqp01boundaries(p, Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY, lowerTail, logP); + } catch (EarlyReturn e) { + return e.result; + } + + if (scale < 0.) { + return RMath.mlError(); + } + if (scale == 0.) { + return location; + } + + /* p := logit(p) = Math.log( p / (1-p) ) : */ + if (logP) { + if (lowerTail) { + p = p - DPQ.rlog1exp(p); + } else { + p = DPQ.rlog1exp(p) - p; + } + } else { + p = Math.log(lowerTail ? (p / (1. - p)) : ((1. - p) / p)); + } + + return location + scale * p; + } + } + + public static final class PLogis implements Function3_2 { + @Override + public double evaluate(double x, double location, double scale, boolean lowerTail, boolean logP) { + if (Double.isNaN(x) || Double.isNaN(location) || Double.isNaN(scale)) { + return x + location + scale; + } + if (scale <= 0.0) { + return RMath.mlError(); + } + + x = (x - location) / scale; + if (Double.isNaN(x)) { + return RMath.mlError(); + } + + try { + DPQ.rpboundsinf01(x, lowerTail, logP); + } catch (EarlyReturn earlyReturn) { + return earlyReturn.result; + } + + if (logP) { + // Math.log(1 / (1 + Math.exp( +- x ))) = -Math.log(1 + Math.exp( +- x)) + return -log1pexp(lowerTail ? -x : x); + } else { + return 1 / (1 + Math.exp(lowerTail ? -x : x)); + } + } + + private static double log1pexp(double x) { + if (x <= 18.) { + return RMath.log1p(Math.exp(x)); + } + if (x > 33.3) { + return x; + } + // else: 18.0 < x <= 33.3 : + return x + Math.exp(-x); + } + } + + public static final class RLogis extends RandFunction2_Double { + @Override + public double execute(double location, double scale, RandomNumberProvider rand) { + if (Double.isNaN(location) || !Double.isFinite(scale)) { + return RMath.mlError(); + } + + if (scale == 0. || !Double.isFinite(location)) { + return location; + } else { + double u = rand.unifRand(); + return location + scale * Math.log(u / (1. - u)); + } + } + } +} diff --git a/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/MathConstants.java b/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/MathConstants.java index 0885fbeecf503bb056f1c289b3c2096f5ef3e5a3..1f257567fca09a92c5d911e6934d8762ae6c30e2 100644 --- a/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/MathConstants.java +++ b/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/MathConstants.java @@ -86,6 +86,8 @@ public final class MathConstants { public static final double DBL_EPSILON = Math.ulp(1.0); + public static final double ML_NAN = Double.NaN; + /** * Compute the log of a sum from logs of terms, i.e., * @@ -97,11 +99,4 @@ public final class MathConstants { public static double logspaceAdd(double logx, double logy) { return Math.max(logx, logy) + Math.log1p(Math.exp(-Math.abs(logx - logy))); } - - // R_forceint - public static double forceint(double x) { - // Note: in GnuR this is alias for nearbyint, which may not behave exactly like Math.round, - // especially Math.round(-0.5) == 0.0, instead of -0.0, does it matter a lot? - return Double.isFinite(x) ? Math.round(x) : x; - } } diff --git a/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/PPois.java b/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/PPois.java new file mode 100644 index 0000000000000000000000000000000000000000..cb67510db3cd5d1c41278662627c9583032cf25f --- /dev/null +++ b/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/PPois.java @@ -0,0 +1,37 @@ +/* + * 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, The R Core Team + * Copyright (c) 2016, Oracle and/or its affiliates + * + * All rights reserved. + */ +package com.oracle.truffle.r.library.stats; + +import static com.oracle.truffle.r.library.stats.GammaFunctions.pgamma; + +import com.oracle.truffle.r.library.stats.StatsFunctions.Function2_2; + +public class PPois implements Function2_2 { + @Override + public double evaluate(double x, double lambda, boolean lowerTail, boolean logP) { + if (Double.isNaN(x) || Double.isNaN(lambda) || lambda < 0.) { + return RMath.mlError(); + } + if (x < 0) { + return DPQ.rdt0(lowerTail, logP); + } + if (lambda == 0.) { + return DPQ.rdt1(lowerTail, logP); + } + if (!Double.isFinite(x)) { + return DPQ.rdt1(lowerTail, logP); + } + x = Math.floor(x + 1e-7); + + return pgamma(lambda, x + 1, 1., !lowerTail, logP); + } +} diff --git a/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/Pbeta.java b/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/Pbeta.java index 02c713c68abadf8fe6755b5a2ead937269cc88bd..4c12e76f64cc9dc11324231c7a825de34b62abb3 100644 --- a/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/Pbeta.java +++ b/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/Pbeta.java @@ -29,7 +29,7 @@ public final class Pbeta implements Function3_2 { } @TruffleBoundary - private static double pbetaRaw(double x, double a, double b, boolean lowerTail, boolean logProb) { + static double pbetaRaw(double x, double a, double b, boolean lowerTail, boolean logProb) { // treat limit cases correctly here: if (a == 0 || b == 0 || !Double.isFinite(a) || !Double.isFinite(b)) { // NB: 0 < x < 1 : diff --git a/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/Pbinom.java b/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/Pbinom.java index 70fcce282db80d30395effba2881a35c155aafcb..e61ab3cb1f1be4c0c18a91c878191db9aebc6382 100644 --- a/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/Pbinom.java +++ b/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/Pbinom.java @@ -34,9 +34,9 @@ public final class Pbinom implements StatsFunctions.Function3_2 { if (DPQ.nonint(size)) { nanProfile.enter(); DPQ.nointCheckWarning(size, "n"); - return DPQ.rd0(logP); + return RMath.mlError(); } - size = Math.round(size); + size = RMath.forceint(size); /* PR#8560: n=0 is a valid value */ if (size < 0 || prob < 0 || prob > 1) { nanProfile.enter(); diff --git a/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/Pt.java b/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/Pt.java new file mode 100644 index 0000000000000000000000000000000000000000..20373ea17dd2e82f10ee5acf05d595feb4e55b8f --- /dev/null +++ b/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/Pt.java @@ -0,0 +1,85 @@ +/* + * 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) 1995, 1996, Robert Gentleman and Ross Ihaka + * Copyright (c) 2000-2007, The R Core Team + * Copyright (c) 2016, Oracle and/or its affiliates + * + * All rights reserved. + */ +package com.oracle.truffle.r.library.stats; + +import static com.oracle.truffle.r.library.stats.GammaFunctions.pnorm; +import static com.oracle.truffle.r.library.stats.LBeta.lbeta; +import static com.oracle.truffle.r.library.stats.MathConstants.M_LN2; +import static com.oracle.truffle.r.library.stats.Pbeta.pbeta; + +import com.oracle.truffle.api.profiles.BranchProfile; +import com.oracle.truffle.r.library.stats.StatsFunctions.Function2_2; + +public class Pt implements Function2_2 { + private final BranchProfile pbetaNanProfile = BranchProfile.create(); + + @Override + public double evaluate(double x, double n, boolean lowerTail, boolean logP) { + /* + * return P[ T <= x ] where T ~ t_{n} (t distrib. with n degrees of freedom). + * + * --> ./pnt.c for NON-central + */ + if (Double.isNaN(x) || Double.isNaN(n)) { + return x + n; + } + + if (n <= 0.0) { + return RMath.mlError(); + } + + if (!Double.isFinite(x)) { + return (x < 0) ? DPQ.rdt0(lowerTail, logP) : DPQ.rdt1(lowerTail, logP); + } + if (!Double.isFinite(n)) { + return pnorm(x, 0.0, 1.0, lowerTail, logP); + } + + double nx = 1 + (x / n) * x; + /* + * FIXME: This test is probably losing rather than gaining precision, now that pbeta(*, + * log_p = true) is much better. Note however that a version of this test *is* needed for + * x*x > D_MAX + */ + double val; + if (nx > 1e100) { /* <==> x*x > 1e100 * n */ + /* + * Danger of underflow. So use Abramowitz & Stegun 26.5.4 pbeta(z, a, b) ~ z^a(1-z)^b / + * aB(a,b) ~ z^a / aB(a,b), with z = 1/nx, a = n/2, b= 1/2 : + */ + double lval; + lval = -0.5 * n * (2 * Math.log(Math.abs(x)) - Math.log(n)) - lbeta(0.5 * n, 0.5) - Math.log(0.5 * n); + val = logP ? lval : Math.exp(lval); + } else { + val = (n > x * x) + ? pbeta(x * x / (n + x * x), 0.5, n / 2., /* lower_tail */false, logP, pbetaNanProfile) + : pbeta(1. / nx, n / 2., 0.5, /* lower_tail */true, logP, pbetaNanProfile); + } + + /* Use "1 - v" if lower_tail and x > 0 (but not both): */ + if (x <= 0.) { + lowerTail = !lowerTail; + } + + if (logP) { + if (lowerTail) { + return RMath.log1p(-0.5 * Math.exp(val)); + } else { + return val - M_LN2; /* = Math.log(.5* pbeta(....)) */ + } + } else { + val /= 2.; + return DPQ.rdcval(val, lowerTail); + } + + } +} diff --git a/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/QBeta.java b/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/QBeta.java new file mode 100644 index 0000000000000000000000000000000000000000..7af7d44a25bedc7d72d42edbc8005805d6c0e0d7 --- /dev/null +++ b/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/QBeta.java @@ -0,0 +1,659 @@ +/* + * 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) 1995, 1996, Robert Gentleman and Ross Ihaka + * Copyright (c) 1998-2015, The R Core Team + * Copyright (c) 2016, Oracle and/or its affiliates + * + * All rights reserved. + */ +/* + * based on code (C) 1979 and later Royal Statistical Society + * + * Reference: + * Cran, G. W., K. J. Martin and G. E. Thomas (1977). + * Remark AS R19 and Algorithm AS 109, + * Applied Statistics, 26(1), 111-114. + * Remark AS R83 (v.39, 309-310) and the correction (v.40(1) p.236) + * have been incorporated in this version. + */ +package com.oracle.truffle.r.library.stats; + +import static com.oracle.truffle.r.library.stats.Arithmetic.powDi; +import static com.oracle.truffle.r.library.stats.LBeta.lbeta; +import static com.oracle.truffle.r.library.stats.MathConstants.DBL_MANT_DIG; +import static com.oracle.truffle.r.library.stats.MathConstants.DBL_MIN_EXP; +import static com.oracle.truffle.r.library.stats.MathConstants.ML_NAN; +import static com.oracle.truffle.r.library.stats.MathConstants.M_LN2; +import static com.oracle.truffle.r.library.stats.Pbeta.pbetaRaw; + +import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary; +import com.oracle.truffle.r.library.stats.RMath.MLError; +import com.oracle.truffle.r.library.stats.StatsFunctions.Function3_2; +import com.oracle.truffle.r.runtime.RError.Message; + +public final class QBeta implements Function3_2 { + private static final double USE_LOG_X_CUTOFF = -5.; + private static final int N_NEWTON_FREE = 4; + // TODO: find out why this??? Is swap_01 R logical?? + private static final int MLOGICAL_NA = -1; + + @Override + public double evaluate(double alpha, double p, double q, boolean lowerTail, boolean logP) { + if (Double.isNaN(p) || Double.isNaN(q) || Double.isNaN(alpha)) { + return p + q + alpha; + } + + if (p < 0. || q < 0.) { + return RMath.mlError(); + } + // allowing p==0 and q==0 <==> treat as one- or two-point mass + + double[] qbet = new double[2]; // = { qbeta(), 1 - qbeta() } + new QBetaRawMethod().qbeta_raw(alpha, p, q, lowerTail, logP, MLOGICAL_NA, USE_LOG_X_CUTOFF, N_NEWTON_FREE, qbet); + return qbet[0]; + + } + + /** + * Debugging printfs should print exactly the same output as GnuR, this can help with debugging. + */ + private static void debugPrintf(@SuppressWarnings("unused") String fmt, @SuppressWarnings("unused") Object... args) { + // System.out.printf(fmt + "\n", args); + } + + private static final double acu_min = 1e-300; + private static final double log_eps_c = M_LN2 * (1. - DBL_MANT_DIG); // = log(DBL_EPSILON) = + // -36.04..; + private static final double fpu = 3e-308; + private static final double p_lo = fpu; + private static final double p_hi = 1 - 2.22e-16; + + private static final double const1 = 2.30753; + private static final double const2 = 0.27061; + private static final double const3 = 0.99229; + private static final double const4 = 0.04481; + + private static final double DBL_very_MIN = Double.MIN_VALUE / 4.; + private static final double DBL_log_v_MIN = M_LN2 * (DBL_MIN_EXP - 2); + private static final double DBL_1__eps = 0x1.fffffffffffffp-1; // = 1 - 2^-53 + + // The fields and variables are named after local variables from GnuR, we keep the original + // names for the ease of debugging + // Checkstyle: stop field name check + private static class QBetaRawMethod { + private boolean give_log_q; + private boolean use_log_x; + private boolean add_N_step; + private double logbeta; + private boolean swap_tail; + private double a; + private double la; + private double pp; + private double qq; + private double r; + private double t; + private double tx; + private double u_n; + private double xinbta; + private double u; + private boolean warned; + private double acu; + private double y; + private double w; + private boolean log_; // or u < log_q_cut below + private double p_; + private double u0; + private double s; + private double h; + boolean bad_u; + boolean bad_init; + private double g; + private double D; + + /** + * + * @param alpha + * @param p + * @param q + * @param lower_tail + * @param log_p + * @param swap_01 {true, NA, false}: if NA, algorithm decides swap_tail + * @param log_q_cut if == Inf: return Math.log(qbeta(..)); otherwise, if finite: the bound + * for switching to Math.log(x)-scale; see use_log_x + * @param n_N number of "unconstrained" Newton steps before switching to constrained + * @param qb The result will be saved to this 2 dimensional array = qb[0:1] = { qbeta(), 1 - + * qbeta() }. + */ + @TruffleBoundary + private void qbeta_raw(double alpha, double p, double q, boolean lower_tail, boolean log_p, + int swap_01, + double log_q_cut, + int n_N, + double[] qb) { + give_log_q = (log_q_cut == Double.POSITIVE_INFINITY); + use_log_x = give_log_q; + add_N_step = true; + y = -1.; + + // Assuming p >= 0, q >= 0 here ... + + // Deal with boundary cases here: + if (alpha == DPQ.rdt0(lower_tail, log_p)) { + returnQ0(qb, give_log_q); + return; + } + if (alpha == DPQ.rdt1(lower_tail, log_p)) { + returnQ1(qb, give_log_q); + return; + } + + // check alpha {*before* transformation which may all accuracy}: + if ((log_p && alpha > 0) || + (!log_p && (alpha < 0 || alpha > 1))) { // alpha is outside + debugPrintf("qbeta(alpha=%g, %g, %g, .., log_p=%d): %s%s\n", + alpha, p, q, log_p, "alpha not in ", + log_p ? "[-Inf, 0]" : "[0,1]"); + // ML_ERR_return_NAN : + RMath.mlError(MLError.DOMAIN, ""); + qb[0] = qb[1] = ML_NAN; + return; + } + + // p==0, q==0, p = Inf, q = Inf <==> treat as one- or two-point mass + if (p == 0 || q == 0 || !Double.isFinite(p) || !Double.isFinite(q)) { + // We know 0 < T(alpha) < 1 : pbeta() is constant and trivial in {0, 1/2, 1} + debugPrintf( + "qbeta(%g, %g, %g, lower_t=%d, log_p=%d): (p,q)-boundary: trivial\n", + alpha, p, q, lower_tail, log_p); + if (p == 0 && q == 0) { // point mass 1/2 at each of {0,1} : + if (alpha < DPQ.rdhalf(log_p)) { + returnQ0(qb, give_log_q); + } else if (alpha > DPQ.rdhalf(log_p)) { + returnQ1(qb, give_log_q); + } else { + returnQHalf(qb, give_log_q); + } + return; + } else if (p == 0 || p / q == 0) { // point mass 1 at 0 - "flipped around" + returnQ0(qb, give_log_q); + } else if (q == 0 || q / p == 0) { // point mass 1 at 0 - "flipped around" + returnQ1(qb, give_log_q); + } else { + // else: p = q = Inf : point mass 1 at 1/2 + returnQHalf(qb, give_log_q); + } + return; + } + + p_ = DPQ.rdtqiv(alpha, lower_tail, log_p); + logbeta = lbeta(p, q); + boolean swap_choose = (swap_01 == MLOGICAL_NA); + swap_tail = swap_choose ? (p_ > 0.5) : swap_01 != 0; + if (swap_tail) { /* change tail, swap p <-> q : */ + a = DPQ.rdtciv(alpha, lower_tail, log_p); // = 1 - p_ < 1/2 + /* la := log(a), but without numerical cancellation: */ + la = DPQ.rdtclog(alpha, lower_tail, log_p); + pp = q; + qq = p; + } else { + a = p_; + la = DPQ.rdtlog(alpha, lower_tail, log_p); + pp = p; + qq = q; + } + + /* calculate the initial approximation */ + + /* + * Desired accuracy for Newton iterations (below) should depend on (a,p) This is from + * Remark .. on AS 109, adapted. However, it's not clear if this is "optimal" for IEEE + * double prec. + * + * acu = fmax2(acu_min, pow(10., -25. - 5./(pp * pp) - 1./(a * a))); + * + * NEW: 'acu' accuracy NOT for squared adjustment, but simple; ---- i.e., "new acu" = + * sqrt(old acu) + */ + acu = Math.max(acu_min, Math.pow(10., -13. - 2.5 / (pp * pp) - 0.5 / (a * a))); + // try to catch "extreme left tail" early + u0 = (la + Math.log(pp) + logbeta) / pp; // = log(x_0) + r = pp * (1. - qq) / (pp + 1.); + t = 0.2; + + debugPrintf( + "qbeta(%g, %g, %g, lower_t=%d, log_p=%d):%s\n" + + " swap_tail=%d, la=%g, u0=%g (bnd: %g (%g)) ", + alpha, p, q, lower_tail, log_p, + (log_p && (p_ == 0. || p_ == 1.)) ? (p_ == 0. ? " p_=0" : " p_=1") : "", + swap_tail, la, u0, + (t * log_eps_c - Math.log(Math.abs(pp * (1. - qq) * (2. - qq) / (2. * (pp + 2.))))) / 2., + t * log_eps_c - Math.log(Math.abs(r))); + + tx = 0.; + if (M_LN2 * DBL_MIN_EXP < u0 && // cannot allow exp(u0) = 0 ==> exp(u1) = exp(u0) = 0 + u0 < -0.01 && // (must: u0 < 0, but too close to 0 <==> x = exp(u0) = + // 0.99..) + // qq <= 2 && // <--- "arbitrary" + // u0 < t*log_eps_c - log(fabs(r)) && + u0 < (t * log_eps_c - Math.log(Math.abs(pp * (1. - qq) * (2. - qq) / (2. * (pp + 2.))))) / 2.) { + // TODO: maybe jump here from below, when initial u "fails" ? + // L_tail_u: + // MM's one-step correction (cheaper than 1 Newton!) + r = r * Math.exp(u0); // = r*x0 + if (r > -1.) { + u = u0 - RMath.log1p(r) / pp; + debugPrintf("u1-u0=%9.3g --> choosing u = u1\n", u - u0); + } else { + u = u0; + debugPrintf("cannot cheaply improve u0\n"); + } + tx = xinbta = Math.exp(u); + use_log_x = true; // or (u < log_q_cut) ?? + newton(n_N, log_p, qb); + return; + } + + // y := y_\alpha in AS 64 := Hastings(1955) approximation of qnorm(1 - a) : + r = Math.sqrt(-2 * la); + y = r - (const1 + const2 * r) / (1. + (const3 + const4 * r) * r); + + if (pp > 1 && qq > 1) { // use Carter(1947), see AS 109, remark '5.' + r = (y * y - 3.) / 6.; + s = 1. / (pp + pp - 1.); + t = 1. / (qq + qq - 1.); + h = 2. / (s + t); + w = y * Math.sqrt(h + r) / h - (t - s) * (r + 5. / 6. - 2. / (3. * h)); + debugPrintf("p,q > 1 => w=%g", w); + if (w > 300) { // Math.exp(w+w) is huge or overflows + t = w + w + Math.log(qq) - Math.log(pp); // = argument of log1pMath.exp(.) + u = // Math.log(xinbta) = - log1p(qq/pp * Math.exp(w+w)) = -Math.log(1 + + // Math.exp(t)) + (t <= 18) ? -RMath.log1p(Math.exp(t)) : -t - Math.exp(-t); + xinbta = Math.exp(u); + } else { + xinbta = pp / (pp + qq * Math.exp(w + w)); + u = // Math.log(xinbta) + -RMath.log1p(qq / pp * Math.exp(w + w)); + } + } else { // use the original AS 64 proposal, Scheffé-Tukey (1944) and Wilson-Hilferty + r = qq + qq; + /* + * A slightly more stable version of t := \chi^2_{alpha} of AS 64 t = 1. / (9. * + * qq); t = r * R_pow_di(1. - t + y * Math.sqrt(t), 3); + */ + t = 1. / (3. * Math.sqrt(qq)); + t = r * powDi(1. + t * (-t + y), 3); // = \chi^2_{alpha} of AS 64 + s = 4. * pp + r - 2.; // 4p + 2q - 2 = numerator of new t = (...) / chi^2 + debugPrintf("min(p,q) <= 1: t=%g", t); + if (t == 0 || (t < 0. && s >= t)) { // cannot use chisq approx + // x0 = 1 - { (1-a)*q*B(p,q) } ^{1/q} {AS 65} + // xinbta = 1. - Math.exp((Math.log(1-a)+ Math.log(qq) + logbeta) / qq); + double l1ma; /* + * := Math.log(1-a), directly from alpha (as 'la' above): FIXME: + * not worth it? log1p(-a) always the same ?? + */ + if (swap_tail) { + l1ma = DPQ.rdtlog(alpha, lower_tail, log_p); + } else { + l1ma = DPQ.rdtclog(alpha, lower_tail, log_p); + } + debugPrintf(" t <= 0 : log1p(-a)=%.15g, better l1ma=%.15g\n", RMath.log1p(-a), l1ma); + double xx = (l1ma + Math.log(qq) + logbeta) / qq; + if (xx <= 0.) { + xinbta = -RMath.expm1(xx); + u = DPQ.rlog1exp(xx); // = Math.log(xinbta) = Math.log(1 - + // Math.exp(...A...)) + } else { // xx > 0 ==> 1 - e^xx < 0 .. is nonsense + debugPrintf(" xx=%g > 0: xinbta:= 1-e^xx < 0\n", xx); + xinbta = 0; + u = Double.NEGATIVE_INFINITY; /// FIXME can do better? + } + } else { + t = s / t; + debugPrintf(" t > 0 or s < t < 0: new t = %g ( > 1 ?)\n", t); + if (t <= 1.) { // cannot use chisq, either + u = (la + Math.log(pp) + logbeta) / pp; + xinbta = Math.exp(u); + } else { // (1+x0)/(1-x0) = t, solved for x0 : + xinbta = 1. - 2. / (t + 1.); + u = RMath.log1p(-2. / (t + 1.)); + } + } + } + + // Problem: If initial u is completely wrong, we make a wrong decision here + if (swap_choose && + ((swap_tail && u >= -Math.exp(log_q_cut)) || // ==> "swap back" + (!swap_tail && u >= -Math.exp(4 * log_q_cut) && pp / qq < 1000.))) { // ==> + // "swap + // now" + // (much + // less + // easily) + // "revert swap" -- and use_log_x + swap_tail = !swap_tail; + debugPrintf(" u = %g (e^u = xinbta = %.16g) ==> ", u, xinbta); + if (swap_tail) { + a = DPQ.rdtciv(alpha, lower_tail, log_p); // needed ? + la = DPQ.rdtclog(alpha, lower_tail, log_p); + pp = q; + qq = p; + } else { + a = p_; + la = DPQ.rdtlog(alpha, lower_tail, log_p); + pp = p; + qq = q; + } + debugPrintf("\"%s\"; la = %g\n", + (swap_tail ? "swap now" : "swap back"), la); + // we could redo computations above, but this should be stable + u = DPQ.rlog1exp(u); + xinbta = Math.exp(u); + + /* + * Careful: "swap now" should not fail if 1) the above initial xinbta is + * "completely wrong" 2) The correction step can go outside (u_n > 0 ==> e^u > 1 is + * illegal) e.g., for qbeta(0.2066, 0.143891, 0.05) + */ + } + + if (!use_log_x) { + use_log_x = (u < log_q_cut); // (per default) <==> xinbta = e^u < 4.54e-5 + } + bad_u = !Double.isFinite(u); + bad_init = bad_u || xinbta > p_hi; + + debugPrintf(" -> u = %g, e^u = xinbta = %.16g, (Newton acu=%g%s)\n", + u, xinbta, acu, + (bad_u ? ", ** bad u **" : (use_log_x ? ", on u = Math.log(x) scale" : ""))); + + u_n = 1.; + tx = xinbta; // keeping "original initial x" (for now) + + if (bad_u || u < log_q_cut) { /* + * e.g. qbeta(0.21, .001, 0.05) try "left border" quickly, + * i.e., try at smallest positive number: + */ + w = pbetaRaw(DBL_very_MIN, pp, qq, true, log_p); + if (w > (log_p ? la : a)) { + debugPrintf(" quantile is left of smallest positive number; \"convergence\"\n"); + if (log_p || Math.abs(w - a) < Math.abs(0 - a)) { // DBL_very_MIN is better than + // 0 + tx = DBL_very_MIN; + u_n = DBL_log_v_MIN; // = Math.log(DBL_very_MIN) + } else { + tx = 0.; + u_n = Double.NEGATIVE_INFINITY; + } + use_log_x = log_p; + add_N_step = false; + finalStep(log_p, qb); + return; + } else { + debugPrintf(" pbeta(smallest pos.) = %g <= %g --> continuing\n", + w, (log_p ? la : a)); + if (u < DBL_log_v_MIN) { + u = DBL_log_v_MIN; // = Math.log(DBL_very_MIN) + xinbta = DBL_very_MIN; + } + } + } + + /* Sometimes the approximation is negative (and == 0 is also not "ok") */ + if (bad_init && !(use_log_x && tx > 0)) { + if (u == Double.NEGATIVE_INFINITY) { + debugPrintf(" u = -Inf;"); + u = M_LN2 * DBL_MIN_EXP; + xinbta = Double.MIN_VALUE; + } else { + debugPrintf(" bad_init: u=%g, xinbta=%g;", u, xinbta); + xinbta = (xinbta > 1.1) // i.e. "way off" + ? 0.5 // otherwise, keep the respective boundary: + : ((xinbta < p_lo) ? Math.exp(u) : p_hi); + if (bad_u) { + u = Math.log(xinbta); + } + // otherwise: not changing "potentially better" u than the above + } + debugPrintf(" -> (partly)new u=%g, xinbta=%g\n", u, xinbta); + } + + newton(n_N, log_p, qb); + // note: newton calls converged which calls finalStep + } + + private void newton(int n_N, boolean log_p, double[] qb) { + /* + * -------------------------------------------------------------------- + * + * Solve for x by a modified Newton-Raphson method, using pbeta_raw() + */ + r = 1 - pp; + t = 1 - qq; + double wprev = 0.; + double prev = 1.; + double adj = 1.; + + if (use_log_x) { // find Math.log(xinbta) -- work in u := Math.log(x) scale + // if (bad_init && tx > 0) { xinbta = tx; }// may have been better + for (int i_pb = 0; i_pb < 1000; i_pb++) { + // using log_p == true unconditionally here + // FIXME: if Math.exp(u) = xinbta underflows to 0, like different formula + // pbeta_Math.log(u, *) + y = pbetaRaw(xinbta, pp, qq, /* lower_tail = */ true, true); + + /* + * w := Newton step size for L(u) = log F(e^u) =!= 0; u := Math.log(x) = (L(.) - + * la) / L'(.); L'(u)= (F'(e^u) * e^u ) / F(e^u) = (L(.) - la)*F(.) / {F'(e^u) * + * e^u } = = (L(.) - la) * e^L(.) * e^{-log F'(e^u) - u} = ( y - la) * e^{ y - u + * -log F'(e^u)} and -log F'(x)= -log f(x) = + logbeta + (1-p) Math.log(x) + + * (1-q) Math.log(1-x) = logbeta + (1-p) u + (1-q) Math.log(1-e^u) + */ + w = (y == Double.NEGATIVE_INFINITY) // y = -Inf well possible: we are on + // log scale! + ? 0. : (y - la) * Math.exp(y - u + logbeta + r * u + t * DPQ.rlog1exp(u)); + if (!Double.isFinite(w)) { + break; + } + if (i_pb >= n_N && w * wprev <= 0.) { + prev = RMath.fmax2(Math.abs(adj), fpu); + } + debugPrintf("N(i=%2d): u=%#20.16g, pb(e^u)=%#12.6g, w=%#15.9g, %s prev=%11g,", + i_pb, u, y, w, (w * wprev <= 0.) ? "new" : "old", prev); + g = 1; + int i_inn; + for (i_inn = 0; i_inn < 1000; i_inn++) { + adj = g * w; + // take full Newton steps at the beginning; only then safe guard: + if (i_pb < n_N || Math.abs(adj) < prev) { + u_n = u - adj; // u_{n+1} = u_n - g*w + if (u_n <= 0.) { // <==> 0 < xinbta := e^u <= 1 + if (prev <= acu || Math.abs(w) <= acu) { + /* R_ifDEBUG_printf(" -adj=%g, %s <= acu ==> convergence\n", */ + /* -adj, (prev <= acu) ? "prev" : "|w|"); */ + debugPrintf(" it{in}=%d, -adj=%g, %s <= acu ==> convergence\n", + i_inn, -adj, (prev <= acu) ? "prev" : "|w|"); + converged(log_p, qb); + return; + } + // if (u_n != Double.NEGATIVE_INFINITY && u_n != 1) + break; + } + } + g /= 3; + } + // (cancellation in (u_n -u) => may differ from adj: + D = RMath.fmin2(Math.abs(adj), Math.abs(u_n - u)); + /* R_ifDEBUG_printf(" delta(u)=%g\n", u_n - u); */ + debugPrintf(" it{in}=%d, delta(u)=%9.3g, D/|.|=%.3g\n", + i_inn, u_n - u, D / Math.abs(u_n + u)); + if (D <= 4e-16 * Math.abs(u_n + u)) { + converged(log_p, qb); + return; + } + u = u_n; + xinbta = Math.exp(u); + wprev = w; + } // for(i ) + + } else { + for (int i_pb = 0; i_pb < 1000; i_pb++) { + y = pbetaRaw(xinbta, pp, qq, /* lower_tail = */ true, log_p); + // delta{y} : d_y = y - (log_p ? la : a); + + if (!Double.isFinite(y) && !(log_p && y == Double.NEGATIVE_INFINITY)) { // y = + // -Inf + // is ok if + // (log_p) + RMath.mlError(MLError.DOMAIN, ""); + qb[0] = qb[1] = ML_NAN; + return; + } + + /* + * w := Newton step size (F(.) - a) / F'(.) or, -- log: (lF - la) / (F' / F) = + * Math.exp(lF) * (lF - la) / F' + */ + w = log_p + ? (y - la) * Math.exp(y + logbeta + r * Math.log(xinbta) + t * Math.log1p(-xinbta)) + : (y - a) * Math.exp(logbeta + r * Math.log(xinbta) + t * Math.log1p(-xinbta)); + if (i_pb >= n_N && w * wprev <= 0.) + prev = RMath.fmax2(Math.abs(adj), fpu); + debugPrintf("N(i=%2d): x0=%#17.15g, pb(x0)=%#17.15g, w=%#17.15g, %s prev=%g,", + i_pb, xinbta, y, w, (w * wprev <= 0.) ? "new" : "old", prev); + g = 1; + int i_inn; + for (i_inn = 0; i_inn < 1000; i_inn++) { + adj = g * w; + // take full Newton steps at the beginning; only then safe guard: + if (i_pb < n_N || Math.abs(adj) < prev) { + tx = xinbta - adj; // x_{n+1} = x_n - g*w + if (0. <= tx && tx <= 1.) { + if (prev <= acu || Math.abs(w) <= acu) { + debugPrintf(" it{in}=%d, delta(x)=%g, %s <= acu ==> convergence\n", + i_inn, -adj, (prev <= acu) ? "prev" : "|w|"); + converged(log_p, qb); + return; + } + if (tx != 0. && tx != 1) { + break; + } + } + } + g /= 3; + } + debugPrintf(" it{in}=%d, delta(x)=%g\n", i_inn, tx - xinbta); + if (Math.abs(tx - xinbta) <= 4e-16 * (tx + xinbta)) { // "<=" : (.) == 0 + converged(log_p, qb); + return; + } + xinbta = tx; + if (tx == 0) { // "we have lost" + break; + } + wprev = w; + } + } + + /*-- NOT converged: Iteration count --*/ + warned = true; + RMath.mlError(MLError.PRECISION, "qbeta"); + + converged(log_p, qb); + } + + private void converged(boolean log_p, double[] qb) { + log_ = log_p || use_log_x; // only for printing + debugPrintf(" %s: Final delta(y) = %g%s\n", + warned ? "_NO_ convergence" : "converged", + y - (log_ ? la : a), (log_ ? " (log_)" : "")); + if ((log_ && y == Double.NEGATIVE_INFINITY) || (!log_ && y == 0)) { + // stuck at left, try if smallest positive number is "better" + w = pbetaRaw(DBL_very_MIN, pp, qq, true, log_); + if (log_ || Math.abs(w - a) <= Math.abs(y - a)) { + tx = DBL_very_MIN; + u_n = DBL_log_v_MIN; // = Math.log(DBL_very_MIN) + } + add_N_step = false; // not trying to do better anymore + } else if (!warned && (log_ ? Math.abs(y - la) > 3 : Math.abs(y - a) > 1e-4)) { + if (!(log_ && y == Double.NEGATIVE_INFINITY && + // e.g. qbeta(-1e-10, .2, .03, log=true) cannot get accurate ==> do + // NOT + // warn + pbetaRaw(DBL_1__eps, // = 1 - eps + pp, qq, true, true) > la + 2)) { + RMath.mlWarning(Message.QBETA_ACURACY_WARNING, (log_ ? ", log_" : ""), Math.abs(y - (log_ ? la : a))); + } + } + + finalStep(log_p, qb); + } + + /** + * Represents a block of code that is labelled "L_return" in the original source, should be + * followed by a return. + */ + private void finalStep(boolean log_p, double[] qb) { + if (give_log_q) { // ==> use_log_x , too + if (!use_log_x) { // (see if claim above is true) + RMath.mlWarning(Message.GENERIC, + "qbeta() L_return, u_n=%g; give_log_q=true but use_log_x=false -- please report!", + u_n); + } + + double rr = DPQ.rlog1exp(u_n); + swapTail(qb, swap_tail, u_n, rr); + } else { + if (use_log_x) { + if (add_N_step) { + /* + * add one last Newton step on original x scale, e.g., for qbeta(2^-98, + * 0.125, 2^-96) + */ + double tmpXinbta = Math.exp(u_n); + y = pbetaRaw(tmpXinbta, pp, qq, /* lower_tail = */ true, log_p); + w = log_p + ? (y - la) * Math.exp(y + logbeta + r * Math.log(tmpXinbta) + t * RMath.log1p(-tmpXinbta)) + : (y - a) * Math.exp(logbeta + r * Math.log(tmpXinbta) + t * RMath.log1p(-tmpXinbta)); + tx = tmpXinbta - w; + debugPrintf( + "Final Newton correction(non-log scale): xinbta=%.16g, y=%g, w=%g. => new tx=%.16g\n", + tmpXinbta, y, w, tx); + } else { + swapTail(qb, swap_tail, Math.exp(u_n), -RMath.expm1(u_n)); + return; + } + } + swapTail(qb, swap_tail, tx, 1 - tx); + } + } + + private static void swapTail(double[] qb, boolean swap_tail, double val0, double val1) { + if (swap_tail) { + qb[0] = val1; + qb[1] = val0; + } else { + qb[0] = val0; + qb[1] = val1; + } + } + + private static void returnQ0(double[] qb, boolean give_log_q) { + qb[0] = DPQ.rd0(give_log_q); + qb[1] = DPQ.rd1(give_log_q); + } + + private static void returnQ1(double[] qb, boolean give_log_q) { + qb[0] = DPQ.rd1(give_log_q); + qb[1] = DPQ.rd0(give_log_q); + } + + private static void returnQHalf(double[] qb, boolean give_log_q) { + qb[0] = DPQ.rdhalf(give_log_q); + qb[1] = DPQ.rdhalf(give_log_q); + } + } +} diff --git a/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/QHyper.java b/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/QHyper.java index 9a54383f82decd95101bb995de5f6fe776e444f4..e0641de73b8281b181aae6490a781256c1a96b47 100644 --- a/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/QHyper.java +++ b/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/QHyper.java @@ -12,9 +12,9 @@ package com.oracle.truffle.r.library.stats; import static com.oracle.truffle.r.library.stats.MathConstants.DBL_EPSILON; -import static com.oracle.truffle.r.library.stats.MathConstants.forceint; import static com.oracle.truffle.r.library.stats.RMath.fmax2; import static com.oracle.truffle.r.library.stats.RMath.fmin2; +import static com.oracle.truffle.r.library.stats.RMath.forceint; import static com.oracle.truffle.r.library.stats.RMath.lfastchoose; import com.oracle.truffle.r.library.stats.DPQ.EarlyReturn; 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 new file mode 100644 index 0000000000000000000000000000000000000000..9803bad38d700b70793e0902bf7337a0729aa209 --- /dev/null +++ b/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/QPois.java @@ -0,0 +1,129 @@ +/* + * 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-2014, The R Core Team + * Copyright (c) 2016, Oracle and/or its affiliates + * + * All rights reserved. + */ +package com.oracle.truffle.r.library.stats; + +import static com.oracle.truffle.r.library.stats.MathConstants.DBL_EPSILON; + +import com.oracle.truffle.r.library.stats.DPQ.EarlyReturn; +import com.oracle.truffle.r.library.stats.StatsFunctions.Function2_2; + +public class QPois implements Function2_2 { + private final Qnorm qnorm = new Qnorm(); + private final PPois ppois = new PPois(); + + @Override + public double evaluate(double p, double lambda, boolean lowerTail, boolean logP) { + if (Double.isNaN(p) || Double.isNaN(lambda)) { + return p + lambda; + } + if (!Double.isFinite(lambda)) { + return RMath.mlError(); + } + if (lambda < 0) { + return RMath.mlError(); + } + if (lambda == 0) { + return 0; + } + + try { + DPQ.rqp01boundaries(p, 0, Double.POSITIVE_INFINITY, lowerTail, logP); + } catch (EarlyReturn e) { + 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; + + /* + * Note : "same" code in qpois.c, qbinom.c, qnbinom.c -- FIXME: This is far from optimal + * [cancellation for p ~= 1, etc]: + */ + if (!lowerTail || logP) { + p = DPQ.rdtqiv(p, lowerTail, logP); /* need check again (cancellation!): */ + if (p == 0.) { + return 0; + } + if (p == 1.) { + return Double.POSITIVE_INFINITY; + } + } + /* temporary hack --- FIXME --- */ + if (p + 1.01 * DBL_EPSILON >= 1.) { + return Double.POSITIVE_INFINITY; + } + + /* y := approx.value (Cornish-Fisher expansion) : */ + double z = qnorm.evaluate(p, 0., 1., /* lower_tail */true, /* log_p */false); + // #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); + + /* 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 */ + if (lambda < 1e5) { + return search(y, z, p, lambda, 1).y; + } 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 = zIn; + 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; + } + } +} diff --git a/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/Qf.java b/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/Qf.java new file mode 100644 index 0000000000000000000000000000000000000000..18488ebd3a267a99aeab1e5b8e81f2bcfd9063b5 --- /dev/null +++ b/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/Qf.java @@ -0,0 +1,60 @@ +/* + * 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--2015, The R Core Team + * Copyright (c) 2005, The R Foundation + * Copyright (c) 2016, Oracle and/or its affiliates + * + * All rights reserved. + */ +package com.oracle.truffle.r.library.stats; + +import com.oracle.truffle.r.library.stats.Chisq.QChisq; +import com.oracle.truffle.r.library.stats.DPQ.EarlyReturn; +import com.oracle.truffle.r.library.stats.StatsFunctions.Function3_2; + +public final class Qf implements Function3_2 { + private final QBeta qbeta = new QBeta(); + private final QChisq qchisq = new QChisq(); + + @Override + public double evaluate(double p, double df1, double df2, boolean lowerTail, boolean logP) { + + if (Double.isNaN(p) || Double.isNaN(df1) || Double.isNaN(df2)) { + return p + df1 + df2; + } + + if (df1 <= 0. || df2 <= 0.) { + return RMath.mlError(); + } + + try { + DPQ.rqp01boundaries(p, 0, Double.POSITIVE_INFINITY, lowerTail, logP); + } catch (EarlyReturn e) { + return e.result; + } + + /* + * fudge the extreme DF cases -- qbeta doesn't do this well. But we still need to fudge the + * infinite ones. + */ + + if (df1 <= df2 && df2 > 4e5) { + if (!Double.isFinite(df1)) { /* df1 == df2 == Inf : */ + return 1.; + } else { + return qchisq.evaluate(p, df1, lowerTail, logP) / df1; + } + } + if (df1 > 4e5) { /* and so df2 < df1 */ + return df2 / qchisq.evaluate(p, df2, !lowerTail, logP); + } + + // FIXME: (1/qb - 1) = (1 - qb)/qb; if we know qb ~= 1, should use other tail + p = (1. / qbeta.evaluate(p, df2 / 2, df1 / 2, !lowerTail, logP) - 1.) * (df2 / df1); + return RMath.mlValid(p) ? p : Double.NaN; + } +} diff --git a/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/Qt.java b/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/Qt.java new file mode 100644 index 0000000000000000000000000000000000000000..34877af66f383ec492baf37c72669d231e473044 --- /dev/null +++ b/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/Qt.java @@ -0,0 +1,216 @@ +/* + * 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-2013, The R Core Team + * Copyright (c) 2003-2013, The R Foundation + * Copyright (c) 2016, Oracle and/or its affiliates + * + * All rights reserved. + */ +package com.oracle.truffle.r.library.stats; + +import static com.oracle.truffle.r.library.stats.MathConstants.DBL_EPSILON; +import static com.oracle.truffle.r.library.stats.MathConstants.DBL_MANT_DIG; +import static com.oracle.truffle.r.library.stats.MathConstants.M_1_PI; +import static com.oracle.truffle.r.library.stats.MathConstants.M_LN2; +import static com.oracle.truffle.r.library.stats.MathConstants.M_PI; +import static com.oracle.truffle.r.library.stats.MathConstants.M_PI_2; +import static com.oracle.truffle.r.library.stats.MathConstants.M_SQRT2; + +import com.oracle.truffle.r.library.stats.DPQ.EarlyReturn; +import com.oracle.truffle.r.library.stats.StatsFunctions.Function2_2; + +public class Qt implements Function2_2 { + private static final double eps = 1.e-12; + private static final double accu = 1e-13; + private static final double Eps = 1e-11; /* must be > accu */ + + private final Qnorm qnorm = new Qnorm(); + private final Dt dt = new Dt(); + private final Pt pt = new Pt(); + + @Override + public double evaluate(double p, double ndf, boolean lowerTail, boolean logP) { + + if (Double.isNaN(p) || Double.isNaN(ndf)) { + return p + ndf; + } + + try { + DPQ.rqp01boundaries(p, Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY, lowerTail, logP); + } catch (EarlyReturn earlyReturn) { + return earlyReturn.result; + } + + if (ndf <= 0) { + return RMath.mlError(); + } + + if (ndf < 1) { /* based on qnt */ + + int iter = 0; + + p = DPQ.rdtqiv(p, lowerTail, logP); + + /* + * Invert pt(.) : 1. finding an upper and lower bound + */ + if (p > 1 - DBL_EPSILON) { + return Double.POSITIVE_INFINITY; + } + double pp = RMath.fmin2(1 - DBL_EPSILON, p * (1 + Eps)); + double ux; + double lx; + ux = 1.; + while (ux < Double.MAX_VALUE && pt.evaluate(ux, ndf, true, false) < pp) { + ux *= 2; + } + pp = p * (1 - Eps); + lx = -1.; + while (lx > -Double.MAX_VALUE && pt.evaluate(lx, ndf, true, false) > pp) { + lx *= 2; + } + + /* + * 2. interval (lx,ux) halving regula falsi failed on qt(0.1, 0.1) + */ + double nx; + do { + nx = 0.5 * (lx + ux); + if (pt.evaluate(nx, ndf, true, false) > p) { + ux = nx; + } else { + lx = nx; + } + } while ((ux - lx) / Math.abs(nx) > accu && ++iter < 1000); + + if (iter >= 1000) { + return RMath.mlError(); + } + + return 0.5 * (lx + ux); + } + + if (ndf > 1e20) { + return qnorm.evaluate(p, 0., 1., lowerTail, logP); + } + + double capP = DPQ.rdqiv(p, logP); /* if Math.exp(p) underflows, we fix below */ + + boolean neg = (!lowerTail || capP < 0.5) && (lowerTail || capP > 0.5); + boolean isNegLower = (lowerTail == neg); /* both true or false == !xor */ + if (neg) { + capP = 2 * (logP ? (lowerTail ? capP : -RMath.expm1(p)) : DPQ.rdlval(p, lowerTail)); + } else { + capP = 2 * (logP ? (lowerTail ? -RMath.expm1(p) : capP) : DPQ.rdcval(p, lowerTail)); + } + /* 0 <= P <= 1 ; P = 2*min(P', 1 - P') in all cases */ + + double q; + if (Math.abs(ndf - 2) < eps) { /* df ~= 2 */ + if (capP > Double.MIN_VALUE) { + if (3 * capP < DBL_EPSILON) { /* P ~= 0 */ + q = 1 / Math.sqrt(capP); + } else if (capP > 0.9) { /* P ~= 1 */ + q = (1 - capP) * Math.sqrt(2 / (capP * (2 - capP))); + } else { /* eps/3 <= P <= 0.9 */ + q = Math.sqrt(2 / (capP * (2 - capP)) - 2); + } + } else { /* P << 1, q = 1/Math.sqrt(P) = ... */ + if (logP) { + q = isNegLower ? Math.exp(-p / 2) / M_SQRT2 : 1 / Math.sqrt(-RMath.expm1(p)); + } else { + q = Double.POSITIVE_INFINITY; + } + } + } else if (ndf < 1 + eps) { /* df ~= 1 (df < 1 excluded above): Cauchy */ + if (capP == 1.) { + q = 0; + } else if (capP > 0) { + // some versions of tanpi give Inf, some NaN + q = 1 / RMath.tanpi(capP / 2.); /* == - tan((P+1) * M_PI_2) -- suffers for P ~= 0 */ + } else { /* P = 0, but maybe = 2*Math.exp(p) ! */ + if (logP) { /* 1/tan(e) ~ 1/e */ + q = isNegLower ? M_1_PI * Math.exp(-p) : -1. / (M_PI * RMath.expm1(p)); + } else { + q = Double.POSITIVE_INFINITY; + } + } + } else { /*-- usual case; including, e.g., df = 1.1 */ + double x = 0.; + double y = 0; + double logP2 = 0.; + double a = 1 / (ndf - 0.5); + double b = 48 / (a * a); + double c = ((20700 * a / b - 98) * a - 16) * a + 96.36; + double d = ((94.5 / (b + c) - 3) / b + 1) * Math.sqrt(a * M_PI_2) * ndf; + + boolean pOk1 = capP > Double.MIN_VALUE || !logP; + boolean pOk = pOk1; + if (pOk1) { + y = Math.pow(d * capP, 2.0 / ndf); + pOk = (y >= DBL_EPSILON); + } + if (!pOk) { // log.p && P very.small || (d*P)^(2/df) =: y < eps_c + logP2 = isNegLower ? DPQ.rdlog(p, logP) : DPQ.rdlexp(p, logP); /* + * == Math.log(P / 2) + */ + x = (Math.log(d) + M_LN2 + logP2) / ndf; + y = Math.exp(2 * x); + } + + if ((ndf < 2.1 && capP > 0.5) || y > 0.05 + a) { /* P > P0(df) */ + /* Asymptotic inverse expansion about normal */ + if (pOk) { + x = qnorm.evaluate(0.5 * capP, 0., 1., /* lower_tail */true, /* log_p */false); + } else { /* log_p && P underflowed */ + x = qnorm.evaluate(logP2, 0., 1., lowerTail, /* log_p */ true); + } + + y = x * x; + if (ndf < 5) { + c += 0.3 * (ndf - 4.5) * (x + 0.6); + } + c = (((0.05 * d * x - 5) * x - 7) * x - 2) * x + b + c; + y = (((((0.4 * y + 6.3) * y + 36) * y + 94.5) / c - y - 3) / b + 1) * x; + y = RMath.expm1(a * y * y); + q = Math.sqrt(ndf * y); + } else if (!pOk && x < -M_LN2 * DBL_MANT_DIG) { /* 0.5* Math.log(DBL_EPSILON) */ + /* y above might have underflown */ + q = Math.sqrt(ndf) * Math.exp(-x); + } else { /* re-use 'y' from above */ + y = ((1 / (((ndf + 6) / (ndf * y) - 0.089 * d - 0.822) * (ndf + 2) * 3) + 0.5 / (ndf + 4)) * y - 1) * (ndf + 1) / (ndf + 2) + 1 / y; + q = Math.sqrt(ndf * y); + } + + /* + * Now apply 2-term Taylor expansion improvement (1-term = Newton): as by Hill (1981) + * [ref.above] + */ + + /* + * FIXME: This can be far from optimal when log_p = true but is still needed, e.g. for + * qt(-2, df=1.01, log=true). Probably also improvable when lower_tail = false + */ + + if (pOk1) { + int it = 0; + while (it++ < 10 && (y = dt.evaluate(q, ndf, false)) > 0 && + Double.isFinite(x = (pt.evaluate(q, ndf, false, false) - capP / 2) / y) && + Math.abs(x) > 1e-14 * Math.abs(q)) { + /* + * Newton (=Taylor 1 term): q += x; Taylor 2-term : + */ + q += x * (1. + x * q * (ndf + 1) / (2 * (q * q + ndf))); + } + } + } + if (neg) { + q = -q; + } + return q; + } +} diff --git a/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/RChisq.java b/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/RChisq.java deleted file mode 100644 index 975819f6bf3be065b8036f7c4c4aeb2b512db474..0000000000000000000000000000000000000000 --- a/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/RChisq.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * 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) 1998--2008, The R Core Team - * Copyright (c) 2016, 2016, Oracle and/or its affiliates - * - * All rights reserved. - */ -package com.oracle.truffle.r.library.stats; - -import com.oracle.truffle.r.library.stats.RandGenerationFunctions.RandFunction1_Double; -import com.oracle.truffle.r.library.stats.RandGenerationFunctions.RandomNumberProvider; - -public final class RChisq extends RandFunction1_Double { - public static double rchisq(double df, RandomNumberProvider rand) { - if (!Double.isFinite(df) || df < 0.0) { - return RMath.mlError(); - } - return new RGamma().execute(df / 2.0, 2.0, rand); - } - - @Override - public double execute(double a, RandomNumberProvider rand) { - return rchisq(a, rand); - } -} diff --git a/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/RHyper.java b/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/RHyper.java index 4cd77bcd0f57d21cd29bf67ae35f76dffd84e88a..197316d6df83b9e9bd01f6287742e33a742ad5cd 100644 --- a/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/RHyper.java +++ b/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/RHyper.java @@ -13,7 +13,7 @@ package com.oracle.truffle.r.library.stats; import static com.oracle.truffle.r.library.stats.MathConstants.M_LN_SQRT_2PI; -import static com.oracle.truffle.r.library.stats.MathConstants.forceint; +import static com.oracle.truffle.r.library.stats.RMath.forceint; import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary; import com.oracle.truffle.r.library.stats.RandGenerationFunctions.RandFunction3_Double; diff --git a/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/RLogis.java b/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/RLogis.java deleted file mode 100644 index f21be8e24cffbacfc8038804da8c2027be0cbf4a..0000000000000000000000000000000000000000 --- a/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/RLogis.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * 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) 1998--2008, The R Core Team - * Copyright (c) 2016, 2016, Oracle and/or its affiliates - * - * All rights reserved. - */ -package com.oracle.truffle.r.library.stats; - -import com.oracle.truffle.r.library.stats.RandGenerationFunctions.RandFunction2_Double; -import com.oracle.truffle.r.library.stats.RandGenerationFunctions.RandomNumberProvider; - -public final class RLogis extends RandFunction2_Double { - @Override - public double execute(double location, double scale, RandomNumberProvider rand) { - if (Double.isNaN(location) || !Double.isFinite(scale)) { - return RMath.mlError(); - } - - if (scale == 0. || !Double.isFinite(location)) { - return location; - } else { - double u = rand.unifRand(); - return location + scale * Math.log(u / (1. - u)); - } - } -} 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 02c61643311c94b45c6edeba1b1555115af402b4..644dff67b50c3d46d7608bb10c5401f973a6d665 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 @@ -16,6 +16,7 @@ import static com.oracle.truffle.r.library.stats.LBeta.lbeta; import com.oracle.truffle.api.CompilerDirectives.CompilationFinal; import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary; +import com.oracle.truffle.r.runtime.RError; import com.oracle.truffle.r.runtime.RRuntime; /** @@ -26,17 +27,52 @@ import com.oracle.truffle.r.runtime.RRuntime; */ public class RMath { + public enum MLError { + DOMAIN, + RANGE, + NOCONV, + PRECISION, + UNDERFLOW + } + /** - * corresponds to macro {@code ML_ERR_return_NAN} in GnuR. + * Corresponds to macro {@code ML_ERR_return_NAN} in GnuR. */ public static double mlError() { + return mlError(MLError.DOMAIN, ""); + } + + /** + * Corresponds to macro {@code ML_ERR} in GnuR. TODO: raise corresponding warning + */ + public static double mlError(@SuppressWarnings("unused") MLError error, @SuppressWarnings("unused") String message) { return Double.NaN; } + public static void mlWarning(RError.Message message, Object... args) { + RError.warning(null, message, args); + } + + public static boolean mlValid(double d) { + return !Double.isNaN(d); + } + public static double lfastchoose(double n, double k) { return -Math.log(n + 1.) - lbeta(n - k + 1., k + 1.); } + /** + * Implementation of {@code R_forceint}, 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 forceint(double x) { + // Note: in GnuR this is alias for nearbyint + if (Double.isNaN(x)) { + return 0; + } + return Math.floor(x + 0.5); + } + public static double fsign(double x, double y) { if (Double.isNaN(x) || Double.isNaN(y)) { return x + y; @@ -44,7 +80,7 @@ public class RMath { return ((y >= 0) ? TOMS708.fabs(x) : -TOMS708.fabs(x)); } - public static double fmod(double a, double b) { + private static double fmod(double a, double b) { double q = a / b; if (b != 0) { double tmp = a - Math.floor(q) * b; diff --git a/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/RNchisq.java b/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/RNchisq.java index 3b17100cc5cad25ce2b30d84993069af020931fc..12dc037c2c18aae629e67fe502c97dfe86cb35e3 100644 --- a/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/RNchisq.java +++ b/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/RNchisq.java @@ -30,7 +30,7 @@ public final class RNchisq extends RandFunction2_Double { } else { double r = RPois.rpois(lambda / 2., rand); if (r > 0.) { - r = RChisq.rchisq(2. * r, rand); + r = Chisq.RChisq.rchisq(2. * r, rand); } if (df > 0.) { r += rgamma.execute(df / 2., 2., rand); diff --git a/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/Rbinom.java b/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/Rbinom.java index edd2864e79a007ee03e027004f64e8298c44f509..37964392e6762bbac3cebd294e474e15b73c57cc 100644 --- a/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/Rbinom.java +++ b/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/Rbinom.java @@ -30,7 +30,7 @@ public final class Rbinom extends RandFunction2_Double { if (!Double.isFinite(nin)) { return RRuntime.INT_NA; } - double r = MathConstants.forceint(nin); + double r = RMath.forceint(nin); if (r != nin) { return RRuntime.INT_NA; } diff --git a/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/Rf.java b/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/Rf.java index c753f1777fe6e31adb429f4ae2779b1d951bea3c..be70cde936be8c393b14a9743bdce13d68366585 100644 --- a/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/Rf.java +++ b/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/Rf.java @@ -23,8 +23,8 @@ public final class Rf extends RandFunction2_Double { double v1; double v2; - v1 = Double.isFinite(n1) ? (RChisq.rchisq(n1, rand) / n1) : 1; - v2 = Double.isFinite(n2) ? (RChisq.rchisq(n2, rand) / n2) : 1; + v1 = Double.isFinite(n1) ? (Chisq.RChisq.rchisq(n1, rand) / n1) : 1; + v2 = Double.isFinite(n2) ? (Chisq.RChisq.rchisq(n2, rand) / n2) : 1; return v1 / v2; } } diff --git a/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/Rt.java b/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/Rt.java index 80c8ea59fc6e6b06560ceac696d508d192bb1d59..a319beed65cf78521fccb36b2b81070fbce797e3 100644 --- a/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/Rt.java +++ b/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/Rt.java @@ -11,7 +11,7 @@ */ package com.oracle.truffle.r.library.stats; -import static com.oracle.truffle.r.library.stats.RChisq.rchisq; +import static com.oracle.truffle.r.library.stats.Chisq.RChisq.rchisq; import com.oracle.truffle.r.library.stats.RandGenerationFunctions.RandFunction1_Double; import com.oracle.truffle.r.library.stats.RandGenerationFunctions.RandomNumberProvider; diff --git a/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/Runif.java b/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/Runif.java deleted file mode 100644 index d5729f4a3bd45aa8ad117e0f5ed3a2d3ef066886..0000000000000000000000000000000000000000 --- a/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/Runif.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.oracle.truffle.r.library.stats; - -import com.oracle.truffle.api.profiles.BranchProfile; -import com.oracle.truffle.api.profiles.ConditionProfile; -import com.oracle.truffle.api.profiles.ValueProfile; -import com.oracle.truffle.r.library.stats.RandGenerationFunctions.RandFunction2_Double; -import com.oracle.truffle.r.library.stats.RandGenerationFunctions.RandomNumberProvider; -import com.oracle.truffle.r.runtime.RRuntime; - -public final class Runif extends RandFunction2_Double { - private final BranchProfile errorProfile = BranchProfile.create(); - private final ConditionProfile minEqualsMaxProfile = ConditionProfile.createBinaryProfile(); - private final ValueProfile minValueProfile = ValueProfile.createEqualityProfile(); - private final ValueProfile maxValueProfile = ValueProfile.createEqualityProfile(); - - @Override - public double execute(double minIn, double maxIn, RandomNumberProvider rand) { - double min = minValueProfile.profile(minIn); - double max = maxValueProfile.profile(maxIn); - if (!RRuntime.isFinite(min) || !RRuntime.isFinite(max) || max < min) { - errorProfile.enter(); - return RMath.mlError(); - } - if (minEqualsMaxProfile.profile(min == max)) { - return min; - } - return min + rand.unifRand() * (max - min); - } -} diff --git a/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/Signrank.java b/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/Signrank.java index 9a976a351a50fa1ce7b5e8c1a92374859afa329a..f13e125ea9afa203be520a6b20d3622e74612d13 100644 --- a/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/Signrank.java +++ b/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/Signrank.java @@ -11,7 +11,7 @@ package com.oracle.truffle.r.library.stats; -import static com.oracle.truffle.r.library.stats.MathConstants.forceint; +import static com.oracle.truffle.r.library.stats.RMath.forceint; import com.oracle.truffle.r.library.stats.RandGenerationFunctions.RandFunction1_Double; import com.oracle.truffle.r.library.stats.RandGenerationFunctions.RandomNumberProvider; diff --git a/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/TOMS708.java b/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/TOMS708.java index 65056493bd7f7358f33beff9b9ef16afa8141c67..b9f92d9cb1fc14b314a0f88d0a71f6468d94292b 100644 --- a/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/TOMS708.java +++ b/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/TOMS708.java @@ -40,7 +40,7 @@ public class TOMS708 { // R_Log1_Exp public static double log1Exp(double x) { - return ((x) > -M_LN2 ? log(-rexpm1(x)) : log1p(-exp(x))); + return ((x) > -M_LN2 ? log(-rexpm1(x)) : RMath.log1p(-exp(x))); } private static double sin(double v) { @@ -59,10 +59,6 @@ public class TOMS708 { return Math.sqrt(v); } - private static double log1p(double v) { - return Math.log1p(v); - } - private static double exp(double v) { return Math.exp(v); } @@ -357,7 +353,7 @@ public class TOMS708 { w1 = Double.NEGATIVE_INFINITY; // = 0 on log-scale } bgrat.w = w1; - bgrat.bgrat(b0, a0, y0, x0, 15 * eps, false); + bgrat.bgrat(b0, a0, y0, x0, 15 * eps, true); w1 = bgrat.w; if (bgrat.ierr != 0) { ierr = 8; @@ -594,7 +590,7 @@ public class TOMS708 { // exp(a*lnx) underflows for large (a * lnx); e.g. large a ==> using log_r := log(r): // r = r1 * exp(a * lnx) * exp(bm1 * 0.5 * lnx); // log(r)=log(b) + log1p(gam1(b)) + b * log(z) + (a * lnx) + (bm1 * 0.5 * lnx), - double logR = Math.log(b) + log1p(gam1(b)) + b * Math.log(z) + nu * lnx; + double logR = Math.log(b) + RMath.log1p(gam1(b)) + b * Math.log(z) + nu * lnx; // FIXME work with log_u = log(u) also when log_p=FALSE (??) // u is 'factored out' from the expansion {and multiplied back, at the end}: double logU = logR - (algdiv(b, a) + b * Math.log(nu)); // algdiv(b,a) = @@ -613,7 +609,7 @@ public class TOMS708 { double l = // := *w/u .. but with care: such that it also works when u underflows to 0: logW ? ((w == Double.NEGATIVE_INFINITY) ? 0. : Math.exp(w - logU)) : ((w == 0.) ? 0. : Math.exp(Math.log(w) - logU)); - debugPrintf(" bgrat(a=%f, b=%f, x=%f, *)\n -> u=%f, l='w/u'=%f, ", a, b, x, u, l); + debugPrintf(" bgrat(a=%f, b=%f, x=%f, *)\n -> u=%f, l='w/u'=%f, \n", a, b, x, u, l); double qR = gratR(b, z, logR, eps); // = q/r of former grat1(b,z, r, &p, &q) double v = 0.25 / (nu * nu); @@ -713,7 +709,7 @@ public class TOMS708 { } while (fabs(c) > tol); if (logP) { - ans += log1p(a * s); + ans += RMath.log1p(a * s); } else { ans *= a * s + 1.0; } @@ -831,7 +827,7 @@ public class TOMS708 { if (logP) { /* FIXME? potential for improving log(t) */ - ans = z + log(a0 / a) + log1p(gam1(b0)) - log(t); + ans = z + log(a0 / a) + RMath.log1p(gam1(b0)) - log(t); } else { ans = exp(z) * (a0 / a) * (gam1(b0) + 1.0) / t; } @@ -871,14 +867,14 @@ public class TOMS708 { } while (n < 1e7 && fabs(w) > tol); if (fabs(w) > tol) { // the series did not converge (in time) // warn only when the result seems to matter: - if ((logP && !(a * sum > -1. && fabs(log1p(a * sum)) < eps * fabs(ans))) || (!logP && fabs(a * sum + 1) != 1.)) { + if ((logP && !(a * sum > -1. && fabs(RMath.log1p(a * sum)) < eps * fabs(ans))) || (!logP && fabs(a * sum + 1) != 1.)) { emitWarning(" bpser(a=%f, b=%f, x=%f,...) did not converge (n=1e7, |w|/tol=%f > 1; A=%f)", a, b, x, fabs(w) / tol, ans); } } debugPrintf(" -> n=%d iterations, |w|=%f %s %f=tol:=eps/a ==> a*sum=%f\n", (int) n, fabs(w), (fabs(w) > tol) ? ">!!>" : "<=", tol, a * sum); if (logP) { if (a * sum > -1.0) { - ans += log1p(a * sum); + ans += RMath.log1p(a * sum); } else { ans = ML_NEGINF; } @@ -1115,7 +1111,7 @@ public class TOMS708 { double c = (gam1(a) + 1.0) * (gam1(b) + 1.0) / z; /* FIXME? log(a0*c)= log(a0)+ log(c) and that is improvable */ - return (logP ? eZ + log(a0 * c) - log1p(a0 / b0) : eZ * (a0 * c) / (a0 / b0 + 1.0)); + return (logP ? eZ + log(a0 * c) - RMath.log1p(a0 / b0) : eZ * (a0 * c) / (a0 / b0 + 1.0)); } /* else : ALGORITHM FOR 1 < b0 < 8 */ @@ -1141,7 +1137,7 @@ public class TOMS708 { t = gam1(apb) + 1.0; } - return (logP ? log(a0) + z + log1p(gam1(b0)) - log(t) : a0 * exp(z) * (gam1(b0) + 1.0) / t); + return (logP ? log(a0) + z + RMath.log1p(gam1(b0)) - log(t) : a0 * exp(z) * (gam1(b0) + 1.0) / t); } else { /* ----------------------------------------------------------------------- */ @@ -1248,9 +1244,9 @@ public class TOMS708 { z = gam1(apb) + 1.0; } // L50: - double c = giveLog ? log1p(gam1(a)) + log1p(gam1(b)) - log(z) : (gam1(a) + 1.0) * (gam1(b) + 1.0) / z; + double c = giveLog ? RMath.log1p(gam1(a)) + RMath.log1p(gam1(b)) - log(z) : (gam1(a) + 1.0) * (gam1(b) + 1.0) / z; debugPrintf(" brcmp1(mu,a,b,*): a0 < 1, b0 <= 1; c=%.15f\n", c); - return giveLog ? ans + log(a0) + c - log1p(a0 / b0) : ans * (a0 * c) / (a0 / b0 + 1.0); + return giveLog ? ans + log(a0) + c - RMath.log1p(a0 / b0) : ans * (a0 * c) / (a0 / b0 + 1.0); } // else: algorithm for a0 < 1 < b0 < 8 // L60: @@ -1278,7 +1274,7 @@ public class TOMS708 { } debugPrintf(" brcmp1(mu,a,b,*): a0 < 1 < b0 < 8; t=%.15f\n", t); // L72: - return giveLog ? log(a0) + esum(mu, z, true) + log1p(gam1(b0)) - log(t) : a0 * esum(mu, z, false) * (gam1(b0) + 1.0) / t; + return giveLog ? log(a0) + esum(mu, z, true) + RMath.log1p(gam1(b0)) - log(t) : a0 * esum(mu, z, false) * (gam1(b0) + 1.0) / t; } else { @@ -1302,7 +1298,7 @@ public class TOMS708 { y0 = 1.0 / (h + 1.0); lambda = a - (a + b) * x; } - double lx0 = -log1p(b / a); // in both cases + double lx0 = -RMath.log1p(b / a); // in both cases debugPrintf(" brcmp1(mu,a,b,*): a,b >= 8; x0=%.15f, lx0=log(x0)=%.15f\n", x0, lx0); // L110: diff --git a/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/Unif.java b/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/Unif.java new file mode 100644 index 0000000000000000000000000000000000000000..3110d7e227f8d096abbb6f4c72433963c0602524 --- /dev/null +++ b/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/Unif.java @@ -0,0 +1,114 @@ +/* + * 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-2006, The R Core Team + * Copyright (c) 2013, 2016, Oracle and/or its affiliates + * + * All rights reserved. + */ +package com.oracle.truffle.r.library.stats; + +import com.oracle.truffle.api.profiles.BranchProfile; +import com.oracle.truffle.api.profiles.ConditionProfile; +import com.oracle.truffle.api.profiles.ValueProfile; +import com.oracle.truffle.r.library.stats.DPQ.EarlyReturn; +import com.oracle.truffle.r.library.stats.RandGenerationFunctions.RandFunction2_Double; +import com.oracle.truffle.r.library.stats.RandGenerationFunctions.RandomNumberProvider; +import com.oracle.truffle.r.library.stats.StatsFunctions.Function3_1; +import com.oracle.truffle.r.library.stats.StatsFunctions.Function3_2; +import com.oracle.truffle.r.runtime.RRuntime; + +public final class Unif { + private Unif() { + // only static members + } + + public static final class Runif extends RandFunction2_Double { + private final BranchProfile errorProfile = BranchProfile.create(); + private final ConditionProfile minEqualsMaxProfile = ConditionProfile.createBinaryProfile(); + private final ValueProfile minValueProfile = ValueProfile.createEqualityProfile(); + private final ValueProfile maxValueProfile = ValueProfile.createEqualityProfile(); + + @Override + public double execute(double minIn, double maxIn, RandomNumberProvider rand) { + double min = minValueProfile.profile(minIn); + double max = maxValueProfile.profile(maxIn); + if (!RRuntime.isFinite(min) || !RRuntime.isFinite(max) || max < min) { + errorProfile.enter(); + return RMath.mlError(); + } + if (minEqualsMaxProfile.profile(min == max)) { + return min; + } + return min + rand.unifRand() * (max - min); + } + } + + public static final class PUnif implements Function3_2 { + @Override + public double evaluate(double x, double min, double max, boolean lowerTail, boolean logP) { + if (Double.isNaN(x) || Double.isNaN(min) || Double.isNaN(max)) { + return x + min + max; + } + if (max < min || !Double.isFinite(min) || !Double.isFinite(max)) { + return RMath.mlError(); + } + if (x >= max) { + return DPQ.rdt1(lowerTail, logP); + } + if (x <= min) { + return DPQ.rdt0(lowerTail, logP); + } + if (lowerTail) { + return DPQ.rdval((x - min) / (max - min), logP); + } else { + return DPQ.rdval((max - x) / (max - min), logP); + } + } + } + + public static final class DUnif implements Function3_1 { + @Override + public double evaluate(double x, double min, double max, boolean giveLog) { + if (Double.isNaN(x) || Double.isNaN(min) || Double.isNaN(max)) { + return x + min + max; + } + if (max <= min) { + return RMath.mlError(); + } + if (min <= x && x <= max) { + return giveLog ? -Math.log(max - min) : 1. / (max - min); + } + return DPQ.rd0(giveLog); + } + } + + public static final class QUnif implements Function3_2 { + + @Override + public double evaluate(double p, double min, double max, boolean lowerTail, boolean logP) { + if (Double.isNaN(p) || Double.isNaN(min) || Double.isNaN(max)) { + return p + min + max; + } + + try { + DPQ.rqp01check(p, logP); + } catch (EarlyReturn e) { + return e.result; + } + + if (max < min || !Double.isFinite(min) || !Double.isFinite(max)) { + return RMath.mlError(); + } + + if (max == min) { + return min; + } + + return min + DPQ.rdtqiv(p, lowerTail, logP) * (max - min); + } + } +} diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/AsVector.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/AsVector.java index 92d043c445615d2a431604f7e0f7f12b965093ca..6f3c3bc9c082d8bd0b8362e9ead3982deed14382 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/AsVector.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/AsVector.java @@ -41,10 +41,11 @@ import com.oracle.truffle.r.nodes.builtin.CastBuilder; import com.oracle.truffle.r.nodes.builtin.RBuiltinNode; import com.oracle.truffle.r.nodes.builtin.base.AsVectorNodeGen.AsVectorInternalNodeGen; import com.oracle.truffle.r.nodes.builtin.base.AsVectorNodeGen.AsVectorInternalNodeGen.CastPairListNodeGen; +import com.oracle.truffle.r.nodes.function.CallMatcherNode; import com.oracle.truffle.r.nodes.function.ClassHierarchyNode; import com.oracle.truffle.r.nodes.function.ClassHierarchyNodeGen; import com.oracle.truffle.r.nodes.function.S3FunctionLookupNode; -import com.oracle.truffle.r.nodes.function.UseMethodInternalNode; +import com.oracle.truffle.r.nodes.function.S3FunctionLookupNode.Result; import com.oracle.truffle.r.nodes.unary.CastComplexNode; import com.oracle.truffle.r.nodes.unary.CastDoubleNode; import com.oracle.truffle.r.nodes.unary.CastExpressionNode; @@ -77,7 +78,9 @@ public abstract class AsVector extends RBuiltinNode { @Child private AsVectorInternal internal = AsVectorInternalNodeGen.create(); @Child private ClassHierarchyNode classHierarchy = ClassHierarchyNodeGen.create(false, false); - @Child private UseMethodInternalNode useMethod; + + @Child private S3FunctionLookupNode lookup; + @Child private CallMatcherNode callMatcher; private final ConditionProfile hasClassProfile = ConditionProfile.createBinaryProfile(); @@ -98,16 +101,19 @@ public abstract class AsVector extends RBuiltinNode { // However, removing it causes unit test failures RStringVector clazz = classHierarchy.execute(x); if (hasClassProfile.profile(clazz != null)) { - if (useMethod == null) { - // Note: this dispatch takes care of factor, because there is as.vector.factor - // specialization in R + // Note: this dispatch takes care of factor, because there is as.vector.factor + // specialization in R + if (lookup == null) { CompilerDirectives.transferToInterpreterAndInvalidate(); - useMethod = insert(new UseMethodInternalNode("as.vector", SIGNATURE, false)); + lookup = insert(S3FunctionLookupNode.create(false, false)); } - try { - return useMethod.execute(frame, clazz, new Object[]{x, mode}); - } catch (S3FunctionLookupNode.NoGenericMethodException e) { - // fallthrough + Result lookupResult = lookup.execute(frame, "as.vector", clazz, null, frame.materialize(), null); + if (lookupResult != null) { + if (callMatcher == null) { + CompilerDirectives.transferToInterpreterAndInvalidate(); + callMatcher = insert(CallMatcherNode.create(false)); + } + return callMatcher.execute(frame, SIGNATURE, new Object[]{x, mode}, lookupResult.function, lookupResult.targetFunctionName, lookupResult.createS3Args(frame)); } } return internal.execute(x, mode); diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/BasePackage.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/BasePackage.java index 25fd91732c4d0b822d1d2847b6fc1ca1f146efca..3e4ab57a47327e420f7fdf56bbcfad403d61085c 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/BasePackage.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/BasePackage.java @@ -67,7 +67,6 @@ import com.oracle.truffle.r.nodes.builtin.base.infix.IfBuiltinNodeGen; import com.oracle.truffle.r.nodes.builtin.base.infix.NextBuiltin; import com.oracle.truffle.r.nodes.builtin.base.infix.NextBuiltinNodeGen; import com.oracle.truffle.r.nodes.builtin.base.infix.ParenBuiltin; -import com.oracle.truffle.r.nodes.builtin.base.infix.ParenBuiltinNodeGen; import com.oracle.truffle.r.nodes.builtin.base.infix.RepeatBuiltin; import com.oracle.truffle.r.nodes.builtin.base.infix.RepeatBuiltinNodeGen; import com.oracle.truffle.r.nodes.builtin.base.infix.Subscript; @@ -251,6 +250,8 @@ public class BasePackage extends RBuiltinPackage { add(ConnectionFunctions.File.class, ConnectionFunctionsFactory.FileNodeGen::create); add(ConnectionFunctions.Flush.class, ConnectionFunctionsFactory.FlushNodeGen::create); add(ConnectionFunctions.GZFile.class, ConnectionFunctionsFactory.GZFileNodeGen::create); + add(ConnectionFunctions.BZFile.class, ConnectionFunctionsFactory.BZFileNodeGen::create); + add(ConnectionFunctions.XZFile.class, ConnectionFunctionsFactory.XZFileNodeGen::create); add(ConnectionFunctions.GetAllConnections.class, ConnectionFunctionsFactory.GetAllConnectionsNodeGen::create); add(ConnectionFunctions.GetConnection.class, ConnectionFunctionsFactory.GetConnectionNodeGen::create); add(ConnectionFunctions.IsOpen.class, ConnectionFunctionsFactory.IsOpenNodeGen::create); @@ -355,6 +356,7 @@ public class BasePackage extends RBuiltinPackage { add(FastRTry.class, FastRTryNodeGen::create); add(FastRInspect.class, FastRInspectNodeGen::create); add(FastRInterop.Eval.class, FastRInteropFactory.EvalNodeGen::create); + add(FastRInterop.EvalFile.class, FastRInteropFactory.EvalFileNodeGen::create); add(FastRInterop.Export.class, FastRInteropFactory.ExportNodeGen::create); add(FastRInterop.HasSize.class, FastRInteropFactory.HasSizeNodeGen::create); add(FastRInterop.Import.class, FastRInteropFactory.ImportNodeGen::create); @@ -696,7 +698,7 @@ public class BasePackage extends RBuiltinPackage { add(FunctionBuiltin.class, FunctionBuiltinNodeGen::create); add(IfBuiltin.class, IfBuiltinNodeGen::create); add(NextBuiltin.class, NextBuiltinNodeGen::create); - add(ParenBuiltin.class, ParenBuiltinNodeGen::create); + add(ParenBuiltin.class, ParenBuiltin::new, ParenBuiltin::special); add(RepeatBuiltin.class, RepeatBuiltinNodeGen::create); add(Tilde.class, TildeNodeGen::create); add(UpdateSubscript.class, UpdateSubscriptNodeGen::create, UpdateSubscript::special); diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Bind.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Bind.java index 0a95c508e5ae397f7717df4e96528108cb1d0c27..13294d4f362ab562c0db9a44cb1426995eaca939 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Bind.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Bind.java @@ -43,8 +43,9 @@ import com.oracle.truffle.r.nodes.attributes.SpecialAttributesFunctions.SetDimAt import com.oracle.truffle.r.nodes.attributes.SpecialAttributesFunctions.SetDimNamesAttributeNode; import com.oracle.truffle.r.nodes.builtin.CastBuilder; import com.oracle.truffle.r.nodes.builtin.RBuiltinNode; +import com.oracle.truffle.r.nodes.function.CallMatcherNode; import com.oracle.truffle.r.nodes.function.S3FunctionLookupNode; -import com.oracle.truffle.r.nodes.function.UseMethodInternalNode; +import com.oracle.truffle.r.nodes.function.S3FunctionLookupNode.Result; import com.oracle.truffle.r.nodes.helpers.InheritsCheckNode; import com.oracle.truffle.r.nodes.unary.CastComplexNode; import com.oracle.truffle.r.nodes.unary.CastDoubleNode; @@ -97,10 +98,12 @@ public abstract class Bind extends RBaseNode { public abstract Object execute(VirtualFrame frame, int deparseLevel, Object[] args, RArgsValuesAndNames promiseArgs, int precedence); @Child private CastToVectorNode castVector; - @Child private UseMethodInternalNode dcn; @Child private CastLogicalNode castLogical; @Child private GetDimAttributeNode getDimsNode; + @Child private S3FunctionLookupNode lookup; + @Child private CallMatcherNode callMatcher; + private final BindType type; private final ConditionProfile nullNamesProfile = ConditionProfile.createBinaryProfile(); @@ -162,15 +165,19 @@ public abstract class Bind extends RBaseNode { @Specialization(guards = {"args.length > 0", "isDataFrame(args)"}) protected Object allDataFrame(VirtualFrame frame, int deparseLevel, @SuppressWarnings("unused") Object[] args, RArgsValuesAndNames promiseArgs, @SuppressWarnings("unused") int precedence) { - if (dcn == null) { + if (lookup == null) { CompilerDirectives.transferToInterpreterAndInvalidate(); - dcn = insert(new UseMethodInternalNode(type.toString(), SIGNATURE, false)); + lookup = insert(S3FunctionLookupNode.create(false, false)); } - try { - return dcn.execute(frame, DATA_FRAME_CLASS, new Object[]{deparseLevel, promiseArgs}); - } catch (S3FunctionLookupNode.NoGenericMethodException e) { + Result lookupResult = lookup.execute(frame, type.toString(), DATA_FRAME_CLASS, null, frame.materialize(), null); + if (lookupResult == null) { throw RInternalError.shouldNotReachHere(); } + if (callMatcher == null) { + CompilerDirectives.transferToInterpreterAndInvalidate(); + callMatcher = insert(CallMatcherNode.create(false)); + } + return callMatcher.execute(frame, SIGNATURE, new Object[]{deparseLevel, promiseArgs}, lookupResult.function, lookupResult.targetFunctionName, lookupResult.createS3Args(frame)); } private Object bindInternal(int deparseLevel, Object[] args, RArgsValuesAndNames promiseArgs, CastNode castNode, boolean needsVectorCast, SetDimAttributeNode setDimNode, diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/CRC64.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/CRC64.java index c4a29770e6ed51657735ce8b9077e9e4990673ba..c492da931b26adedf73a7520833fdd76fd63ed4d 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/CRC64.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/CRC64.java @@ -52,13 +52,13 @@ public abstract class CRC64 extends RBuiltinNode { bytes = crc64(bytes); long l = 0; for (int i = 0; i < bytes.length; i++) { - l += ((long) bytes[i] & 0xffL) << (8 * i); + l += (bytes[i] & 0xffL) << (8 * i); } return RDataFactory.createStringVector(Long.toHexString(l)); } @TruffleBoundary - private byte[] crc64(byte[] bytes) { + private static byte[] crc64(byte[] bytes) { org.tukaani.xz.check.CRC64 crc = new org.tukaani.xz.check.CRC64(); crc.update(bytes); return crc.finish(); diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/ConditionFunctions.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/ConditionFunctions.java index 3957c5a02abfa8b64f6d1b8adc046841f4d07523..14d191a2e99094dd2e9296e8e1f546ed7a5c982d 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/ConditionFunctions.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/ConditionFunctions.java @@ -21,9 +21,14 @@ import static com.oracle.truffle.r.runtime.builtins.RBuiltinKind.INTERNAL; import com.oracle.truffle.api.CompilerDirectives; import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary; +import com.oracle.truffle.api.dsl.Cached; import com.oracle.truffle.api.dsl.Specialization; +import com.oracle.truffle.api.frame.FrameSlot; +import com.oracle.truffle.api.frame.FrameSlotTypeException; +import com.oracle.truffle.api.frame.VirtualFrame; import com.oracle.truffle.r.nodes.builtin.CastBuilder; import com.oracle.truffle.r.nodes.builtin.RBuiltinNode; +import com.oracle.truffle.r.nodes.function.FunctionDefinitionNode; import com.oracle.truffle.r.nodes.function.PromiseHelperNode; import com.oracle.truffle.r.runtime.RError; import com.oracle.truffle.r.runtime.RErrorHandling; @@ -67,15 +72,31 @@ public class ConditionFunctions { return getHandlerStack(); } + protected FrameSlot createHandlerFrameSlot(VirtualFrame frame) { + return ((FunctionDefinitionNode) getRootNode()).getHandlerFrameSlot(frame); + } + @Specialization - @TruffleBoundary - protected Object addCondHands(RAbstractStringVector classes, RList handlers, REnvironment parentEnv, Object target, byte calling) { + protected Object addCondHands(VirtualFrame frame, RAbstractStringVector classes, RList handlers, REnvironment parentEnv, Object target, byte calling, + @Cached("createHandlerFrameSlot(frame)") FrameSlot handlerFrameSlot) { if (classes.getLength() != handlers.getLength()) { + CompilerDirectives.transferToInterpreter(); throw RError.error(this, RError.Message.BAD_HANDLER_DATA); } - return RErrorHandling.createHandlers(classes, handlers, parentEnv, target, calling); + try { + if (!frame.isObject(handlerFrameSlot) || frame.getObject(handlerFrameSlot) == null) { + frame.setObject(handlerFrameSlot, RErrorHandling.getHandlerStack()); + } + } catch (FrameSlotTypeException e) { + throw RInternalError.shouldNotReachHere(); + } + return createHandlers(classes, handlers, parentEnv, target, calling); } + @TruffleBoundary + private static Object createHandlers(RAbstractStringVector classes, RList handlers, REnvironment parentEnv, Object target, byte calling) { + return RErrorHandling.createHandlers(classes, handlers, parentEnv, target, calling); + } } @RBuiltin(name = ".resetCondHands", visibility = OFF, kind = INTERNAL, parameterNames = {"stack"}, behavior = COMPLEX) @@ -108,9 +129,21 @@ public class ConditionFunctions { restart(casts); } + protected FrameSlot createRestartFrameSlot(VirtualFrame frame) { + return ((FunctionDefinitionNode) getRootNode()).getRestartFrameSlot(frame); + } + @Specialization - protected Object addRestart(RList restart) { + protected Object addRestart(VirtualFrame frame, RList restart, + @Cached("createRestartFrameSlot(frame)") FrameSlot restartFrameSlot) { checkLength(restart); + try { + if (!frame.isObject(restartFrameSlot) || frame.getObject(restartFrameSlot) == null) { + frame.setObject(restartFrameSlot, RErrorHandling.getRestartStack()); + } + } catch (FrameSlotTypeException e) { + throw RInternalError.shouldNotReachHere(); + } RErrorHandling.addRestart(restart); return RNull.instance; } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/ConnectionFunctions.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/ConnectionFunctions.java index df46b16704bc913cca3af30da9027533d27569f2..8c4cff9d5b23a1d7120484793d863a7fbc99dd2c 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/ConnectionFunctions.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/ConnectionFunctions.java @@ -52,7 +52,6 @@ import java.nio.ByteOrder; import java.nio.DoubleBuffer; import java.nio.IntBuffer; import java.util.ArrayList; -import java.util.zip.ZipException; import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary; import com.oracle.truffle.api.dsl.Cached; @@ -66,10 +65,11 @@ import com.oracle.truffle.r.runtime.RError; import com.oracle.truffle.r.runtime.RError.Message; import com.oracle.truffle.r.runtime.RInternalError; import com.oracle.truffle.r.runtime.RRuntime; +import com.oracle.truffle.r.runtime.RCompression; import com.oracle.truffle.r.runtime.builtins.RBuiltin; import com.oracle.truffle.r.runtime.conn.ConnectionSupport.BaseRConnection; import com.oracle.truffle.r.runtime.conn.FileConnections.FileRConnection; -import com.oracle.truffle.r.runtime.conn.GZIPConnections.GZIPRConnection; +import com.oracle.truffle.r.runtime.conn.CompressedConnections.CompressedRConnection; import com.oracle.truffle.r.runtime.conn.RConnection; import com.oracle.truffle.r.runtime.conn.SocketConnections.RSocketConnection; import com.oracle.truffle.r.runtime.conn.TextConnections.TextRConnection; @@ -225,34 +225,31 @@ public abstract class ConnectionFunctions { } - /** - * {@code gzfile} is very versatile (unfortunately); it can open uncompressed files, and files - * compressed by {@code bzip2, xz, lzma}. Currently we only support {@code gzip} and - * uncompressed. + /* + * In GNUR R {@code gzfile, bzfile, xzfile} are very versatile on input; they can open + * uncompressed files, and files compressed by {@code bzip2, xz, lzma}. */ - @RBuiltin(name = "gzfile", kind = INTERNAL, parameterNames = {"description", "open", "encoding", "compression"}, behavior = IO) - public abstract static class GZFile extends RBuiltinNode { + + public abstract static class ZZFileAdapter extends RBuiltinNode { + private final RCompression.Type cType; + + protected ZZFileAdapter(RCompression.Type cType) { + this.cType = cType; + } + @Override protected void createCasts(CastBuilder casts) { Casts.description(casts); Casts.open(casts); Casts.encoding(casts); - casts.arg("compression").asIntegerVector().findFirst().notNA().mustBe(gte(0).and(lte(9))); + casts.arg("compression").asIntegerVector().findFirst().notNA().mustBe(gte(cType == RCompression.Type.XZ ? -9 : 0).and(lte(9))); } @Specialization @TruffleBoundary - @SuppressWarnings("unused") - protected RAbstractIntVector gzFile(RAbstractStringVector description, String open, RAbstractStringVector encoding, int compression) { + protected RAbstractIntVector zzFile(RAbstractStringVector description, String open, String encoding, int compression) { try { - return new GZIPRConnection(description.getDataAt(0), open).asVector(); - } catch (ZipException ex) { - // wasn't a gzip file, try uncompressed text - try { - return new FileRConnection(description.getDataAt(0), "r").asVector(); - } catch (IOException ex1) { - throw reportError(description.getDataAt(0), ex1); - } + return new CompressedRConnection(description.getDataAt(0), open, cType, encoding, compression).asVector(); } catch (IOException ex) { throw reportError(description.getDataAt(0), ex); } @@ -264,6 +261,30 @@ public abstract class ConnectionFunctions { } } + @RBuiltin(name = "gzfile", kind = INTERNAL, parameterNames = {"description", "open", "encoding", "compression"}, behavior = IO) + public abstract static class GZFile extends ZZFileAdapter { + protected GZFile() { + super(RCompression.Type.GZIP); + } + + } + + @RBuiltin(name = "bzfile", kind = INTERNAL, parameterNames = {"description", "open", "encoding", "compression"}, behavior = IO) + public abstract static class BZFile extends ZZFileAdapter { + protected BZFile() { + super(RCompression.Type.BZIP2); + } + + } + + @RBuiltin(name = "xzfile", kind = INTERNAL, parameterNames = {"description", "open", "encoding", "compression"}, behavior = IO) + public abstract static class XZFile extends ZZFileAdapter { + protected XZFile() { + super(RCompression.Type.XZ); + } + + } + @RBuiltin(name = "textConnection", kind = INTERNAL, parameterNames = {"description", "text", "open", "env", "encoding"}, behavior = IO) public abstract static class TextConnection extends RBuiltinNode { @Override diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/HiddenInternalFunctions.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/HiddenInternalFunctions.java index d04b57fd08082c853c5738796cd4fa9a5d2f151a..7d4077d857cbb8216a7206c87de87fb8ce63885c 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/HiddenInternalFunctions.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/HiddenInternalFunctions.java @@ -399,7 +399,7 @@ public class HiddenInternalFunctions { throw RError.error(this, Message.GENERIC, "zlib compress error"); } } else if (compression == 3) { - ctype = RCompression.Type.LZMA; + ctype = RCompression.Type.XZ; offset = 5; outLen = data.length; cdata = new byte[outLen]; @@ -446,8 +446,8 @@ public class HiddenInternalFunctions { byte[] ulenData = new byte[4]; dataLengthBuf.get(ulenData); out.write(ulenData); - if (type == RCompression.Type.LZMA) { - out.write(RCompression.Type.LZMA.typeByte); + if (type == RCompression.Type.XZ) { + out.write(RCompression.Type.XZ.typeByte); } out.write(cdata); return result; diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Lapply.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Lapply.java index 54ecf0b6dc9db4eaf3fcfd74062c55e6372bb18c..4cd34ed9f441d06c369bdfc1c72c98880a2d1d24 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Lapply.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Lapply.java @@ -17,7 +17,6 @@ import static com.oracle.truffle.r.runtime.builtins.RBuiltinKind.INTERNAL; import com.oracle.truffle.api.CompilerAsserts; import com.oracle.truffle.api.CompilerDirectives; -import com.oracle.truffle.api.CompilerDirectives.CompilationFinal; import com.oracle.truffle.api.dsl.Cached; import com.oracle.truffle.api.dsl.Specialization; import com.oracle.truffle.api.frame.Frame; @@ -89,21 +88,18 @@ public abstract class Lapply extends RBuiltinNode { private static final class ExtractElementInternal extends RSourceSectionNode implements RSyntaxCall { - protected ExtractElementInternal() { + @Child private ExtractVectorNode extractElementNode = ExtractVectorNodeGen.create(ElementAccessMode.SUBSCRIPT, false); + private final FrameSlot vectorSlot; + private final FrameSlot indexSlot; + + protected ExtractElementInternal(FrameSlot vectorSlot, FrameSlot indexSlot) { super(RSyntaxNode.LAZY_DEPARSE); + this.vectorSlot = vectorSlot; + this.indexSlot = indexSlot; } - @Child private ExtractVectorNode extractElementNode = ExtractVectorNodeGen.create(ElementAccessMode.SUBSCRIPT, false); - @CompilationFinal private FrameSlot vectorSlot; - @CompilationFinal private FrameSlot indexSlot; - @Override public Object execute(VirtualFrame frame) { - if (vectorSlot == null) { - CompilerDirectives.transferToInterpreterAndInvalidate(); - vectorSlot = frame.getFrameDescriptor().findFrameSlot("X"); - indexSlot = frame.getFrameDescriptor().findFrameSlot("i"); - } try { return extractElementNode.apply(frame, frame.getObject(vectorSlot), new Object[]{frame.getInt(indexSlot)}, RRuntime.LOGICAL_TRUE, RRuntime.LOGICAL_TRUE); } catch (FrameSlotTypeException e) { @@ -149,8 +145,8 @@ public abstract class Lapply extends RBuiltinNode { @Cached("createVectorSlot(frame)") FrameSlot vectorSlot, // @Cached("create()") RLengthNode lengthNode, // @Cached("createCountingProfile()") LoopConditionProfile loop, // - @Cached("createCallNode()") RCallNode firstCallNode, // - @Cached("createCallNode()") RCallNode callNode) { + @Cached("createCallNode(vectorSlot, indexSlot)") RCallNode firstCallNode, // + @Cached("createCallNode(vectorSlot, indexSlot)") RCallNode callNode) { // TODO: R switches to double if x.getLength() is greater than 2^31-1 frame.setObject(vectorSlot, vector); int length = lengthNode.executeInteger(frame, vector); @@ -171,10 +167,10 @@ public abstract class Lapply extends RBuiltinNode { /** * Creates the {@link RCallNode} for this target and {@code varArgs}. */ - protected RCallNode createCallNode() { + protected RCallNode createCallNode(FrameSlot vectorSlot, FrameSlot indexSlot) { CompilerAsserts.neverPartOfCompilation(); - ExtractElementInternal element = new ExtractElementInternal(); + ExtractElementInternal element = new ExtractElementInternal(vectorSlot, indexSlot); ReadVariableNode readArgs = ReadVariableNode.createSilent(ArgumentsSignature.VARARG_NAME, RType.Any); return RCallNode.createCall(createCallSourceSection(), ReadVariableNode.create("FUN"), ArgumentsSignature.get(null, "..."), element, readArgs); diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/R/dataframe_overrides.R b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/R/dataframe_overrides.R deleted file mode 100644 index 2d61513b5326ac326cbce80dd9e4cfdd02fad0f9..0000000000000000000000000000000000000000 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/R/dataframe_overrides.R +++ /dev/null @@ -1,30 +0,0 @@ -# File src/library/base/R/dataframe.R -# Part of the R package, http://www.R-project.org -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# A copy of the GNU General Public License is available at -# http://www.r-project.org/Licenses/ - -# Statlib code by John Chambers, Bell Labs, 1994 -# Changes Copyright (C) 1998-2014 The R Core Team - -Summary.data.frame <- function(..., na.rm=FALSE) -{ - args <- list(...) - args <- lapply(args, function(x) { - x <- as.matrix(x) - if(!is.numeric(x) && !is.complex(x)) - stop("only defined on a data frame with all numeric variables") - x - }) - do.call(.Generic, c(args, na.rm=na.rm)) -} diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/foreign/CallAndExternalFunctions.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/foreign/CallAndExternalFunctions.java index 2c2f2c79834c75d9fd5ed6fdf84c491fd066a0ee..af77f17ef2cb353ab1e94c2eabf828b99a15bb7a 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/foreign/CallAndExternalFunctions.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/foreign/CallAndExternalFunctions.java @@ -46,6 +46,7 @@ import com.oracle.truffle.r.library.stats.Cauchy.PCauchy; import com.oracle.truffle.r.library.stats.Cauchy.RCauchy; import com.oracle.truffle.r.library.stats.CdistNodeGen; import com.oracle.truffle.r.library.stats.Chisq; +import com.oracle.truffle.r.library.stats.Chisq.RChisq; import com.oracle.truffle.r.library.stats.CompleteCases; import com.oracle.truffle.r.library.stats.CovcorNodeGen; import com.oracle.truffle.r.library.stats.CutreeNodeGen; @@ -68,17 +69,24 @@ import com.oracle.truffle.r.library.stats.LogNormal; import com.oracle.truffle.r.library.stats.LogNormal.DLNorm; import com.oracle.truffle.r.library.stats.LogNormal.PLNorm; import com.oracle.truffle.r.library.stats.LogNormal.QLNorm; +import com.oracle.truffle.r.library.stats.Logis; +import com.oracle.truffle.r.library.stats.Logis.DLogis; +import com.oracle.truffle.r.library.stats.Logis.RLogis; +import com.oracle.truffle.r.library.stats.PPois; import com.oracle.truffle.r.library.stats.Pbeta; import com.oracle.truffle.r.library.stats.Pbinom; import com.oracle.truffle.r.library.stats.Pf; import com.oracle.truffle.r.library.stats.Pnorm; +import com.oracle.truffle.r.library.stats.Pt; +import com.oracle.truffle.r.library.stats.QBeta; +import com.oracle.truffle.r.library.stats.QPois; import com.oracle.truffle.r.library.stats.Qbinom; +import com.oracle.truffle.r.library.stats.Qf; import com.oracle.truffle.r.library.stats.Qnorm; +import com.oracle.truffle.r.library.stats.Qt; import com.oracle.truffle.r.library.stats.RBeta; -import com.oracle.truffle.r.library.stats.RChisq; import com.oracle.truffle.r.library.stats.RGamma; import com.oracle.truffle.r.library.stats.RHyper; -import com.oracle.truffle.r.library.stats.RLogis; import com.oracle.truffle.r.library.stats.RMultinomNodeGen; import com.oracle.truffle.r.library.stats.RNbinomMu; import com.oracle.truffle.r.library.stats.RNchisq; @@ -92,11 +100,14 @@ import com.oracle.truffle.r.library.stats.Rbinom; import com.oracle.truffle.r.library.stats.Rf; import com.oracle.truffle.r.library.stats.Rnorm; import com.oracle.truffle.r.library.stats.Rt; -import com.oracle.truffle.r.library.stats.Runif; import com.oracle.truffle.r.library.stats.Signrank.RSignrank; import com.oracle.truffle.r.library.stats.SplineFunctionsFactory.SplineCoefNodeGen; import com.oracle.truffle.r.library.stats.SplineFunctionsFactory.SplineEvalNodeGen; import com.oracle.truffle.r.library.stats.StatsFunctionsFactory; +import com.oracle.truffle.r.library.stats.Unif.DUnif; +import com.oracle.truffle.r.library.stats.Unif.PUnif; +import com.oracle.truffle.r.library.stats.Unif.QUnif; +import com.oracle.truffle.r.library.stats.Unif.Runif; import com.oracle.truffle.r.library.stats.Wilcox.RWilcox; import com.oracle.truffle.r.library.tools.C_ParseRdNodeGen; import com.oracle.truffle.r.library.tools.DirChmodNodeGen; @@ -142,7 +153,7 @@ import com.oracle.truffle.r.runtime.ffi.RFFIFactory; public class CallAndExternalFunctions { @TruffleBoundary - protected static Object encodeArgumentPairList(RArgsValuesAndNames args, String symbolName) { + private static Object encodeArgumentPairList(RArgsValuesAndNames args, String symbolName) { Object list = RNull.instance; for (int i = args.getLength() - 1; i >= 0; i--) { String name = args.getSignature().getName(i); @@ -152,8 +163,8 @@ public class CallAndExternalFunctions { return list; } - protected abstract static class CallRFFIAdapter extends LookupAdapter { - @Child protected CallRFFI.CallRFFINode callRFFINode = RFFIFactory.getRFFI().getCallRFFI().createCallRFFINode(); + abstract static class CallRFFIAdapter extends LookupAdapter { + @Child CallRFFI.CallRFFINode callRFFINode = RFFIFactory.getRFFI().getCallRFFI().createCallRFFINode(); } /** @@ -286,18 +297,34 @@ public class CallAndExternalFunctions { return RandFunction1Node.createInt(new RSignrank()); case "rhyper": return RandFunction3Node.createInt(new RHyper()); + case "qt": + return StatsFunctionsFactory.Function2_2NodeGen.create(new Qt()); + case "pt": + return StatsFunctionsFactory.Function2_2NodeGen.create(new Pt()); case "qgamma": return StatsFunctionsFactory.Function3_2NodeGen.create(new QgammaFunc()); case "dbinom": return StatsFunctionsFactory.Function3_1NodeGen.create(new Dbinom()); case "qbinom": return StatsFunctionsFactory.Function3_2NodeGen.create(new Qbinom()); + case "punif": + return StatsFunctionsFactory.Function3_2NodeGen.create(new PUnif()); + case "dunif": + return StatsFunctionsFactory.Function3_1NodeGen.create(new DUnif()); + case "qunif": + return StatsFunctionsFactory.Function3_2NodeGen.create(new QUnif()); + case "ppois": + return StatsFunctionsFactory.Function2_2NodeGen.create(new PPois()); + case "qpois": + return StatsFunctionsFactory.Function2_2NodeGen.create(new QPois()); case "rbinom": return RandFunction2Node.createInt(new Rbinom()); case "pbinom": return StatsFunctionsFactory.Function3_2NodeGen.create(new Pbinom()); case "pbeta": return StatsFunctionsFactory.Function3_2NodeGen.create(new Pbeta()); + case "qbeta": + return StatsFunctionsFactory.Function3_2NodeGen.create(new QBeta()); case "dcauchy": return StatsFunctionsFactory.Function3_1NodeGen.create(new DCauchy()); case "pcauchy": @@ -306,12 +333,16 @@ public class CallAndExternalFunctions { return StatsFunctionsFactory.Function3_2NodeGen.create(new Cauchy.QCauchy()); case "pf": return StatsFunctionsFactory.Function3_2NodeGen.create(new Pf()); + case "qf": + return StatsFunctionsFactory.Function3_2NodeGen.create(new Qf()); case "df": return StatsFunctionsFactory.Function3_1NodeGen.create(new Df()); case "dgamma": return StatsFunctionsFactory.Function3_1NodeGen.create(new DGamma()); case "dchisq": return StatsFunctionsFactory.Function2_1NodeGen.create(new Chisq.DChisq()); + case "qchisq": + return StatsFunctionsFactory.Function2_2NodeGen.create(new Chisq.QChisq()); case "qgeom": return StatsFunctionsFactory.Function2_2NodeGen.create(new Geom.QGeom()); case "pchisq": @@ -338,6 +369,14 @@ public class CallAndExternalFunctions { return StatsFunctionsFactory.Function3_2NodeGen.create(new QLNorm()); case "plnorm": return StatsFunctionsFactory.Function3_2NodeGen.create(new PLNorm()); + case "dlogis": + return StatsFunctionsFactory.Function3_1NodeGen.create(new DLogis()); + case "qlogis": + return StatsFunctionsFactory.Function3_2NodeGen.create(new Logis.QLogis()); + case "plogis": + return StatsFunctionsFactory.Function3_2NodeGen.create(new Logis.PLogis()); + case "pgeom": + return StatsFunctionsFactory.Function2_2NodeGen.create(new Geom.PGeom()); case "rmultinom": return RMultinomNodeGen.create(); case "Approx": diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/infix/ParenBuiltin.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/infix/ParenBuiltin.java index 23c4c9cbf938de9aa25c65137c0498499e9cb009..a8655bf30d7bebc0b629f7f17af748376f1d30a5 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/infix/ParenBuiltin.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/infix/ParenBuiltin.java @@ -22,19 +22,45 @@ */ package com.oracle.truffle.r.nodes.builtin.base.infix; +import static com.oracle.truffle.r.runtime.RVisibility.ON; import static com.oracle.truffle.r.runtime.builtins.RBehavior.PURE; import static com.oracle.truffle.r.runtime.builtins.RBuiltinKind.PRIMITIVE; -import com.oracle.truffle.api.dsl.Specialization; +import com.oracle.truffle.api.frame.VirtualFrame; +import com.oracle.truffle.api.nodes.NodeCost; +import com.oracle.truffle.api.nodes.NodeInfo; import com.oracle.truffle.r.nodes.builtin.RBuiltinNode; -import com.oracle.truffle.r.runtime.RInternalError; +import com.oracle.truffle.r.runtime.ArgumentsSignature; import com.oracle.truffle.r.runtime.builtins.RBuiltin; +import com.oracle.truffle.r.runtime.nodes.RNode; -@RBuiltin(name = "(", kind = PRIMITIVE, parameterNames = {"x"}, behavior = PURE) -public abstract class ParenBuiltin extends RBuiltinNode { - @SuppressWarnings("unused") - @Specialization - protected Object doIt(Object x) { - throw RInternalError.unimplemented(); +@NodeInfo(cost = NodeCost.NONE) +final class ParensSpecial extends RNode { + + @Child private RNode delegate; + + protected ParensSpecial(RNode delegate) { + this.delegate = delegate; + } + + @Override + public Object execute(VirtualFrame frame) { + return delegate.execute(frame); + } +} + +@RBuiltin(name = "(", kind = PRIMITIVE, parameterNames = {""}, visibility = ON, behavior = PURE) +public final class ParenBuiltin extends RBuiltinNode { + + public static RNode special(ArgumentsSignature signature, RNode[] args, @SuppressWarnings("unused") boolean inReplacement) { + if (signature == ArgumentsSignature.empty(1)) { + return new ParensSpecial(args[0]); + } + return null; + } + + @Override + public Object executeBuiltin(VirtualFrame frame, Object... args) { + return args[0]; } } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/infix/SpecialsUtils.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/infix/SpecialsUtils.java index cae45bca9afb8c891cd87dcfb198f9f132c5405f..971e6e19765f800c98f1d7d9f958ceacecb3440b 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/infix/SpecialsUtils.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/infix/SpecialsUtils.java @@ -22,6 +22,7 @@ */ package com.oracle.truffle.r.nodes.builtin.base.infix; +import com.oracle.truffle.api.CompilerDirectives; import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary; import com.oracle.truffle.api.dsl.NodeChild; import com.oracle.truffle.api.dsl.NodeChildren; @@ -30,7 +31,6 @@ import com.oracle.truffle.api.dsl.TypeSystemReference; import com.oracle.truffle.api.frame.VirtualFrame; import com.oracle.truffle.api.nodes.NodeCost; import com.oracle.truffle.api.nodes.NodeInfo; -import com.oracle.truffle.api.profiles.ConditionProfile; import com.oracle.truffle.api.profiles.ValueProfile; import com.oracle.truffle.r.nodes.EmptyTypeSystemFlatLayout; import com.oracle.truffle.r.nodes.attributes.SpecialAttributesFunctions.GetDimAttributeNode; @@ -107,8 +107,8 @@ class SpecialsUtils { /** * Checks whether the given (1-based) indexes are valid for the given matrix. */ - protected static boolean isValidIndex(RAbstractVector vector, int index1, int index2) { - int[] dimensions = vector.getDimensions(); + protected boolean isValidIndex(RAbstractVector vector, int index1, int index2) { + int[] dimensions = getDimensions.getDimensions(vector); return dimensions != null && dimensions.length == 2 && index1 >= 1 && index1 <= dimensions[0] && index2 >= 1 && index2 <= dimensions[1]; } } @@ -176,14 +176,6 @@ class SpecialsUtils { @TypeSystemReference(EmptyTypeSystemFlatLayout.class) public abstract static class ConvertIndex extends RNode { - private final boolean isSubset; - private final ConditionProfile zeroProfile; - - ConvertIndex(boolean isSubset) { - this.isSubset = isSubset; - this.zeroProfile = isSubset ? null : ConditionProfile.createBinaryProfile(); - } - protected abstract RNode getDelegate(); @Specialization @@ -191,14 +183,20 @@ class SpecialsUtils { return value; } - @Specialization + @Specialization(rewriteOn = IllegalArgumentException.class) protected int convertDouble(double value) { - // Conversion from double to an index differs in subscript and subset. int intValue = (int) value; - if (isSubset) { - return intValue; + if (intValue == 0) { + /* + * Conversion from double to an index differs in subscript and subset for values in + * the ]0..1[ range (subscript interprets 0.1 as 1, whereas subset treats it as 0). + * We avoid this special case by simply going to the more generic case for this + * range. Additionally, (int) Double.NaN is 0, which is also caught by this case. + */ + CompilerDirectives.transferToInterpreterAndInvalidate(); + throw new IllegalArgumentException(); } else { - return zeroProfile.profile(intValue == 0) ? (value == 0 ? 0 : 1) : intValue; + return intValue; } } @@ -217,11 +215,7 @@ class SpecialsUtils { return new ProfiledValue(value); } - public static ConvertIndex convertSubscript(RNode value) { - return ConvertIndexNodeGen.create(false, value); - } - - public static ConvertIndex convertSubset(RNode value) { - return ConvertIndexNodeGen.create(true, value); + public static ConvertIndex convertIndex(RNode value) { + return ConvertIndexNodeGen.create(value); } } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/infix/Subscript.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/infix/Subscript.java index 4c8fe6acd36096bbcb2bcf80383deb43a80b5156..639d98960d7c6d646e830621a8926430c80d9136 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/infix/Subscript.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/infix/Subscript.java @@ -22,7 +22,7 @@ */ package com.oracle.truffle.r.nodes.builtin.base.infix; -import static com.oracle.truffle.r.nodes.builtin.base.infix.SpecialsUtils.convertSubscript; +import static com.oracle.truffle.r.nodes.builtin.base.infix.SpecialsUtils.convertIndex; import static com.oracle.truffle.r.nodes.builtin.base.infix.SpecialsUtils.profile; import static com.oracle.truffle.r.runtime.RDispatch.INTERNAL_GENERIC; import static com.oracle.truffle.r.runtime.builtins.RBehavior.PURE; @@ -193,9 +193,9 @@ public abstract class Subscript extends RBuiltinNode { public static RNode special(ArgumentsSignature signature, RNode[] arguments, boolean inReplacement) { if (signature.getNonNullCount() == 0) { if (arguments.length == 2) { - return SubscriptSpecialNodeGen.create(inReplacement, profile(arguments[0]), convertSubscript(arguments[1])); + return SubscriptSpecialNodeGen.create(inReplacement, profile(arguments[0]), convertIndex(arguments[1])); } else if (arguments.length == 3) { - return SubscriptSpecial2NodeGen.create(inReplacement, profile(arguments[0]), convertSubscript(arguments[1]), convertSubscript(arguments[2])); + return SubscriptSpecial2NodeGen.create(inReplacement, profile(arguments[0]), convertIndex(arguments[1]), convertIndex(arguments[2])); } } return null; diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/infix/Subset.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/infix/Subset.java index 05954ea72e696cff2514a33da821e631656ee65b..b36cbf5a3e24f4d056b0d5a8de2a166d631cd83d 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/infix/Subset.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/infix/Subset.java @@ -22,7 +22,7 @@ */ package com.oracle.truffle.r.nodes.builtin.base.infix; -import static com.oracle.truffle.r.nodes.builtin.base.infix.SpecialsUtils.convertSubset; +import static com.oracle.truffle.r.nodes.builtin.base.infix.SpecialsUtils.convertIndex; import static com.oracle.truffle.r.nodes.builtin.base.infix.SpecialsUtils.profile; import static com.oracle.truffle.r.runtime.RDispatch.INTERNAL_GENERIC; import static com.oracle.truffle.r.runtime.builtins.RBehavior.PURE; @@ -81,7 +81,7 @@ abstract class SubsetSpecial extends SubscriptSpecialBase { } @Specialization(guards = {"simpleVector(vector)", "!inReplacement"}) - protected static Object access(VirtualFrame frame, RAbstractVector vector, Object index, + protected Object access(VirtualFrame frame, RAbstractVector vector, Object index, @Cached("createAccess()") ExtractVectorNode extract) { return extract.apply(frame, vector, new Object[]{index}, RRuntime.LOGICAL_TRUE, RLogical.TRUE); } @@ -124,11 +124,11 @@ public abstract class Subset extends RBuiltinNode { public static RNode special(ArgumentsSignature signature, RNode[] args, boolean inReplacement) { if (signature.getNonNullCount() == 0 && (args.length == 2 || args.length == 3)) { ProfiledValue profiledVector = profile(args[0]); - ConvertIndex index = convertSubset(args[1]); + ConvertIndex index = convertIndex(args[1]); if (args.length == 2) { return SubsetSpecialNodeGen.create(inReplacement, profiledVector, index); } else { - return SubsetSpecial2NodeGen.create(inReplacement, profiledVector, index, convertSubset(args[2])); + return SubsetSpecial2NodeGen.create(inReplacement, profiledVector, index, convertIndex(args[2])); } } return null; diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/infix/UpdateSubscript.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/infix/UpdateSubscript.java index 4825f4efd34fd8b96eec20750d6ae33623f69e9d..1488822ff52f5d2ecad17d08cfad470af6f3ad33 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/infix/UpdateSubscript.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/infix/UpdateSubscript.java @@ -22,7 +22,7 @@ */ package com.oracle.truffle.r.nodes.builtin.base.infix; -import static com.oracle.truffle.r.nodes.builtin.base.infix.SpecialsUtils.convertSubscript; +import static com.oracle.truffle.r.nodes.builtin.base.infix.SpecialsUtils.convertIndex; import static com.oracle.truffle.r.nodes.builtin.base.infix.SpecialsUtils.profile; import static com.oracle.truffle.r.runtime.RDispatch.INTERNAL_GENERIC; import static com.oracle.truffle.r.runtime.builtins.RBehavior.PURE; @@ -168,11 +168,11 @@ public abstract class UpdateSubscript extends RBuiltinNode { public static RNode special(ArgumentsSignature signature, RNode[] args, boolean inReplacement) { if (SpecialsUtils.isCorrectUpdateSignature(signature) && (args.length == 3 || args.length == 4)) { ProfiledValue vector = profile(args[0]); - ConvertIndex index = convertSubscript(args[1]); + ConvertIndex index = convertIndex(args[1]); if (args.length == 3) { return UpdateSubscriptSpecialNodeGen.create(inReplacement, vector, index, args[2]); } else { - return UpdateSubscriptSpecial2NodeGen.create(inReplacement, vector, index, convertSubscript(args[2]), args[3]); + return UpdateSubscriptSpecial2NodeGen.create(inReplacement, vector, index, convertIndex(args[2]), args[3]); } } return null; diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/infix/UpdateSubset.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/infix/UpdateSubset.java index 820e2ebcf5835bbc9f616f6c5c1611fde51ffe86..4e9fd8094a382c3eb0695c56baa8cce51cd91a4a 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/infix/UpdateSubset.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/infix/UpdateSubset.java @@ -22,7 +22,7 @@ */ package com.oracle.truffle.r.nodes.builtin.base.infix; -import static com.oracle.truffle.r.nodes.builtin.base.infix.SpecialsUtils.convertSubset; +import static com.oracle.truffle.r.nodes.builtin.base.infix.SpecialsUtils.convertIndex; import static com.oracle.truffle.r.nodes.builtin.base.infix.SpecialsUtils.profile; import static com.oracle.truffle.r.runtime.RDispatch.INTERNAL_GENERIC; import static com.oracle.truffle.r.runtime.builtins.RBehavior.PURE; @@ -57,11 +57,11 @@ public abstract class UpdateSubset extends RBuiltinNode { public static RNode special(ArgumentsSignature signature, RNode[] args, boolean inReplacement) { if (SpecialsUtils.isCorrectUpdateSignature(signature) && (args.length == 3 || args.length == 4)) { ProfiledValue vector = profile(args[0]); - ConvertIndex index = convertSubset(args[1]); + ConvertIndex index = convertIndex(args[1]); if (args.length == 3) { return UpdateSubscriptSpecialNodeGen.create(inReplacement, vector, index, args[2]); } else { - return UpdateSubscriptSpecial2NodeGen.create(inReplacement, vector, index, convertSubset(args[2]), args[3]); + return UpdateSubscriptSpecial2NodeGen.create(inReplacement, vector, index, convertIndex(args[2]), args[3]); } } return null; diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/FastRInterop.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/FastRInterop.java index ce5c3dae4dc188754d89052895ff69e884dd5d6c..f0a1eaaf6eadefcfdc832fa191210af6fe13681e 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/FastRInterop.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/FastRInterop.java @@ -31,6 +31,9 @@ import static com.oracle.truffle.r.runtime.RVisibility.ON; import static com.oracle.truffle.r.runtime.builtins.RBehavior.COMPLEX; import static com.oracle.truffle.r.runtime.builtins.RBuiltinKind.PRIMITIVE; +import java.io.File; +import java.io.IOException; + import com.oracle.truffle.api.CallTarget; import com.oracle.truffle.api.CompilerAsserts; import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary; @@ -44,6 +47,7 @@ import com.oracle.truffle.api.interop.TruffleObject; import com.oracle.truffle.api.nodes.DirectCallNode; import com.oracle.truffle.api.nodes.Node; import com.oracle.truffle.api.source.Source; +import com.oracle.truffle.api.source.Source.Builder; import com.oracle.truffle.r.nodes.builtin.CastBuilder; import com.oracle.truffle.r.nodes.builtin.CastBuilder.Predef; import com.oracle.truffle.r.nodes.builtin.RBuiltinNode; @@ -99,6 +103,46 @@ public class FastRInterop { } } + @RBuiltin(name = ".fastr.interop.evalFile", visibility = OFF, kind = PRIMITIVE, parameterNames = {"path", "mimeType"}, behavior = COMPLEX) + public abstract static class EvalFile extends RBuiltinNode { + + @Override + protected void createCasts(CastBuilder casts) { + casts.arg("path").mustBe(stringValue()).asStringVector().mustBe(singleElement()).findFirst(); + casts.arg("mimeType").allowMissing().mustBe(stringValue()).asStringVector().mustBe(singleElement()).findFirst(); + } + + protected CallTarget parse(String path, String mimeType) { + CompilerAsserts.neverPartOfCompilation(); + + File file = new File(path); + try { + Builder<IOException, RuntimeException, RuntimeException> sourceBuilder = Source.newBuilder(file).name(file.getName()).internal(); + if (mimeType != null) { + sourceBuilder.mimeType(mimeType); + } + Source sourceObject = sourceBuilder.build(); + return RContext.getInstance().getEnv().parse(sourceObject); + } catch (IOException e) { + throw RError.error(this, Message.GENERIC, "Error reading file: " + e.getMessage()); + } catch (Throwable t) { + throw RError.error(this, Message.GENERIC, "Error while parsing: " + t.getMessage()); + } + } + + @Specialization + @TruffleBoundary + protected Object eval(String path, @SuppressWarnings("unused") RMissing missing) { + return parse(path, null).call(); + } + + @Specialization + @TruffleBoundary + protected Object eval(String path, String mimeType) { + return parse(path, mimeType).call(); + } + } + @RBuiltin(name = ".fastr.interop.export", visibility = OFF, kind = PRIMITIVE, parameterNames = {"name", "value"}, behavior = COMPLEX) public abstract static class Export extends RBuiltinNode { diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/FastRSyntaxTree.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/FastRSyntaxTree.java index caed0874e9fe810fa18e624cabbba2f25e540198..0a2a9930f4d4f4adc756ec74feb8e880f36bb076 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/FastRSyntaxTree.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/FastRSyntaxTree.java @@ -62,7 +62,7 @@ import com.oracle.truffle.r.runtime.nodes.RSyntaxVisitor; * Only nodes that return {@code true} to {@link RSyntaxNode#isSyntax()} are processed. N.B. This * will reach nodes that implement {@link RSyntaxNode} but are used in {@link RSyntaxNode#INTERNAL} * mode</li> - * <li><b<syntaxelement</b>: Use the {@link RSyntaxVisitor} to visit the "logical" syntax tree.</li> + * <li><b>syntaxelement</b>: Use the {@link RSyntaxVisitor} to visit the "logical" syntax tree.</li> * </ol> * */ @@ -71,7 +71,7 @@ public abstract class FastRSyntaxTree extends RBuiltinNode { @Override public Object[] getDefaultParameterValues() { - return new Object[]{RMissing.instance, "rsyntaxnode", RRuntime.LOGICAL_FALSE, RRuntime.LOGICAL_FALSE}; + return new Object[]{RMissing.instance, "syntaxelement", RRuntime.LOGICAL_FALSE, RRuntime.LOGICAL_FALSE}; } @Override @@ -110,12 +110,18 @@ public abstract class FastRSyntaxTree extends RBuiltinNode { @Override protected Void visit(RSyntaxCall element) { printIndent(depth); - writeString(element.getClass().getSimpleName(), false); + RSyntaxElement lhs = element.getSyntaxLHS(); + if (lhs instanceof RSyntaxLookup) { + writeString(element.getClass().getSimpleName() + " " + ((RSyntaxLookup) lhs).getIdentifier(), false); + } else { + writeString(element.getClass().getSimpleName(), false); + } processSourceSection(element.getSourceSection(), printSource); printnl(); - RSyntaxElement lhs = element.getSyntaxLHS(); RSyntaxElement[] arguments = element.getSyntaxArguments(); - accept(lhs); + if (!(lhs instanceof RSyntaxLookup)) { + accept(lhs); + } for (RSyntaxElement arg : arguments) { depth++; accept(arg); diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/utils/R/packages_overrides.R b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/utils/R/packages_overrides.R deleted file mode 100644 index 0dc6f9fe27335e7b7bd9a53279e914047ccbc833..0000000000000000000000000000000000000000 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/utils/R/packages_overrides.R +++ /dev/null @@ -1,56 +0,0 @@ -# File src/library/utils/R/packages.R -# Part of the R package, http://www.R-project.org -# -# Copyright (C) 1995-2014 The R Core Team -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# A copy of the GNU General Public License is available at -# http://www.r-project.org/Licenses/ - -# An override that works around the problems with numeric version generic ops -# We have to eval this re-definition in the utils namespace environmment as it is a private function -# stored in a local map - -eval(expression( -available_packages_filters_db$R_version <- - function(db) -{ - ## Ignore packages which don't fit our version of R. - depends <- db[, "Depends"] - depends[is.na(depends)] <- "" - ## Collect the (versioned) R depends entries. - x <- lapply(strsplit(sub("^[[:space:]]*", "", depends), - "[[:space:]]*,[[:space:]]*"), - function(s) s[grepl("^R[[:space:]]*\\(", s)]) - lens <- sapply(x, length) - pos <- which(lens > 0L) - if(!length(pos)) return(db) - lens <- lens[pos] - ## Unlist. - x <- unlist(x) - pat <- "^R[[:space:]]*\\(([[<>=!]+)[[:space:]]+(.*)\\)[[:space:]]*" - ## Extract ops. - ops <- sub(pat, "\\1", x) - ## Split target versions accordings to ops. - v_t <- split(sub(pat, "\\2", x), ops) - ## Current R version. -# v_c <- getRversion() - v_c <- as.character(getRversion()) - ## Compare current to target grouped by op. - res <- logical(length(x)) - for(op in names(v_t)) - res[ops == op] <- do.call(op, list(v_c, v_t[[op]])) - ## And assemble test results according to the rows of db. - ind <- rep.int(TRUE, NROW(db)) - ind[pos] <- sapply(split(res, rep.int(seq_along(lens), lens)), all) - db[ind, , drop = FALSE] -}), asNamespace("utils")) diff --git a/com.oracle.truffle.r.nodes.test/src/com/oracle/truffle/r/nodes/test/SpecialCallTest.java b/com.oracle.truffle.r.nodes.test/src/com/oracle/truffle/r/nodes/test/SpecialCallTest.java index b92c005198d339616de71ffa80264e1ff7848959..24af4e1560c7e5e6bea0d1cf987abc3a1b1ad702 100644 --- a/com.oracle.truffle.r.nodes.test/src/com/oracle/truffle/r/nodes/test/SpecialCallTest.java +++ b/com.oracle.truffle.r.nodes.test/src/com/oracle/truffle/r/nodes/test/SpecialCallTest.java @@ -164,11 +164,11 @@ public class SpecialCallTest extends TestBase { assertCallCounts("1 + 1", 1, 0, 1, 0); assertCallCounts("1 + 1 * 2 + 4", 3, 0, 3, 0); - assertCallCounts("{ a <- 1; b <- 2 }", "a + b", 1, 0, 1, 0); - assertCallCounts("{ a <- 1; b <- 2; c <- 3 }", "a + b * 2 * c", 3, 0, 3, 0); + assertCallCounts("a <- 1; b <- 2", "a + b", 1, 0, 1, 0); + assertCallCounts("a <- 1; b <- 2; c <- 3", "a + b * 2 * c", 3, 0, 3, 0); - assertCallCounts("{ a <- data.frame(a=1); b <- 2; c <- 3 }", "a + b * 2 * c", 3, 0, 2, 1); - assertCallCounts("{ a <- 1; b <- data.frame(a=1); c <- 3 }", "a + b * 2 * c", 3, 0, 0, 3); + assertCallCounts("a <- data.frame(a=1); b <- 2; c <- 3", "a + b * 2 * c", 3, 0, 2, 1); + assertCallCounts("a <- 1; b <- data.frame(a=1); c <- 3", "a + b * 2 * c", 3, 0, 0, 3); assertCallCounts("1 %*% 1", 0, 1, 0, 1); } @@ -182,7 +182,7 @@ public class SpecialCallTest extends TestBase { assertCallCounts("a <- c(1,2,3,4)", "a[0.1]", 1, 0, 1, 0); assertCallCounts("a <- c(1,2,3,4)", "a[5]", 1, 0, 1, 0); assertCallCounts("a <- c(1,2,3,4)", "a[0]", 1, 0, 1, 0); - assertCallCounts("{ a <- c(1,2,3,4); b <- -1 }", "a[b]", 1, 0, 1, 0); + assertCallCounts("a <- c(1,2,3,4); b <- -1", "a[b]", 1, 0, 1, 0); assertCallCounts("a <- c(1,2,3,4)", "a[NA_integer_]", 1, 0, 1, 0); assertCallCounts("a <- c(1,2,3,4)", "a[-1]", 0, 2, 0, 2); // "-1" is a unary expression @@ -201,7 +201,7 @@ public class SpecialCallTest extends TestBase { assertCallCounts("a <- c(1,2,3,4)", "a[[0.1]]", 1, 0, 1, 0); assertCallCounts("a <- c(1,2,3,4)", "a[[5]]", 1, 0, 1, 0); assertCallCounts("a <- c(1,2,3,4)", "a[[0]]", 1, 0, 1, 0); - assertCallCounts("{ a <- c(1,2,3,4); b <- -1 }", "a[[b]]", 1, 0, 1, 0); + assertCallCounts("a <- c(1,2,3,4); b <- -1", "a[[b]]", 1, 0, 1, 0); assertCallCounts("a <- c(1,2,3,4)", "a[[NA_integer_]]", 1, 0, 1, 0); assertCallCounts("a <- c(1,2,3,4)", "a[[drop=T, 1]]", 0, 1, 0, 1); @@ -218,7 +218,7 @@ public class SpecialCallTest extends TestBase { assertCallCounts("a <- c(1,2,3,4)", "a[0.1] <- 1", 1, 0, 1, 1); assertCallCounts("a <- c(1,2,3,4)", "a[5] <- 1", 1, 0, 1, 1); assertCallCounts("a <- c(1,2,3,4)", "a[0] <- 1", 1, 0, 1, 1); - assertCallCounts("{ a <- c(1,2,3,4); b <- -1 }", "a[b] <- 1", 1, 0, 1, 1); + assertCallCounts("a <- c(1,2,3,4); b <- -1", "a[b] <- 1", 1, 0, 1, 1); assertCallCounts("a <- c(1,2,3,4)", "a[NA_integer_] <- 1", 1, 0, 1, 1); assertCallCounts("a <- c(1,2,3,4)", "a[-1] <- 1", 0, 2, 0, 3); // "-1" is a unary expression @@ -234,10 +234,10 @@ public class SpecialCallTest extends TestBase { assertCallCounts("a <- c(1,2,3,4)", "a[[4]] <- 1", 1, 0, 2, 0); assertCallCounts("a <- list(c(1,2,3,4),2,3)", "a[[1]] <- 1", 1, 0, 2, 0); assertCallCounts("a <- list(a=c(1,2,3,4),2,3)", "a[[1]] <- 1", 1, 0, 2, 0); - assertCallCounts("a <- c(1,2,3,4)", "a[[0.1]] <- 1", 1, 0, 2, 0); + assertCallCounts("a <- c(1,2,3,4)", "a[[0.1]] <- 1", 1, 0, 1, 1); assertCallCounts("a <- c(1,2,3,4)", "a[[5]] <- 1", 1, 0, 1, 1); assertCallCounts("a <- c(1,2,3,4)", "a[[0]] <- 1", 1, 0, 1, 1); - assertCallCounts("{ a <- c(1,2,3,4); b <- -1 }", "a[[b]] <- 1", 1, 0, 1, 1); + assertCallCounts("a <- c(1,2,3,4); b <- -1", "a[[b]] <- 1", 1, 0, 1, 1); assertCallCounts("a <- c(1,2,3,4)", "a[[NA_integer_]] <- 1", 1, 0, 1, 1); assertCallCounts("a <- c(1,2,3,4)", "a[[drop=T, 1]] <- 1", 0, 1, 0, 2); @@ -245,6 +245,16 @@ public class SpecialCallTest extends TestBase { assertCallCounts("a <- c(1,2,3,4)", "a[[1, drop=F]] <- 1", 0, 1, 0, 2); } + @Test + public void testParens() { + assertCallCounts("a <- 1", "(a)", 1, 0, 1, 0); + assertCallCounts("a <- 1", "(55)", 1, 0, 1, 0); + assertCallCounts("a <- 1", "('asdf')", 1, 0, 1, 0); + assertCallCounts("a <- 1; b <- 2", "(a + b)", 2, 0, 2, 0); + assertCallCounts("a <- 1; b <- 2; c <- 3", "a + (b + c)", 3, 0, 3, 0); + assertCallCounts("a <- 1; b <- 2; c <- 1:5", "a + (b + c)", 3, 0, 0, 3); + } + private static void assertCallCounts(String test, int initialSpecialCount, int initialNormalCount, int finalSpecialCount, int finalNormalCount) { assertCallCounts("{}", test, initialSpecialCount, initialNormalCount, finalSpecialCount, finalNormalCount); } @@ -253,7 +263,7 @@ public class SpecialCallTest extends TestBase { if (!FastROptions.UseSpecials.getBooleanValue()) { return; } - Source setupSource = Source.newBuilder(setup).mimeType(TruffleRLanguage.MIME).name("test").build(); + Source setupSource = Source.newBuilder("{" + setup + "}").mimeType(TruffleRLanguage.MIME).name("test").build(); Source testSource = Source.newBuilder(test).mimeType(TruffleRLanguage.MIME).name("test").build(); RExpression setupExpression = testVMContext.getThisEngine().parse(setupSource); diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/RASTBuilder.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/RASTBuilder.java index 4b35745a57d38575a5f0b42a2bcb630315bdc1bc..8a1e544b5231732db03711ea6fa77808327c80a9 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/RASTBuilder.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/RASTBuilder.java @@ -38,7 +38,6 @@ import com.oracle.truffle.r.nodes.control.BreakNode; import com.oracle.truffle.r.nodes.control.ForNode; import com.oracle.truffle.r.nodes.control.IfNode; import com.oracle.truffle.r.nodes.control.NextNode; -import com.oracle.truffle.r.nodes.control.ParNode; import com.oracle.truffle.r.nodes.control.RepeatNode; import com.oracle.truffle.r.nodes.control.ReplacementDispatchNode; import com.oracle.truffle.r.nodes.control.WhileNode; @@ -88,8 +87,6 @@ public final class RASTBuilder implements RCodeBuilder<RSyntaxNode> { switch (symbol) { case "repeat": return new RepeatNode(source, lhsLookup, args.get(0).value); - case "(": - return new ParNode(source, lhsLookup, args.get(0).value); } } else if (args.size() == 2) { switch (symbol) { @@ -234,6 +231,11 @@ public final class RASTBuilder implements RCodeBuilder<RSyntaxNode> { FrameDescriptor descriptor = new FrameDescriptor(); FrameSlotChangeMonitor.initializeFunctionFrameDescriptor(name != null && !name.isEmpty() ? name : "<function>", descriptor); FunctionDefinitionNode rootNode = FunctionDefinitionNode.create(source, descriptor, argSourceSections, saveArguments, body, formals, name, argPostProcess); + + if (FastROptions.ForceSources.getBooleanValue()) { + // forces source sections to be generated + rootNode.getSourceSection(); + } return Truffle.getRuntime().createCallTarget(rootNode); } diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/RRootNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/RRootNode.java index eb785b3c7cc1cda98117c71df3e407934d3390c2..929e53938623402ab75e0db4ae3dfa7b0ab7a697 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/RRootNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/RRootNode.java @@ -27,7 +27,6 @@ import com.oracle.truffle.api.frame.FrameDescriptor; import com.oracle.truffle.api.frame.VirtualFrame; import com.oracle.truffle.api.nodes.RootNode; import com.oracle.truffle.api.profiles.ConditionProfile; -import com.oracle.truffle.api.source.SourceSection; import com.oracle.truffle.r.nodes.builtin.RBuiltinFactory; import com.oracle.truffle.r.nodes.builtin.RBuiltinNode; import com.oracle.truffle.r.nodes.function.FormalArguments; @@ -54,20 +53,12 @@ public abstract class RRootNode extends RootNode implements HasSignature { private FastPathFactory fastPath; - protected RRootNode(SourceSection src, FormalArguments formalArguments, FrameDescriptor frameDescriptor, FastPathFactory fastPath) { - super(RContext.getRForeignAccessFactory().getTruffleLanguage(), checkSourceSection(src), frameDescriptor); + protected RRootNode(FormalArguments formalArguments, FrameDescriptor frameDescriptor, FastPathFactory fastPath) { + super(RContext.getRForeignAccessFactory().getTruffleLanguage(), RSyntaxNode.SOURCE_UNAVAILABLE, frameDescriptor); this.formalArguments = formalArguments; this.fastPath = fastPath; } - private static SourceSection checkSourceSection(SourceSection src) { - if (src == null) { - return RSyntaxNode.SOURCE_UNAVAILABLE; - } else { - return src; - } - } - @Override public abstract RootCallTarget duplicateWithNewFrameDescriptor(); @@ -114,4 +105,9 @@ public abstract class RRootNode extends RootNode implements HasSignature { public boolean isCloningAllowed() { return true; } + + @Override + public final String toString() { + return getName(); + } } diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/variables/ReadVariableNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/variables/ReadVariableNode.java index da099379b27d2dde035be4f0c2cd48c14c135918..cf0585f4b13e7078466524a68b3ae09b79fbbb28 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/variables/ReadVariableNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/variables/ReadVariableNode.java @@ -63,7 +63,7 @@ import com.oracle.truffle.r.runtime.data.RMissing; import com.oracle.truffle.r.runtime.data.RNull; import com.oracle.truffle.r.runtime.data.RPromise; import com.oracle.truffle.r.runtime.data.RTypedValue; -import com.oracle.truffle.r.runtime.data.RTypes; +import com.oracle.truffle.r.runtime.data.RTypesFlatLayout; import com.oracle.truffle.r.runtime.data.model.RAbstractComplexVector; import com.oracle.truffle.r.runtime.data.model.RAbstractDoubleVector; import com.oracle.truffle.r.runtime.data.model.RAbstractIntVector; @@ -85,7 +85,7 @@ import com.oracle.truffle.r.runtime.nodes.RSyntaxNode; */ public final class ReadVariableNode extends RSourceSectionNode implements RSyntaxNode, RSyntaxLookup { - private static final int MAX_INVALIDATION_COUNT = 3; + private static final int MAX_INVALIDATION_COUNT = 8; private enum ReadKind { Normal, @@ -184,20 +184,22 @@ public final class ReadVariableNode extends RSourceSectionNode implements RSynta Object result; if (read == null) { - initializeRead(frame, variableFrame); + CompilerDirectives.transferToInterpreterAndInvalidate(); + initializeRead(frame, variableFrame, false); } try { result = read.execute(frame, variableFrame); } catch (InvalidAssumptionException | LayoutChangedException | FrameSlotTypeException e) { + CompilerDirectives.transferToInterpreterAndInvalidate(); int iterations = 0; while (true) { iterations++; - initializeRead(frame, variableFrame); + initializeRead(frame, variableFrame, true); try { result = read.execute(frame, variableFrame); } catch (InvalidAssumptionException | LayoutChangedException | FrameSlotTypeException e2) { if (iterations > 10) { - throw new RInternalError("too many iterations during RVN initialization: " + identifier); + throw new RInternalError("too many iterations during RVN initialization: " + identifier + " " + e2 + " " + read + " " + getRootNode()); } continue; } @@ -217,10 +219,13 @@ public final class ReadVariableNode extends RSourceSectionNode implements RSynta return result; } - private void initializeRead(VirtualFrame frame, Frame variableFrame) { - CompilerDirectives.transferToInterpreterAndInvalidate(); - read = initialize(frame, variableFrame); - needsCopying = kind == ReadKind.Copying && !(read instanceof Match || read instanceof DescriptorStableMatch); + private synchronized void initializeRead(VirtualFrame frame, Frame variableFrame, boolean invalidate) { + CompilerAsserts.neverPartOfCompilation(); + // do nothing if another thread initialized in the meantime + if (invalidate || read == null) { + read = initialize(frame, variableFrame); + needsCopying = kind == ReadKind.Copying && !(read instanceof Match || read instanceof DescriptorStableMatch); + } } private static final class LayoutChangedException extends SlowPathException { @@ -478,27 +483,52 @@ public final class ReadVariableNode extends RSourceSectionNode implements RSynta private final class LookupLevel extends DescriptorLevel { private final LookupResult lookup; - private final ValueProfile frameProfile = ValueProfile.createClassProfile(); private final ConditionProfile nullValueProfile = kind == ReadKind.Silent ? null : ConditionProfile.createBinaryProfile(); private LookupLevel(LookupResult lookup) { this.lookup = lookup; + assert !(lookup instanceof FrameAndSlotLookupResult); } @Override public Object execute(VirtualFrame frame) throws InvalidAssumptionException, LayoutChangedException, FrameSlotTypeException { - Object value; - if (lookup instanceof FrameAndSlotLookupResult) { - FrameAndSlotLookupResult frameAndSlotLookupResult = (FrameAndSlotLookupResult) lookup; - value = profiledGetValue(seenValueKinds, frameProfile.profile(frameAndSlotLookupResult.getFrame()), frameAndSlotLookupResult.getSlot()); - } else { - value = lookup.getValue(); - } + Object value = lookup.getValue(); if (kind != ReadKind.Silent && nullValueProfile.profile(value == null)) { throw RError.error(RError.SHOW_CALLER, mode == RType.Function ? RError.Message.UNKNOWN_FUNCTION : RError.Message.UNKNOWN_OBJECT, identifier); } return value; } + + @Override + public String toString() { + return "<LU>"; + } + } + + private final class FrameAndSlotLookupLevel extends DescriptorLevel { + + private final FrameAndSlotLookupResult lookup; + private final ValueProfile frameProfile = ValueProfile.createClassProfile(); + private final ConditionProfile isNullProfile = ConditionProfile.createBinaryProfile(); + + private FrameAndSlotLookupLevel(FrameAndSlotLookupResult lookup) { + this.lookup = lookup; + } + + @Override + public Object execute(VirtualFrame frame) throws InvalidAssumptionException, LayoutChangedException, FrameSlotTypeException { + Object value = profiledGetValue(seenValueKinds, frameProfile.profile(lookup.getFrame()), lookup.getSlot()); + if (!checkType(frame, value, isNullProfile)) { + CompilerDirectives.transferToInterpreterAndInvalidate(); + throw new LayoutChangedException(); + } + return value; + } + + @Override + public String toString() { + return "<FSLU>"; + } } private FrameLevel initialize(VirtualFrame frame, Frame variableFrame) { @@ -538,8 +568,14 @@ public final class ReadVariableNode extends RSourceSectionNode implements RSynta evalPromiseSlowPathWithName(identifierAsString, frame, (RPromise) lookup.getValue()); } if (lookup != null) { - if (lookup.getValue() == null || checkTypeSlowPath(frame, lookup.getValue())) { - return new LookupLevel(lookup); + if (lookup instanceof FrameAndSlotLookupResult) { + if (checkTypeSlowPath(frame, lookup.getValue())) { + return new FrameAndSlotLookupLevel((FrameAndSlotLookupResult) lookup); + } + } else { + if (lookup.getValue() == null || checkTypeSlowPath(frame, lookup.getValue())) { + return new LookupLevel(lookup); + } } } } catch (InvalidAssumptionException e) { @@ -880,7 +916,7 @@ public final class ReadVariableNode extends RSourceSectionNode implements RSynta /* * This is RRuntime.checkType in the node form. */ -@TypeSystemReference(RTypes.class) +@TypeSystemReference(RTypesFlatLayout.class) abstract class CheckTypeNode extends RBaseNode { public abstract boolean executeBoolean(Object o); diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/binary/BinaryBooleanScalarNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/binary/BinaryBooleanScalarNode.java index 00fd37061cd9548111df37b17ddf621dea0401ca..3a3f0fe6d7477ce2aa7426dd4c7ae506f7867b8e 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/binary/BinaryBooleanScalarNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/binary/BinaryBooleanScalarNode.java @@ -23,7 +23,6 @@ package com.oracle.truffle.r.nodes.binary; import com.oracle.truffle.api.CompilerAsserts; -import com.oracle.truffle.api.CompilerDirectives; import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary; import com.oracle.truffle.api.dsl.Cached; import com.oracle.truffle.api.dsl.Fallback; @@ -65,26 +64,19 @@ public abstract class BinaryBooleanScalarNode extends RBuiltinNode { BinaryBooleanScalarNode(BooleanOperationFactory factory) { this.booleanLogic = factory.createOperation(); + logic = new BinaryMapBooleanFunctionNode(booleanLogic); + leftCast = LogicalScalarCastNodeGen.create(booleanLogic.opName(), "x", logic.getLeftNACheck()); + leftBox = BoxPrimitiveNodeGen.create(); + rightCast = LogicalScalarCastNodeGen.create(booleanLogic.opName(), "y", logic.getRightNACheck()); + rightBox = BoxPrimitiveNodeGen.create(); + promiseHelper = new PromiseCheckHelperNode(); } @Specialization protected byte binary(VirtualFrame frame, Object leftValue, Object rightValue) { - if (leftCast == null) { - CompilerDirectives.transferToInterpreterAndInvalidate(); - logic = insert(new BinaryMapBooleanFunctionNode(booleanLogic)); - leftCast = insert(LogicalScalarCastNodeGen.create(booleanLogic.opName(), "x", logic.getLeftNACheck())); - leftBox = insert(BoxPrimitiveNodeGen.create()); - } byte left = leftCast.executeCast(leftBox.execute(leftValue)); if (profile.profile(logic.requiresRightOperand(left))) { - if (rightCast == null) { - CompilerDirectives.transferToInterpreterAndInvalidate(); - rightCast = insert(LogicalScalarCastNodeGen.create(booleanLogic.opName(), "y", logic.getRightNACheck())); - rightBox = insert(BoxPrimitiveNodeGen.create()); - promiseHelper = insert(new PromiseCheckHelperNode()); - } - byte right = rightCast.executeCast(rightBox.execute(promiseHelper.checkEvaluate(frame, rightValue))); - return logic.applyLogical(left, right); + return logic.applyLogical(left, rightCast.executeCast(rightBox.execute(promiseHelper.checkEvaluate(frame, rightValue)))); } return left; } diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/builtin/RBuiltinRootNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/builtin/RBuiltinRootNode.java index ea86da6f090ada1bea4c02162a1939ddb0e4f6df..9e0044e2416661076963972c25b27bc29069cfbd 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/builtin/RBuiltinRootNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/builtin/RBuiltinRootNode.java @@ -48,7 +48,7 @@ public final class RBuiltinRootNode extends RRootNode { private final RBuiltinFactory factory; RBuiltinRootNode(RBuiltinFactory factory, RBuiltinNode builtin, FormalArguments formalArguments, FrameDescriptor frameDescriptor, FastPathFactory fastPath) { - super(null, formalArguments, frameDescriptor, fastPath); + super(formalArguments, frameDescriptor, fastPath); this.factory = factory; this.builtin = builtin; this.args = new AccessArgumentNode[factory.getSignature().getLength()]; @@ -89,7 +89,7 @@ public final class RBuiltinRootNode extends RRootNode { throw new RInternalError(e, "internal error"); } finally { visibility.execute(frame, factory.getVisibility()); - visibility.executeEndOfFunction(frame); + visibility.executeEndOfFunction(frame, this); } } @@ -121,9 +121,4 @@ public final class RBuiltinRootNode extends RRootNode { public String getName() { return "RBuiltin(" + builtin + ")"; } - - @Override - public String toString() { - return getName(); - } } diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/control/ParNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/control/ParNode.java deleted file mode 100644 index ba7c6cf1f0794ea981d138894c8350c3f87ef35e..0000000000000000000000000000000000000000 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/control/ParNode.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.oracle.truffle.r.nodes.control; - -import com.oracle.truffle.api.frame.VirtualFrame; -import com.oracle.truffle.api.source.SourceSection; -import com.oracle.truffle.r.nodes.function.visibility.SetVisibilityNode; -import com.oracle.truffle.r.runtime.ArgumentsSignature; -import com.oracle.truffle.r.runtime.nodes.RNode; -import com.oracle.truffle.r.runtime.nodes.RSyntaxLookup; -import com.oracle.truffle.r.runtime.nodes.RSyntaxNode; - -/** - * A {@link ParNode} represents parentheses in source code. - */ -public final class ParNode extends OperatorNode { - - @Child private RNode value; - @Child private SetVisibilityNode visibility = SetVisibilityNode.create(); - - public ParNode(SourceSection src, RSyntaxLookup operator, RSyntaxNode value) { - super(src, operator); - this.value = value.asRNode(); - } - - @Override - public Object execute(VirtualFrame frame) { - try { - return value.execute(frame); - } finally { - visibility.execute(frame, true); - } - } - - @Override - public void voidExecute(VirtualFrame frame) { - value.voidExecute(frame); - } - - @Override - public RSyntaxNode[] getSyntaxArguments() { - return new RSyntaxNode[]{value.asRSyntaxNode()}; - } - - @Override - public ArgumentsSignature getSyntaxSignature() { - return ArgumentsSignature.empty(1); - } -} diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/control/ReplacementDispatchNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/control/ReplacementDispatchNode.java index 656bb60251dcb3dce02e777cbf5a03097e58f4ad..144d1200fdcce2011999435a3a09005abb38332c 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/control/ReplacementDispatchNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/control/ReplacementDispatchNode.java @@ -84,7 +84,7 @@ public final class ReplacementDispatchNode extends OperatorNode { public RNode create(boolean isVoid) { RNode replacement; - if (lhs instanceof RSyntaxCall) { + if (lhs.asRSyntaxNode() instanceof RSyntaxCall) { replacement = createReplacementNode(isVoid); } else { replacement = new WriteVariableSyntaxNode(getLazySourceSection(), operator, lhs.asRSyntaxNode(), rhs, isSuper); diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/ArgumentStatePush.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/ArgumentStatePush.java index 3e3347bf7972c9421593be2388be054e9a88a0bc..6100faa0f41002be34f10714130b93693fffade9 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/ArgumentStatePush.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/ArgumentStatePush.java @@ -24,25 +24,33 @@ package com.oracle.truffle.r.nodes.function; import com.oracle.truffle.api.CompilerDirectives; import com.oracle.truffle.api.CompilerDirectives.CompilationFinal; +import com.oracle.truffle.api.dsl.Cached; import com.oracle.truffle.api.dsl.Specialization; +import com.oracle.truffle.api.dsl.TypeSystemReference; import com.oracle.truffle.api.frame.VirtualFrame; import com.oracle.truffle.api.nodes.Node; import com.oracle.truffle.api.profiles.ConditionProfile; +import com.oracle.truffle.r.nodes.EmptyTypeSystemFlatLayout; import com.oracle.truffle.r.nodes.access.WriteLocalFrameVariableNode; import com.oracle.truffle.r.runtime.FastROptions; import com.oracle.truffle.r.runtime.RArguments; +import com.oracle.truffle.r.runtime.RInternalError; import com.oracle.truffle.r.runtime.data.RFunction; import com.oracle.truffle.r.runtime.data.RLanguage; import com.oracle.truffle.r.runtime.data.RShareable; +import com.oracle.truffle.r.runtime.data.RSharingAttributeStorage; import com.oracle.truffle.r.runtime.data.model.RAbstractContainer; /** * A {@link ArgumentStatePush} is used to bump up state transition for function arguments. */ +@TypeSystemReference(EmptyTypeSystemFlatLayout.class) public abstract class ArgumentStatePush extends Node { public abstract void executeObject(VirtualFrame frame, Object shareable); + @Child private WriteLocalFrameVariableNode write; + private final ConditionProfile isRefCountUpdateable = ConditionProfile.createBinaryProfile(); private final int index; @@ -57,76 +65,59 @@ public abstract class ArgumentStatePush extends Node { this.index = index; } - public boolean refCounted() { - return mask > 0; + protected int createWriteArgMask(VirtualFrame frame, RShareable shareable) { + if (shareable instanceof RAbstractContainer) { + if (shareable instanceof RLanguage || ((RAbstractContainer) shareable).getLength() < REF_COUNT_SIZE_THRESHOLD) { + // don't decrement ref count for small objects or language objects- this + // is pretty conservative and can be further finessed + return -1; + } + } + RFunction fun = RArguments.getFunction(frame); + if (fun == null) { + return -1; + } + Object root = fun.getRootNode(); + if (!(root instanceof FunctionDefinitionNode)) { + // root is RBuiltinRootNode + return -1; + } + FunctionDefinitionNode fdn = (FunctionDefinitionNode) root; + PostProcessArgumentsNode postProcessNode = fdn.getArgPostProcess(); + if (postProcessNode == null) { + // arguments to this function are not to be reference counted + return -1; + } + if (!postProcessNode.updateBits(index)) { + // this will fail if the index is too big + return -1; + } + return 1 << index; } @Specialization - public void transitionState(VirtualFrame frame, RShareable shareable) { + public void transitionState(VirtualFrame frame, RSharingAttributeStorage shareable, + @Cached("createWriteArgMask(frame, shareable)") int writeArgMask) { if (isRefCountUpdateable.profile(!shareable.isSharedPermanent())) { shareable.incRefCount(); - if (!FastROptions.RefCountIncrementOnly.getBooleanValue()) { - if (mask == 0) { + if (writeArgMask != -1 && !FastROptions.RefCountIncrementOnly.getBooleanValue()) { + if (write == null) { CompilerDirectives.transferToInterpreterAndInvalidate(); - if (shareable instanceof RAbstractContainer) { - if (shareable instanceof RLanguage || ((RAbstractContainer) shareable).getLength() < REF_COUNT_SIZE_THRESHOLD) { - // don't decrement ref count for small objects or language objects- this - // is - // pretty conservative and can be further finessed - mask = -1; - return; - } - } - RFunction fun = RArguments.getFunction(frame); - if (fun == null) { - mask = -1; - return; - } - Object root = fun.getRootNode(); - if (!(root instanceof FunctionDefinitionNode)) { - // root is RBuiltinRootNode - mask = -1; - return; - } - FunctionDefinitionNode fdn = (FunctionDefinitionNode) root; - PostProcessArgumentsNode postProcessNode = fdn.getArgPostProcess(); - if (postProcessNode == null) { - // arguments to this function are not to be reference counted - mask = -1; - return; - } - // this is needed for when FunctionDefinitionNode is split by the Truffle - // runtime - postProcessNode = postProcessNode.getActualNode(); - if (index >= Math.min(postProcessNode.getLength(), MAX_COUNTED_ARGS)) { - mask = -1; - return; - } - mask = 1 << index; - int transArgsBitSet = postProcessNode.transArgsBitSet; - postProcessNode.transArgsBitSet = transArgsBitSet | mask; - writeArgNode = insert(WriteLocalFrameVariableNode.createForRefCount(Integer.valueOf(mask))); - } - if (mask != -1) { - writeArgNode.execute(frame, shareable); + write = insert(WriteLocalFrameVariableNode.createForRefCount(Integer.valueOf(writeArgMask))); } + write.execute(frame, shareable); } } } + @Specialization + public void transitionState(RShareable shareable) { + throw RInternalError.shouldNotReachHere("unexpected RShareable that is not RSharingAttributeStorage: " + shareable.getClass()); + } + @Specialization(guards = "!isShareable(o)") - public void transitionStateNonShareable(VirtualFrame frame, @SuppressWarnings("unused") Object o) { - if (mask > 0) { - // this argument used to be reference counted but is no longer - CompilerDirectives.transferToInterpreterAndInvalidate(); - RFunction fun = RArguments.getFunction(frame); - assert fun != null; - FunctionDefinitionNode fdn = (FunctionDefinitionNode) fun.getRootNode(); - assert fdn != null; - int transArgsBitSet = fdn.getArgPostProcess().transArgsBitSet; - fdn.getArgPostProcess().transArgsBitSet = transArgsBitSet & (~mask); - mask = -1; - } + public void transitionStateNonShareable(@SuppressWarnings("unused") Object o) { + // do nothing } protected boolean isShareable(Object o) { diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/CallArgumentsNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/CallArgumentsNode.java index 6359e94caa2fbf0e94bdf95af98c5b7dc4633ace..818244e964bd14a74c07476e39b4bb09d00706fa 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/CallArgumentsNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/CallArgumentsNode.java @@ -161,8 +161,18 @@ public final class CallArgumentsNode extends RBaseNode implements UnmatchedArgum return Arguments.create(values, ArgumentsSignature.get(newNames)); } - private ArgumentsSignature cachedVarArgsSignature; - private ArgumentsSignature cachedResultSignature; + private static final class CachedSignature { + private final ArgumentsSignature signature; + private final ArgumentsSignature resultSignature; + + protected CachedSignature(ArgumentsSignature signature, ArgumentsSignature resultSignature) { + this.signature = signature; + this.resultSignature = resultSignature; + } + } + + private CachedSignature cachedVarArgsSignature; + private final BranchProfile regenerateSignatureProfile = BranchProfile.create(); public ArgumentsSignature flattenNames(RArgsValuesAndNames varArgs) { @@ -170,15 +180,15 @@ public final class CallArgumentsNode extends RBaseNode implements UnmatchedArgum return signature; } ArgumentsSignature varArgsSignature = varArgs.getSignature(); - if (cachedVarArgsSignature == null) { + CachedSignature cached = cachedVarArgsSignature; + if (cached == null) { CompilerDirectives.transferToInterpreter(); } - if (varArgsSignature == cachedVarArgsSignature) { - return cachedResultSignature; + if (cached == null || varArgsSignature != cached.signature) { + regenerateSignatureProfile.enter(); + cachedVarArgsSignature = cached = new CachedSignature(varArgsSignature, flattenNamesInternal(varArgsSignature)); } - regenerateSignatureProfile.enter(); - cachedVarArgsSignature = varArgsSignature; - return cachedResultSignature = flattenNamesInternal(varArgsSignature); + return cached.resultSignature; } @TruffleBoundary diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/CallMatcherNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/CallMatcherNode.java index 9454d1b46b985707c8c836d1c714a9b1b86936e3..e034cfa67da52aab6d8a18ab88da0b95344e6a95 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/CallMatcherNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/CallMatcherNode.java @@ -60,7 +60,7 @@ public abstract class CallMatcherNode extends RBaseNode { private static final int MAX_CACHE_DEPTH = 3; public static CallMatcherNode create(boolean argsAreEvaluated) { - return new CallMatcherUninitializedNode(argsAreEvaluated); + return new CallMatcherUninitializedNode(argsAreEvaluated, 0); } public abstract Object execute(VirtualFrame frame, ArgumentsSignature suppliedSignature, Object[] suppliedArguments, RFunction function, String functionName, DispatchArgs dispatchArgs); @@ -151,19 +151,20 @@ public abstract class CallMatcherNode extends RBaseNode { @NodeInfo(cost = NodeCost.UNINITIALIZED) private static final class CallMatcherUninitializedNode extends CallMatcherNode { - CallMatcherUninitializedNode(boolean argsAreEvaluated) { + CallMatcherUninitializedNode(boolean argsAreEvaluated, int depth) { super(argsAreEvaluated); + this.depth = depth; } - private int depth; + private final int depth; @Override public Object execute(VirtualFrame frame, ArgumentsSignature suppliedSignature, Object[] suppliedArguments, RFunction function, String functionName, DispatchArgs dispatchArgs) { CompilerDirectives.transferToInterpreterAndInvalidate(); - if (++depth > MAX_CACHE_DEPTH) { + if (depth > MAX_CACHE_DEPTH) { return replace(new CallMatcherGenericNode(argsAreEvaluated)).execute(frame, suppliedSignature, suppliedArguments, function, functionName, dispatchArgs); } else { - CallMatcherCachedNode cachedNode = replace(specialize(suppliedSignature, suppliedArguments, function, this)); + CallMatcherCachedNode cachedNode = replace(specialize(suppliedSignature, suppliedArguments, function, new CallMatcherUninitializedNode(argsAreEvaluated, depth + 1))); // for splitting if necessary if (cachedNode.call != null && RCallNode.needsSplitting(function.getTarget())) { cachedNode.call.getCallNode().cloneCallTarget(); diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/FunctionDefinitionNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/FunctionDefinitionNode.java index 4a2c89ad48a62fc5debd7c6be8f4bb3ca2864f8e..e2019c4c78506fca390f3b711385e08ee8b1d999 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/FunctionDefinitionNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/FunctionDefinitionNode.java @@ -25,11 +25,14 @@ package com.oracle.truffle.r.nodes.function; import java.util.ArrayList; import java.util.List; +import com.oracle.truffle.api.Assumption; import com.oracle.truffle.api.CompilerDirectives; import com.oracle.truffle.api.CompilerDirectives.CompilationFinal; import com.oracle.truffle.api.RootCallTarget; +import com.oracle.truffle.api.Truffle; import com.oracle.truffle.api.frame.FrameDescriptor; import com.oracle.truffle.api.frame.FrameSlot; +import com.oracle.truffle.api.frame.FrameSlotKind; import com.oracle.truffle.api.frame.FrameSlotTypeException; import com.oracle.truffle.api.frame.VirtualFrame; import com.oracle.truffle.api.nodes.Node; @@ -101,28 +104,22 @@ public final class FunctionDefinitionNode extends RRootNode implements RSyntaxNo private final BranchProfile breakProfile = BranchProfile.create(); private final BranchProfile nextProfile = BranchProfile.create(); - @CompilationFinal private BranchProfile invalidateFrameSlotProfile; - // S3/S4 slots - @Child private FrameSlotNode dotGenericSlot; - @Child private FrameSlotNode dotMethodSlot; - // S3 slots - @Child private FrameSlotNode dotClassSlot; - @Child private FrameSlotNode dotGenericCallEnvSlot; - @Child private FrameSlotNode dotGenericCallDefSlot; - @Child private FrameSlotNode dotGroupSlot; - // S4 slots - @Child private FrameSlotNode dotDefinedSlot; - @Child private FrameSlotNode dotTargetSlot; - @Child private FrameSlotNode dotMethodsSlot; - @Child private SetVisibilityNode visibility = SetVisibilityNode.create(); @Child private PostProcessArgumentsNode argPostProcess; + @Child private SetupS3ArgsNode setupS3Args; + @Child private SetupS4ArgsNode setupS4Args; + private final boolean needsSplitting; @CompilationFinal private boolean containsDispatch; + private final Assumption noHandlerStackSlot = Truffle.getRuntime().createAssumption(); + private final Assumption noRestartStackSlot = Truffle.getRuntime().createAssumption(); + @CompilationFinal private FrameSlot handlerStackSlot; + @CompilationFinal private FrameSlot restartStackSlot; + /** * Profiling for catching {@link ReturnException}s. */ @@ -135,7 +132,7 @@ public final class FunctionDefinitionNode extends RRootNode implements RSyntaxNo private FunctionDefinitionNode(SourceSection src, FrameDescriptor frameDesc, SourceSection[] argSourceSections, RNode saveArguments, RSyntaxNode body, FormalArguments formals, String name, PostProcessArgumentsNode argPostProcess) { - super(null, formals, frameDesc, RASTBuilder.createFunctionFastPath(body, formals.getSignature())); + super(formals, frameDesc, RASTBuilder.createFunctionFastPath(body, formals.getSignature())); this.argSourceSections = argSourceSections; assert FrameSlotChangeMonitor.isValidFrameDescriptor(frameDesc); assert src != null; @@ -239,12 +236,6 @@ public final class FunctionDefinitionNode extends RRootNode implements RSyntaxNo @Override public Object execute(VirtualFrame frame) { - /* - * It might be possible to only record this iff a handler is installed, by using the - * RArguments array. - */ - Object handlerStack = RErrorHandling.getHandlerStack(); - Object restartStack = RErrorHandling.getRestartStack(); boolean runOnExitHandlers = true; try { verifyEnclosingAssumptions(frame); @@ -288,13 +279,27 @@ public final class FunctionDefinitionNode extends RRootNode implements RSyntaxNo * has no exit handlers (by fiat), so any exceptions from onExits handlers will be * caught above. */ - visibility.executeEndOfFunction(frame); + visibility.executeEndOfFunction(frame, this); if (argPostProcess != null) { resetArgs.enter(); argPostProcess.execute(frame); } if (runOnExitHandlers) { - RErrorHandling.restoreStacks(handlerStack, restartStack); + if (!noHandlerStackSlot.isValid() && frame.isObject(handlerStackSlot)) { + try { + RErrorHandling.restoreHandlerStack(frame.getObject(handlerStackSlot)); + } catch (FrameSlotTypeException e) { + throw RInternalError.shouldNotReachHere(); + } + } + if (!noRestartStackSlot.isValid() && frame.isObject(restartStackSlot)) { + try { + RErrorHandling.restoreRestartStack(frame.getObject(restartStackSlot)); + } catch (FrameSlotTypeException e) { + throw RInternalError.shouldNotReachHere(); + } + } + if (onExitProfile.profile(onExitSlot.hasValue(frame))) { if (onExitExpressionCache == null) { CompilerDirectives.transferToInterpreterAndInvalidate(); @@ -317,55 +322,88 @@ public final class FunctionDefinitionNode extends RRootNode implements RSyntaxNo } } + private abstract static class SetupDispatchNode extends Node { + // S3/S4 slots + private final FrameSlot dotGenericSlot; + private final FrameSlot dotMethodSlot; + + final BranchProfile invalidateFrameSlotProfile = BranchProfile.create(); + + SetupDispatchNode(FrameDescriptor frameDescriptor) { + dotGenericSlot = FrameSlotChangeMonitor.findOrAddFrameSlot(frameDescriptor, RRuntime.R_DOT_GENERIC, FrameSlotKind.Object); + dotMethodSlot = FrameSlotChangeMonitor.findOrAddFrameSlot(frameDescriptor, RRuntime.R_DOT_METHOD, FrameSlotKind.Object); + } + + void execute(VirtualFrame frame, DispatchArgs args) { + FrameSlotChangeMonitor.setObjectAndInvalidate(frame, dotGenericSlot, args.generic, false, invalidateFrameSlotProfile); + FrameSlotChangeMonitor.setObjectAndInvalidate(frame, dotMethodSlot, args.method, false, invalidateFrameSlotProfile); + } + } + + private static final class SetupS3ArgsNode extends SetupDispatchNode { + // S3 slots + private final FrameSlot dotClassSlot; + private final FrameSlot dotGenericCallEnvSlot; + private final FrameSlot dotGenericCallDefSlot; + private final FrameSlot dotGroupSlot; + + SetupS3ArgsNode(FrameDescriptor frameDescriptor) { + super(frameDescriptor); + dotClassSlot = FrameSlotChangeMonitor.findOrAddFrameSlot(frameDescriptor, RRuntime.R_DOT_CLASS, FrameSlotKind.Object); + dotGenericCallEnvSlot = FrameSlotChangeMonitor.findOrAddFrameSlot(frameDescriptor, RRuntime.R_DOT_GENERIC_CALL_ENV, FrameSlotKind.Object); + dotGenericCallDefSlot = FrameSlotChangeMonitor.findOrAddFrameSlot(frameDescriptor, RRuntime.R_DOT_GENERIC_DEF_ENV, FrameSlotKind.Object); + dotGroupSlot = FrameSlotChangeMonitor.findOrAddFrameSlot(frameDescriptor, RRuntime.R_DOT_GROUP, FrameSlotKind.Object); + } + + void execute(VirtualFrame frame, S3Args args) { + super.execute(frame, args); + FrameSlotChangeMonitor.setObjectAndInvalidate(frame, dotClassSlot, args.clazz, false, invalidateFrameSlotProfile); + FrameSlotChangeMonitor.setObjectAndInvalidate(frame, dotGenericCallEnvSlot, args.callEnv, false, invalidateFrameSlotProfile); + FrameSlotChangeMonitor.setObjectAndInvalidate(frame, dotGenericCallDefSlot, args.defEnv, false, invalidateFrameSlotProfile); + FrameSlotChangeMonitor.setObjectAndInvalidate(frame, dotGroupSlot, args.group, false, invalidateFrameSlotProfile); + } + } + + private static final class SetupS4ArgsNode extends SetupDispatchNode { + // S4 slots + private final FrameSlot dotDefinedSlot; + private final FrameSlot dotTargetSlot; + private final FrameSlot dotMethodsSlot; + + SetupS4ArgsNode(FrameDescriptor frameDescriptor) { + super(frameDescriptor); + dotDefinedSlot = FrameSlotChangeMonitor.findOrAddFrameSlot(frameDescriptor, RRuntime.R_DOT_DEFINED, FrameSlotKind.Object); + dotTargetSlot = FrameSlotChangeMonitor.findOrAddFrameSlot(frameDescriptor, RRuntime.R_DOT_TARGET, FrameSlotKind.Object); + dotMethodsSlot = FrameSlotChangeMonitor.findOrAddFrameSlot(frameDescriptor, RRuntime.R_DOT_METHODS, FrameSlotKind.Object); + } + + void execute(VirtualFrame frame, S4Args args) { + super.execute(frame, args); + FrameSlotChangeMonitor.setObjectAndInvalidate(frame, dotDefinedSlot, args.defined, false, invalidateFrameSlotProfile); + FrameSlotChangeMonitor.setObjectAndInvalidate(frame, dotTargetSlot, args.target, false, invalidateFrameSlotProfile); + FrameSlotChangeMonitor.setObjectAndInvalidate(frame, dotMethodsSlot, args.methods, false, invalidateFrameSlotProfile); + } + } + private void setupDispatchSlots(VirtualFrame frame) { DispatchArgs dispatchArgs = RArguments.getDispatchArgs(frame); if (dispatchArgs == null) { return; } - if (dotGenericSlot == null) { - CompilerDirectives.transferToInterpreterAndInvalidate(); - assert invalidateFrameSlotProfile == null && dotMethodSlot == null; - invalidateFrameSlotProfile = BranchProfile.create(); - FrameDescriptor frameDescriptor = frame.getFrameDescriptor(); - - dotGenericSlot = insert(FrameSlotNode.createInitialized(frameDescriptor, RRuntime.R_DOT_GENERIC, true)); - dotMethodSlot = insert(FrameSlotNode.createInitialized(frameDescriptor, RRuntime.R_DOT_METHOD, true)); - } - FrameSlotChangeMonitor.setObjectAndInvalidate(frame, dotGenericSlot.executeFrameSlot(frame), dispatchArgs.generic, false, invalidateFrameSlotProfile); - FrameSlotChangeMonitor.setObjectAndInvalidate(frame, dotMethodSlot.executeFrameSlot(frame), dispatchArgs.method, false, invalidateFrameSlotProfile); - if (dispatchArgs instanceof S3Args) { S3Args s3Args = (S3Args) dispatchArgs; - if (dotClassSlot == null) { + if (setupS3Args == null) { CompilerDirectives.transferToInterpreterAndInvalidate(); - assert dotGenericCallEnvSlot == null && dotGenericCallDefSlot == null && dotGroupSlot == null; - invalidateFrameSlotProfile = BranchProfile.create(); - FrameDescriptor frameDescriptor = frame.getFrameDescriptor(); - - dotClassSlot = insert(FrameSlotNode.createInitialized(frameDescriptor, RRuntime.R_DOT_CLASS, true)); - dotGenericCallEnvSlot = insert(FrameSlotNode.createInitialized(frameDescriptor, RRuntime.R_DOT_GENERIC_CALL_ENV, true)); - dotGenericCallDefSlot = insert(FrameSlotNode.createInitialized(frameDescriptor, RRuntime.R_DOT_GENERIC_DEF_ENV, true)); - dotGroupSlot = insert(FrameSlotNode.createInitialized(frameDescriptor, RRuntime.R_DOT_GROUP, true)); + setupS3Args = insert(new SetupS3ArgsNode(frame.getFrameDescriptor())); } - FrameSlotChangeMonitor.setObjectAndInvalidate(frame, dotClassSlot.executeFrameSlot(frame), s3Args.clazz, false, invalidateFrameSlotProfile); - FrameSlotChangeMonitor.setObjectAndInvalidate(frame, dotGenericCallEnvSlot.executeFrameSlot(frame), s3Args.callEnv, false, invalidateFrameSlotProfile); - FrameSlotChangeMonitor.setObjectAndInvalidate(frame, dotGenericCallDefSlot.executeFrameSlot(frame), s3Args.defEnv, false, invalidateFrameSlotProfile); - FrameSlotChangeMonitor.setObjectAndInvalidate(frame, dotGroupSlot.executeFrameSlot(frame), s3Args.group, false, invalidateFrameSlotProfile); + setupS3Args.execute(frame, s3Args); } else { S4Args s4Args = (S4Args) dispatchArgs; - if (dotDefinedSlot == null) { + if (setupS4Args == null) { CompilerDirectives.transferToInterpreterAndInvalidate(); - assert dotTargetSlot == null && dotMethodsSlot == null; - invalidateFrameSlotProfile = BranchProfile.create(); - FrameDescriptor frameDescriptor = frame.getFrameDescriptor(); - - dotDefinedSlot = insert(FrameSlotNode.createInitialized(frameDescriptor, RRuntime.R_DOT_DEFINED, true)); - dotTargetSlot = insert(FrameSlotNode.createInitialized(frameDescriptor, RRuntime.R_DOT_TARGET, true)); - dotMethodsSlot = insert(FrameSlotNode.createInitialized(frameDescriptor, RRuntime.R_DOT_METHODS, true)); + setupS4Args = insert(new SetupS4ArgsNode(frame.getFrameDescriptor())); } - FrameSlotChangeMonitor.setObjectAndInvalidate(frame, dotDefinedSlot.executeFrameSlot(frame), s4Args.defined, false, invalidateFrameSlotProfile); - FrameSlotChangeMonitor.setObjectAndInvalidate(frame, dotTargetSlot.executeFrameSlot(frame), s4Args.target, false, invalidateFrameSlotProfile); - FrameSlotChangeMonitor.setObjectAndInvalidate(frame, dotMethodsSlot.executeFrameSlot(frame), s4Args.methods, false, invalidateFrameSlotProfile); + setupS4Args.execute(frame, s4Args); } } @@ -383,11 +421,6 @@ public final class FunctionDefinitionNode extends RRootNode implements RSyntaxNo return name == null ? "<no source>" : name; } - @Override - public String toString() { - return getName(); - } - public void setName(String name) { this.name = name; } @@ -437,4 +470,24 @@ public final class FunctionDefinitionNode extends RRootNode implements RSyntaxNo public String getSyntaxDebugName() { return name; } + + public FrameSlot getRestartFrameSlot(VirtualFrame frame) { + if (noRestartStackSlot.isValid()) { + CompilerDirectives.transferToInterpreterAndInvalidate(); + restartStackSlot = frame.getFrameDescriptor().findOrAddFrameSlot(RFrameSlot.RestartStack); + noRestartStackSlot.invalidate(); + } + assert restartStackSlot != null; + return restartStackSlot; + } + + public FrameSlot getHandlerFrameSlot(VirtualFrame frame) { + if (noHandlerStackSlot.isValid()) { + CompilerDirectives.transferToInterpreterAndInvalidate(); + handlerStackSlot = frame.getFrameDescriptor().findOrAddFrameSlot(RFrameSlot.HandlerStack); + noHandlerStackSlot.invalidate(); + } + assert handlerStackSlot != null; + return handlerStackSlot; + } } diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/FunctionExpressionNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/FunctionExpressionNode.java index e0c9f9eb525f116bfd2cf38921a8320f3e12bfb0..cc6676d89f3499383915a05d82b9a91b50f5cb78 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/FunctionExpressionNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/FunctionExpressionNode.java @@ -32,6 +32,7 @@ import com.oracle.truffle.r.nodes.RASTUtils; import com.oracle.truffle.r.nodes.RRootNode; import com.oracle.truffle.r.nodes.function.PromiseHelperNode.PromiseDeoptimizeFrameNode; import com.oracle.truffle.r.nodes.function.opt.EagerEvalHelper; +import com.oracle.truffle.r.nodes.function.visibility.SetVisibilityNode; import com.oracle.truffle.r.nodes.instrumentation.RInstrumentation; import com.oracle.truffle.r.runtime.ArgumentsSignature; import com.oracle.truffle.r.runtime.builtins.FastPathFactory; @@ -49,6 +50,8 @@ public final class FunctionExpressionNode extends RSourceSectionNode implements return new FunctionExpressionNode(src, callTarget); } + @Child private SetVisibilityNode visibility = SetVisibilityNode.create(); + @CompilationFinal private RootCallTarget callTarget; private final PromiseDeoptimizeFrameNode deoptFrameNode; @CompilationFinal private FastPathFactory fastPath; @@ -68,6 +71,7 @@ public final class FunctionExpressionNode extends RSourceSectionNode implements @Override public RFunction executeFunction(VirtualFrame frame) { + visibility.execute(frame, true); MaterializedFrame matFrame = frame.materialize(); if (deoptFrameNode != null) { // Deoptimize every promise which is now in this frame, as it might leave it's stack diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/PostProcessArgumentsNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/PostProcessArgumentsNode.java index 70c054c22da7929dfaac6ae718dd7b1af33e3650..e808377fefc5bedf97ad147c5d5950c6cfbd272a 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/PostProcessArgumentsNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/PostProcessArgumentsNode.java @@ -22,13 +22,11 @@ */ package com.oracle.truffle.r.nodes.function; -import com.oracle.truffle.api.CompilerAsserts; import com.oracle.truffle.api.CompilerDirectives; -import com.oracle.truffle.api.CompilerDirectives.CompilationFinal; import com.oracle.truffle.api.frame.VirtualFrame; import com.oracle.truffle.api.nodes.ExplodeLoop; -import com.oracle.truffle.api.nodes.Node; import com.oracle.truffle.api.profiles.ConditionProfile; +import com.oracle.truffle.api.utilities.AssumedValue; import com.oracle.truffle.r.nodes.access.variables.LocalReadVariableNode; import com.oracle.truffle.r.runtime.data.RNull; import com.oracle.truffle.r.runtime.data.RShareable; @@ -41,28 +39,20 @@ import com.oracle.truffle.r.runtime.nodes.RNode; public final class PostProcessArgumentsNode extends RNode { @Children private final LocalReadVariableNode[] sequence; - @Child private PostProcessArgumentsNode nextOptPostProccessArgNode; - @CompilationFinal int transArgsBitSet; - // the first time this node is cloned (via FunctionDefinitionNode) it's from the trufflerizer - - // in this case we should not create the node chain chain in the clone operation (below) at the - // reference count meta data needs to be associated with this node and not its clone - @CompilationFinal private boolean createClone; + // stays the same during cloning + private final AssumedValue<Integer> transArgsBitSet; + + private final ConditionProfile isNonNull = ConditionProfile.createBinaryProfile(); private final ConditionProfile isRefCountUpdateable = ConditionProfile.createBinaryProfile(); - private PostProcessArgumentsNode(LocalReadVariableNode[] sequence) { - this.sequence = sequence; - this.createClone = false; - this.transArgsBitSet = 0; + private PostProcessArgumentsNode(int length) { + this.sequence = new LocalReadVariableNode[Math.min(length, ArgumentStatePush.MAX_COUNTED_ARGS)]; + this.transArgsBitSet = new AssumedValue<>("PostProcessArgumentsNode.transArgsBitSet", 0); } public static PostProcessArgumentsNode create(int length) { - int maxLength = Math.min(length, ArgumentStatePush.MAX_COUNTED_ARGS); - LocalReadVariableNode[] argReadNodes = new LocalReadVariableNode[maxLength]; - for (int i = 0; i < maxLength; i++) { - argReadNodes[i] = LocalReadVariableNode.create(Integer.valueOf(1 << i), false); - } - return new PostProcessArgumentsNode(argReadNodes); + return new PostProcessArgumentsNode(length); } public int getLength() { @@ -72,20 +62,20 @@ public final class PostProcessArgumentsNode extends RNode { @Override @ExplodeLoop public Object execute(VirtualFrame frame) { - if (transArgsBitSet > 0) { + int bits = transArgsBitSet.get(); + if (bits != 0) { for (int i = 0; i < sequence.length; i++) { int mask = 1 << i; - if ((transArgsBitSet & mask) == mask) { - RShareable s = (RShareable) sequence[i].execute(frame); - if (s == null) { - // it happens rarely in compiled code, but if it does happen, stop - // decrementing reference counts + if ((bits & mask) != 0) { + if (sequence[i] == null) { CompilerDirectives.transferToInterpreterAndInvalidate(); - transArgsBitSet = ArgumentStatePush.INVALID_INDEX; - break; + sequence[i] = insert(LocalReadVariableNode.create(Integer.valueOf(mask), false)); } - if (isRefCountUpdateable.profile(!s.isSharedPermanent())) { - s.decRefCount(); + RShareable s = (RShareable) sequence[i].execute(frame); + if (isNonNull.profile(s != null)) { + if (isRefCountUpdateable.profile(!s.isSharedPermanent())) { + s.decRefCount(); + } } } } @@ -93,38 +83,15 @@ public final class PostProcessArgumentsNode extends RNode { return RNull.instance; } - @Override - public Node deepCopy() { - CompilerAsserts.neverPartOfCompilation(); - if (createClone) { - return deepCopyUnconditional(); - } else { - this.createClone = true; - return this; - } - } - - /* - * Deep copies are also made from other places than the trufflerizer, in which case we need to - * always create the node chain. - */ - private PostProcessArgumentsNode deepCopyUnconditional() { - CompilerAsserts.neverPartOfCompilation(); - PostProcessArgumentsNode copy = (PostProcessArgumentsNode) super.deepCopy(); - nextOptPostProccessArgNode = insert(copy); - return copy; - - } - - PostProcessArgumentsNode getActualNode() { - CompilerAsserts.neverPartOfCompilation(); - if (nextOptPostProccessArgNode == null) { - return this; - } else { - PostProcessArgumentsNode nextNode = nextOptPostProccessArgNode.getActualNode(); - // shorten up the lookup chain - nextOptPostProccessArgNode = insert(nextNode); - return nextNode; + public boolean updateBits(int index) { + if (index < sequence.length) { + int bits = transArgsBitSet.get(); + int newBits = bits | (1 << index); + if (newBits != bits) { + transArgsBitSet.set(newBits); + } + return true; } + return false; } } diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/PromiseNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/PromiseNode.java index c46789e565ff14114ae83507b1e84a267fab3d1d..e9a22756634aa1683cf6ee0403f0649c818f0869 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/PromiseNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/PromiseNode.java @@ -409,8 +409,17 @@ public abstract class PromiseNode extends RNode { private final ConditionProfile argsValueAndNamesProfile = ConditionProfile.createBinaryProfile(); private final ConditionProfile containsVarargProfile = ConditionProfile.createBinaryProfile(); - @CompilationFinal ArgumentsSignature cachedVarArgSignature; - @CompilationFinal ArgumentsSignature cachedResultSignature; + private static final class Cache { + private final ArgumentsSignature signature; + private final ArgumentsSignature result; + + protected Cache(ArgumentsSignature signature, ArgumentsSignature result) { + this.signature = signature; + this.result = result; + } + } + + @CompilationFinal private Cache varArgsCache; InlineVarArgsNode(RNode[] nodes, ArgumentsSignature signature) { this.varargs = nodes; @@ -455,13 +464,20 @@ public abstract class PromiseNode extends RNode { if (evaluatedArgs.length == 1) { finalSignature = ((RArgsValuesAndNames) evaluatedArgs[0]).getSignature(); } else { - if (cachedVarArgSignature == ArgumentsSignature.INVALID_SIGNATURE) { + Cache cache = varArgsCache; + if (cache == null) { + CompilerDirectives.transferToInterpreterAndInvalidate(); + finalSignature = createSignature(evaluatedArgs, flattenedArgs.length); + varArgsCache = new Cache(varArgSignature, finalSignature); + } else if (cache.signature == ArgumentsSignature.INVALID_SIGNATURE) { finalSignature = createSignature(evaluatedArgs, flattenedArgs.length); - } else if (varArgSignature == cachedVarArgSignature) { - finalSignature = cachedResultSignature; + } else if (varArgSignature == cache.signature) { + finalSignature = cache.result; } else { + CompilerDirectives.transferToInterpreterAndInvalidate(); + // fallback to the generic case finalSignature = createSignature(evaluatedArgs, flattenedArgs.length); - cachedVarArgSignature = cachedVarArgSignature == null ? finalSignature : ArgumentsSignature.INVALID_SIGNATURE; + varArgsCache = new Cache(ArgumentsSignature.INVALID_SIGNATURE, null); } } return new RArgsValuesAndNames(flattenedArgs, finalSignature); diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/RCallNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/RCallNode.java index d202fe1015cfe2a332ff77da078972284f3fecf1..c7e740405648e2305d2c755dc1b4c3e23de0ca2c 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/RCallNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/RCallNode.java @@ -35,6 +35,7 @@ import com.oracle.truffle.api.dsl.Fallback; import com.oracle.truffle.api.dsl.NodeChild; import com.oracle.truffle.api.dsl.Specialization; import com.oracle.truffle.api.dsl.TypeSystemReference; +import com.oracle.truffle.api.frame.FrameSlot; import com.oracle.truffle.api.frame.FrameSlotTypeException; import com.oracle.truffle.api.frame.MaterializedFrame; import com.oracle.truffle.api.frame.VirtualFrame; @@ -55,14 +56,12 @@ import com.oracle.truffle.r.nodes.EmptyTypeSystemFlatLayout; import com.oracle.truffle.r.nodes.RASTUtils; import com.oracle.truffle.r.nodes.RRootNode; import com.oracle.truffle.r.nodes.access.ConstantNode; -import com.oracle.truffle.r.nodes.access.FrameSlotNode; import com.oracle.truffle.r.nodes.access.variables.LocalReadVariableNode; import com.oracle.truffle.r.nodes.access.variables.ReadVariableNode; import com.oracle.truffle.r.nodes.builtin.RBuiltinNode; import com.oracle.truffle.r.nodes.builtin.RBuiltinRootNode; import com.oracle.truffle.r.nodes.function.PromiseHelperNode.PromiseCheckHelperNode; import com.oracle.truffle.r.nodes.function.RCallNodeGen.FunctionDispatchNodeGen; -import com.oracle.truffle.r.nodes.function.S3FunctionLookupNode.NoGenericMethodException; import com.oracle.truffle.r.nodes.function.S3FunctionLookupNode.Result; import com.oracle.truffle.r.nodes.function.call.CallRFunctionNode; import com.oracle.truffle.r.nodes.function.call.PrepareArguments; @@ -112,23 +111,23 @@ public abstract class RCallNode extends RCallBaseNode implements RSyntaxNode, RS // currently cannot be RSourceSectionNode because of TruffleDSL restrictions - @CompilationFinal private SourceSection sourceSectionR; + @CompilationFinal private SourceSection sourceSection; @Override public final void setSourceSection(SourceSection sourceSection) { assert sourceSection != null; - this.sourceSectionR = sourceSection; + this.sourceSection = sourceSection; } @Override public final SourceSection getLazySourceSection() { - return sourceSectionR; + return sourceSection; } @Override public final SourceSection getSourceSection() { RDeparse.ensureSourceSection(this); - return sourceSectionR; + return sourceSection; } protected abstract ForcePromiseNode getFunction(); @@ -164,7 +163,7 @@ public abstract class RCallNode extends RCallBaseNode implements RSyntaxNode, RS protected RCallNode(SourceSection sourceSection, RSyntaxNode[] arguments, ArgumentsSignature signature) { assert sourceSection != null; - this.sourceSectionR = sourceSection; + this.sourceSection = sourceSection; this.arguments = arguments; this.explicitArgs = null; this.varArgIndexes = getVarArgIndexes(arguments); @@ -184,7 +183,7 @@ public abstract class RCallNode extends RCallBaseNode implements RSyntaxNode, RS protected RCallNode(SourceSection sourceSection, Object explicitArgsIdentifier) { assert sourceSection != null; - this.sourceSectionR = sourceSection; + this.sourceSection = sourceSection; this.arguments = null; this.explicitArgs = LocalReadVariableNode.create(explicitArgsIdentifier, false); this.varArgIndexes = null; @@ -234,11 +233,11 @@ public abstract class RCallNode extends RCallBaseNode implements RSyntaxNode, RS } protected FunctionDispatch createUninitializedCall() { - return FunctionDispatchNodeGen.create(this, null, explicitArgs == null ? false : true); + return FunctionDispatchNodeGen.create(this, explicitArgs != null, null); } protected FunctionDispatch createUninitializedExplicitCall() { - return FunctionDispatchNodeGen.create(this, null, true); + return FunctionDispatchNodeGen.create(this, true, null); } /** @@ -284,7 +283,7 @@ public abstract class RCallNode extends RCallBaseNode implements RSyntaxNode, RS @Cached("createBinaryProfile()") ConditionProfile resultIsBuiltinProfile) { RBuiltinDescriptor builtin = builtinProfile.profile(function.getRBuiltin()); Object dispatchObject = dispatchArgument.execute(frame); - dispatchTempSlot.initialize(frame, dispatchObject, () -> internalDispatchCall = null); + FrameSlot slot = dispatchTempSlot.initialize(frame, dispatchObject); try { RStringVector type = classHierarchyNode.execute(dispatchObject); S3Args s3Args; @@ -301,13 +300,13 @@ public abstract class RCallNode extends RCallBaseNode implements RSyntaxNode, RS s3Args = null; resultFunction = function; } - if (internalDispatchCall == null) { + if (internalDispatchCall == null || internalDispatchCall.tempFrameSlot != slot) { CompilerDirectives.transferToInterpreterAndInvalidate(); - internalDispatchCall = insert(FunctionDispatchNodeGen.create(this, new Object[]{dispatchTempSlot.getIdentifier()}, false)); + internalDispatchCall = insert(FunctionDispatchNodeGen.create(this, false, slot)); } return internalDispatchCall.execute(frame, resultFunction, lookupVarArgs(frame), s3Args, null); } finally { - dispatchTempSlot.cleanup(frame, dispatchObject); + TemporarySlotNode.cleanup(frame, dispatchObject, slot); } } @@ -399,21 +398,13 @@ public abstract class RCallNode extends RCallBaseNode implements RSyntaxNode, RS RStringVector typeX = classHierarchyNodeX.execute(promiseHelperNode.checkEvaluate(frame, args[typeXIdx])); Result resultX = null; if (implicitTypeProfileX.profile(typeX != null)) { - try { - resultX = dispatchLookupX.execute(frame, builtin.getName(), typeX, dispatch.getGroupGenericName(), frame.materialize(), null); - } catch (NoGenericMethodException e) { - // fall-through - } + resultX = dispatchLookupX.execute(frame, builtin.getName(), typeX, dispatch.getGroupGenericName(), frame.materialize(), null); } Result resultY = null; if (args.length > 1 && dispatch == RDispatch.OPS_GROUP_GENERIC) { RStringVector typeY = classHierarchyNodeY.execute(promiseHelperNode.checkEvaluate(frame, args[1])); if (implicitTypeProfileY.profile(typeY != null)) { - try { - resultY = dispatchLookupY.execute(frame, builtin.getName(), typeY, dispatch.getGroupGenericName(), frame.materialize(), null); - } catch (NoGenericMethodException e) { - // fall-through - } + resultY = dispatchLookupY.execute(frame, builtin.getName(), typeY, dispatch.getGroupGenericName(), frame.materialize(), null); } } @@ -548,11 +539,11 @@ public abstract class RCallNode extends RCallBaseNode implements RSyntaxNode, RS return getParentCallNode().getFunctionNode(); } - public CallArgumentsNode createArguments(Object[] dispatchTempIdentifiers, boolean modeChange, boolean modeChangeAppliesToAll) { + public CallArgumentsNode createArguments(FrameSlot tempFrameSlot, boolean modeChange, boolean modeChangeAppliesToAll) { RNode[] args = new RNode[arguments.length]; for (int i = 0; i < arguments.length; i++) { - if (dispatchTempIdentifiers != null && i < dispatchTempIdentifiers.length) { - args[i] = new GetTempNode(dispatchTempIdentifiers[i], arguments[i]); + if (tempFrameSlot != null && i == 0) { + args[i] = new GetTempNode(tempFrameSlot, arguments[i]); } else { args[i] = arguments[i] == null ? null : RASTUtils.cloneNode(arguments[i].asRNode()); } @@ -570,7 +561,7 @@ public abstract class RCallNode extends RCallBaseNode implements RSyntaxNode, RS */ public static RNode createInternalCall(RCallNode internalCallArg, RFunction function) { CompilerAsserts.neverPartOfCompilation(); - return new InternalNode(FunctionDispatchNodeGen.create(internalCallArg, null, false), function, internalCallArg.lookupVarArgs != null); + return new InternalNode(FunctionDispatchNodeGen.create(internalCallArg, false, null), function, internalCallArg.lookupVarArgs != null); } @NodeInfo(cost = NodeCost.NONE) @@ -654,11 +645,11 @@ public abstract class RCallNode extends RCallBaseNode implements RSyntaxNode, RS private static final class GetTempNode extends RNode { - @Child private FrameSlotNode slot; + private final FrameSlot slot; private final RSyntaxNode arg; - GetTempNode(Object identifier, RSyntaxNode arg) { - slot = FrameSlotNode.createTemp(identifier, false); + GetTempNode(FrameSlot slot, RSyntaxNode arg) { + this.slot = slot; this.arg = arg; } @@ -670,7 +661,7 @@ public abstract class RCallNode extends RCallBaseNode implements RSyntaxNode, RS @Override public Object execute(VirtualFrame frame) { try { - return frame.getObject(slot.executeFrameSlot(frame)); + return frame.getObject(slot); } catch (FrameSlotTypeException e) { throw RInternalError.shouldNotReachHere(); } @@ -691,13 +682,14 @@ public abstract class RCallNode extends RCallBaseNode implements RSyntaxNode, RS protected static final int CACHE_SIZE = 4; private final RCallNode originalCall; - private final Object[] dispatchTempIdentifiers; private final boolean explicitArgs; - public FunctionDispatch(RCallNode originalCall, Object[] dispatchTempIdentifiers, boolean explicitArgs) { + private final FrameSlot tempFrameSlot; + + public FunctionDispatch(RCallNode originalCall, boolean explicitArgs, FrameSlot tempFrameSlot) { this.originalCall = originalCall; - this.dispatchTempIdentifiers = dispatchTempIdentifiers; this.explicitArgs = explicitArgs; + this.tempFrameSlot = tempFrameSlot; } protected LeafCallNode createCacheNode(RootCallTarget cachedTarget) { @@ -717,7 +709,7 @@ public abstract class RCallNode extends RCallBaseNode implements RSyntaxNode, RS if (explicitArgs) { return PrepareArguments.createExplicit(root); } else { - CallArgumentsNode args = originalCall.createArguments(dispatchTempIdentifiers, root.getBuiltin() == null, true); + CallArgumentsNode args = originalCall.createArguments(tempFrameSlot, root.getBuiltin() == null, true); return PrepareArguments.create(root, args, noOpt); } } diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/RCallSpecialNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/RCallSpecialNode.java index 9834af4dee1da8e4bd95dc84352c836dfcb0d40e..1a81c60bc464b40869f22733cefd740ec0181f9b 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/RCallSpecialNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/RCallSpecialNode.java @@ -98,23 +98,23 @@ public final class RCallSpecialNode extends RCallBaseNode implements RSyntaxNode private static final boolean useSpecials = FastROptions.UseSpecials.getBooleanValue(); // currently cannot be RSourceSectionNode because of TruffleDSL restrictions - @CompilationFinal private SourceSection sourceSectionR; + @CompilationFinal private SourceSection sourceSection; @Override public void setSourceSection(SourceSection sourceSection) { assert sourceSection != null; - this.sourceSectionR = sourceSection; + this.sourceSection = sourceSection; } @Override public SourceSection getLazySourceSection() { - return sourceSectionR; + return sourceSection; } @Override public SourceSection getSourceSection() { RDeparse.ensureSourceSection(this); - return sourceSectionR; + return sourceSection; } @Child private ForcePromiseNode functionNode; @@ -136,7 +136,7 @@ public final class RCallSpecialNode extends RCallBaseNode implements RSyntaxNode private RCallSpecialNode callSpecialParent; private RCallSpecialNode(SourceSection sourceSection, RNode functionNode, RFunction expectedFunction, RSyntaxNode[] arguments, ArgumentsSignature signature, RNode special) { - this.sourceSectionR = sourceSection; + this.sourceSection = sourceSection; this.expectedFunction = expectedFunction; this.special = special; this.functionNode = new ForcePromiseNode(functionNode); @@ -272,7 +272,7 @@ public final class RCallSpecialNode extends RCallBaseNode implements RSyntaxNode } private RCallNode getRCallNode(RSyntaxNode[] newArguments) { - return RCallNode.createCall(sourceSectionR, functionNode == null ? null : functionNode.getValueNode(), signature, newArguments); + return RCallNode.createCall(sourceSection, functionNode == null ? null : functionNode.getValueNode(), signature, newArguments); } private RCallNode getRCallNode() { diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/S3FunctionLookupNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/S3FunctionLookupNode.java index 41082f5156c4439809ac6c083d56da246f3f28c3..2ddb5474316dbf7260cda12b317c9002b32fb671 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/S3FunctionLookupNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/S3FunctionLookupNode.java @@ -23,7 +23,6 @@ import com.oracle.truffle.api.frame.FrameSlot; import com.oracle.truffle.api.frame.FrameSlotTypeException; import com.oracle.truffle.api.frame.MaterializedFrame; import com.oracle.truffle.api.frame.VirtualFrame; -import com.oracle.truffle.api.nodes.ControlFlowException; import com.oracle.truffle.api.nodes.ExplodeLoop; import com.oracle.truffle.api.nodes.NodeCost; import com.oracle.truffle.api.nodes.NodeInfo; @@ -33,6 +32,7 @@ import com.oracle.truffle.api.profiles.ValueProfile; import com.oracle.truffle.r.nodes.access.variables.LocalReadVariableNode; import com.oracle.truffle.r.nodes.access.variables.ReadVariableNode; import com.oracle.truffle.r.runtime.ArgumentsSignature; +import com.oracle.truffle.r.runtime.RArguments.S3Args; import com.oracle.truffle.r.runtime.RError; import com.oracle.truffle.r.runtime.RInternalError; import com.oracle.truffle.r.runtime.RRuntime; @@ -74,18 +74,22 @@ public abstract class S3FunctionLookupNode extends RBaseNode { this.targetFunctionName = targetFunctionName; this.groupMatch = groupMatch; } + + public S3Args createS3Args(Frame frame) { + return new S3Args(generic, clazz, targetFunctionName, frame.materialize(), null, null); + } } public static S3FunctionLookupNode create(boolean throwsError, boolean nextMethod) { - return new UseMethodFunctionLookupUninitializedNode(throwsError, nextMethod); + return new UseMethodFunctionLookupUninitializedNode(throwsError, nextMethod, 0); } public static S3FunctionLookupNode createWithError() { - return new UseMethodFunctionLookupUninitializedNode(true, false); + return new UseMethodFunctionLookupUninitializedNode(true, false, 0); } public static S3FunctionLookupNode createWithException() { - return new UseMethodFunctionLookupUninitializedNode(false, false); + return new UseMethodFunctionLookupUninitializedNode(false, false, 0); } @FunctionalInterface @@ -235,19 +239,21 @@ public abstract class S3FunctionLookupNode extends RBaseNode { @NodeInfo(cost = NodeCost.UNINITIALIZED) private static final class UseMethodFunctionLookupUninitializedNode extends S3FunctionLookupNode { - private int depth; + private final int depth; - UseMethodFunctionLookupUninitializedNode(boolean throwsError, boolean nextMethod) { + UseMethodFunctionLookupUninitializedNode(boolean throwsError, boolean nextMethod, int depth) { super(throwsError, nextMethod); + this.depth = depth; } @Override public Result execute(VirtualFrame frame, String genericName, RStringVector type, String group, MaterializedFrame callerFrame, MaterializedFrame genericDefFrame) { CompilerDirectives.transferToInterpreterAndInvalidate(); - if (++depth > MAX_CACHE_DEPTH) { + if (depth > MAX_CACHE_DEPTH) { return replace(new UseMethodFunctionLookupGenericNode(throwsError, nextMethod)).execute(frame, genericName, type, group, callerFrame, genericDefFrame); } else { - UseMethodFunctionLookupCachedNode cachedNode = replace(specialize(frame, genericName, type, group, callerFrame, genericDefFrame, this)); + UseMethodFunctionLookupCachedNode cachedNode = replace( + specialize(frame, genericName, type, group, callerFrame, genericDefFrame, new UseMethodFunctionLookupUninitializedNode(throwsError, nextMethod, depth + 1))); return cachedNode.execute(frame, genericName, type, group, callerFrame, genericDefFrame); } } @@ -329,7 +335,7 @@ public abstract class S3FunctionLookupNode extends RBaseNode { } throw RError.error(this, RError.Message.UNKNOWN_FUNCTION_USE_METHOD, genericName, type); } else { - throw S3FunctionLookupNode.NoGenericMethodException.instance; + return null; } } while (true); CompilerDirectives.transferToInterpreterAndInvalidate(); @@ -431,19 +437,10 @@ public abstract class S3FunctionLookupNode extends RBaseNode { } throw RError.error(this, RError.Message.UNKNOWN_FUNCTION_USE_METHOD, genericName, RRuntime.toString(type)); } else { - throw S3FunctionLookupNode.NoGenericMethodException.instance; + return null; } } return result; } } - - @SuppressWarnings("serial") - public static final class NoGenericMethodException extends ControlFlowException { - private static final NoGenericMethodException instance = new NoGenericMethodException(); - - private NoGenericMethodException() { - // singleton - } - } } diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/TemporarySlotNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/TemporarySlotNode.java index cab3f3c4da90b28fb840338a03006ebcd7bb9b31..03e13b0d068b6a277a8511029d130b4bab6ba20b 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/TemporarySlotNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/TemporarySlotNode.java @@ -37,33 +37,35 @@ public final class TemporarySlotNode extends Node { @CompilationFinal private FrameSlot tempSlot; private int tempIdentifier; - private Object identifier; - public void initialize(VirtualFrame frame, Object value, Runnable invalidate) { + public FrameSlot initialize(VirtualFrame frame, Object value) { if (tempSlot == null) { CompilerDirectives.transferToInterpreterAndInvalidate(); - tempSlot = frame.getFrameDescriptor().findOrAddFrameSlot(identifier = defaultTempIdentifiers[0], FrameSlotKind.Object); - invalidate.run(); + tempSlot = frame.getFrameDescriptor().findOrAddFrameSlot(defaultTempIdentifiers[0], FrameSlotKind.Object); } + FrameSlot slot = tempSlot; try { - if (frame.getObject(tempSlot) != null) { + if (frame.getObject(slot) != null) { CompilerDirectives.transferToInterpreterAndInvalidate(); // keep the complete loop in the slow path do { tempIdentifier++; - identifier = tempIdentifier < defaultTempIdentifiers.length ? defaultTempIdentifiers[tempIdentifier] : new Object(); - tempSlot = frame.getFrameDescriptor().findOrAddFrameSlot(identifier, FrameSlotKind.Object); - invalidate.run(); - } while (frame.getObject(tempSlot) != null); + Object identifier = tempIdentifier < defaultTempIdentifiers.length ? defaultTempIdentifiers[tempIdentifier] : new Object(); + tempSlot = slot = frame.getFrameDescriptor().findOrAddFrameSlot(identifier, FrameSlotKind.Object); + if (frame.getObject(slot) == null) { + break; + } + } while (true); } } catch (FrameSlotTypeException e) { CompilerDirectives.transferToInterpreter(); throw RInternalError.shouldNotReachHere(); } - frame.setObject(tempSlot, value); + frame.setObject(slot, value); + return slot; } - public void cleanup(VirtualFrame frame, Object object) { + public static void cleanup(VirtualFrame frame, Object object, FrameSlot tempSlot) { try { assert frame.getObject(tempSlot) == object; } catch (FrameSlotTypeException e) { @@ -71,8 +73,4 @@ public final class TemporarySlotNode extends Node { } frame.setObject(tempSlot, null); } - - public Object getIdentifier() { - return identifier; - } } diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/UseMethodInternalNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/UseMethodInternalNode.java deleted file mode 100644 index 739931976e6def1f5933a27c1c92806339e413c4..0000000000000000000000000000000000000000 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/UseMethodInternalNode.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * 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) 2014, Purdue University - * Copyright (c) 2014, 2016, Oracle and/or its affiliates - * - * All rights reserved. - */ -package com.oracle.truffle.r.nodes.function; - -import com.oracle.truffle.api.CompilerDirectives; -import com.oracle.truffle.api.frame.VirtualFrame; -import com.oracle.truffle.r.nodes.function.S3FunctionLookupNode.Result; -import com.oracle.truffle.r.runtime.ArgumentsSignature; -import com.oracle.truffle.r.runtime.FastROptions; -import com.oracle.truffle.r.runtime.RArguments.S3Args; -import com.oracle.truffle.r.runtime.RInternalError; -import com.oracle.truffle.r.runtime.data.RStringVector; -import com.oracle.truffle.r.runtime.nodes.RNode; - -public final class UseMethodInternalNode extends RNode { - - @Child private ClassHierarchyNode classHierarchyNode = ClassHierarchyNodeGen.create(true, true); - @Child private S3FunctionLookupNode lookup = S3FunctionLookupNode.create(false, false); - @Child private CallMatcherNode callMatcher = CallMatcherNode.create(false); - @Child private PreProcessArgumentsNode argPreProcess; - - private final String generic; - private final ArgumentsSignature signature; - private final boolean wrap; - - public UseMethodInternalNode(String generic, ArgumentsSignature signature, boolean wrap) { - this.generic = generic; - this.signature = signature; - this.wrap = wrap && FastROptions.InvisibleArgs.getBooleanValue(); - } - - public Object execute(VirtualFrame frame, RStringVector type, Object[] arguments) { - Result lookupResult = lookup.execute(frame, generic, type, null, frame.materialize(), null); - if (wrap) { - assert arguments != null; - if (argPreProcess == null || argPreProcess.getLength() != arguments.length) { - CompilerDirectives.transferToInterpreterAndInvalidate(); - argPreProcess = insert(PreProcessArgumentsNode.create(arguments.length)); - } - argPreProcess.execute(frame, arguments); - } - S3Args s3Args = new S3Args(generic, lookupResult.clazz, lookupResult.targetFunctionName, frame.materialize(), null, null); - return callMatcher.execute(frame, signature, arguments, lookupResult.function, lookupResult.targetFunctionName, s3Args); - } - - @Override - public Object execute(VirtualFrame frame) { - throw RInternalError.shouldNotReachHere(); - } -} diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/WrapArgumentNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/WrapArgumentNode.java index 7ed844a144758904c56d2f9e9463f19e2c1d3673..8a6471d4845ffb956178fdb29cb6fac32f94240a 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/WrapArgumentNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/WrapArgumentNode.java @@ -25,7 +25,6 @@ package com.oracle.truffle.r.nodes.function; import com.oracle.truffle.api.frame.VirtualFrame; import com.oracle.truffle.api.nodes.NodeCost; import com.oracle.truffle.api.nodes.UnexpectedResultException; -import com.oracle.truffle.api.profiles.BranchProfile; import com.oracle.truffle.r.nodes.access.ConstantNode; import com.oracle.truffle.r.runtime.data.RMissing; import com.oracle.truffle.r.runtime.data.RNull; @@ -44,8 +43,6 @@ public final class WrapArgumentNode extends WrapArgumentBaseNode { @Child private ArgumentStatePush argPushStateNode; - private final BranchProfile refCounted = BranchProfile.create(); - private WrapArgumentNode(RNode operand, boolean modeChange, int index) { super(operand, modeChange); this.modeChange = modeChange; @@ -79,9 +76,6 @@ public final class WrapArgumentNode extends WrapArgumentBaseNode { if (rShareable != null) { shareable.enter(); argPushStateNode.executeObject(frame, rShareable); - } else if (argPushStateNode.refCounted()) { - refCounted.enter(); - argPushStateNode.executeObject(frame, RNull.instance); } } return result; diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/call/PrepareArguments.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/call/PrepareArguments.java index 60218f9968d1610f1a04a6f303e88eb16bbd1e53..5b48ec10193c4ede8faf5340e4ed14b5eee1032d 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/call/PrepareArguments.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/call/PrepareArguments.java @@ -23,15 +23,23 @@ package com.oracle.truffle.r.nodes.function.call; import com.oracle.truffle.api.CompilerDirectives; +import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary; +import com.oracle.truffle.api.dsl.Cached; +import com.oracle.truffle.api.dsl.Fallback; +import com.oracle.truffle.api.dsl.Specialization; +import com.oracle.truffle.api.dsl.TypeSystemReference; import com.oracle.truffle.api.frame.VirtualFrame; import com.oracle.truffle.api.nodes.ExplodeLoop; import com.oracle.truffle.api.nodes.Node; +import com.oracle.truffle.r.nodes.EmptyTypeSystemFlatLayout; import com.oracle.truffle.r.nodes.RRootNode; import com.oracle.truffle.r.nodes.function.ArgumentMatcher; import com.oracle.truffle.r.nodes.function.ArgumentMatcher.MatchPermutation; import com.oracle.truffle.r.nodes.function.CallArgumentsNode; import com.oracle.truffle.r.nodes.function.FormalArguments; import com.oracle.truffle.r.nodes.function.RCallNode; +import com.oracle.truffle.r.nodes.function.call.PrepareArgumentsFactory.PrepareArgumentsDefaultNodeGen; +import com.oracle.truffle.r.nodes.function.call.PrepareArgumentsFactory.PrepareArgumentsExplicitNodeGen; import com.oracle.truffle.r.runtime.Arguments; import com.oracle.truffle.r.runtime.ArgumentsSignature; import com.oracle.truffle.r.runtime.RArguments.S3DefaultArguments; @@ -44,171 +52,111 @@ import com.oracle.truffle.r.runtime.nodes.RNode; * rules. It implements two different paths: one for arguments provided as an * {@link CallArgumentsNode}, i.e., unevaluated arguments, and another path for evaluated arguments. */ +@TypeSystemReference(EmptyTypeSystemFlatLayout.class) public abstract class PrepareArguments extends Node { - private static final int CACHE_SIZE = 4; + protected static final int CACHE_SIZE = 8; - /** - * Returns the argument values and corresponding signature. The signature represents the - * original call signature reordered in the same way as the arguments. For s3DefaultArguments - * motivation see {@link RCallNode#callGroupGeneric}. - */ - public abstract RArgsValuesAndNames execute(VirtualFrame frame, RArgsValuesAndNames varArgs, S3DefaultArguments s3DefaultArguments, RCallNode call); + abstract static class PrepareArgumentsDefault extends PrepareArguments { - public static PrepareArguments create(RRootNode target, CallArgumentsNode args, boolean noOpt) { - return new UninitializedPrepareArguments(target, args, noOpt); - } + protected final RRootNode target; + protected final CallArgumentsNode sourceArguments; // not used as a node + protected final boolean noOpt; - public static PrepareArguments createExplicit(RRootNode target) { - return new UninitializedExplicitPrepareArguments(target); - } + static final class ArgumentsAndSignature extends Node { + @Children private final RNode[] matchedArguments; + private final ArgumentsSignature matchedSuppliedSignature; - @ExplodeLoop - private static RArgsValuesAndNames executeArgs(RNode[] arguments, ArgumentsSignature suppliedSignature, VirtualFrame frame) { - Object[] result = new Object[arguments.length]; - for (int i = 0; i < arguments.length; i++) { - result[i] = arguments[i].execute(frame); + protected ArgumentsAndSignature(RNode[] matchedArguments, ArgumentsSignature matchedSuppliedSignature) { + this.matchedArguments = matchedArguments; + this.matchedSuppliedSignature = matchedSuppliedSignature; + } } - return new RArgsValuesAndNames(result, suppliedSignature); - } - - private static RArgsValuesAndNames executeArgs(Arguments<RNode> matched, VirtualFrame frame) { - return executeArgs(matched.getArguments(), matched.getSignature(), frame); - } - - private static final class UninitializedPrepareArguments extends PrepareArguments { - private final RRootNode target; - private final CallArgumentsNode sourceArguments; // not used as a node - private final boolean noOpt; - private int depth = CACHE_SIZE; + protected static ArgumentsSignature getSignatureOrNull(RArgsValuesAndNames args) { + return args == null ? null : args.getSignature(); + } - UninitializedPrepareArguments(RRootNode target, CallArgumentsNode sourceArguments, boolean noOpt) { + protected PrepareArgumentsDefault(RRootNode target, CallArgumentsNode sourceArguments, boolean noOpt) { this.target = target; this.sourceArguments = sourceArguments; this.noOpt = noOpt; } - @Override - public RArgsValuesAndNames execute(VirtualFrame frame, RArgsValuesAndNames varArgs, S3DefaultArguments s3DefaultArguments, RCallNode call) { - CompilerDirectives.transferToInterpreterAndInvalidate(); - PrepareArguments next; - if (depth-- > 0) { - next = new CachedPrepareArguments(this, target, call, sourceArguments, varArgs == null ? null : varArgs.getSignature(), s3DefaultArguments, noOpt); - } else { - next = new GenericPrepareArguments(target, sourceArguments); - } - return replace(next).execute(frame, varArgs, s3DefaultArguments, call); - } - } - - private static final class CachedPrepareArguments extends PrepareArguments { - - @Child private PrepareArguments next; - @Children private final RNode[] matchedArguments; - private final ArgumentsSignature matchedSuppliedSignature; - private final ArgumentsSignature cachedVarArgSignature; - private final Object cachedS3DefaultArguments; - - CachedPrepareArguments(PrepareArguments next, RRootNode target, RCallNode call, CallArgumentsNode args, ArgumentsSignature varArgSignature, S3DefaultArguments s3DefaultArguments, - boolean noOpt) { - this.next = next; - cachedVarArgSignature = varArgSignature; - Arguments<RNode> matched = ArgumentMatcher.matchArguments(target, args, varArgSignature, s3DefaultArguments, call, noOpt); - this.matchedArguments = matched.getArguments(); - this.matchedSuppliedSignature = matched.getSignature(); - this.cachedS3DefaultArguments = s3DefaultArguments; + protected ArgumentsAndSignature createArguments(RCallNode call, ArgumentsSignature varArgSignature, S3DefaultArguments s3DefaultArguments) { + Arguments<RNode> matched = ArgumentMatcher.matchArguments(target, sourceArguments, varArgSignature, s3DefaultArguments, call, noOpt); + return new ArgumentsAndSignature(matched.getArguments(), matched.getSignature()); } - @Override @ExplodeLoop - public RArgsValuesAndNames execute(VirtualFrame frame, RArgsValuesAndNames varArgs, S3DefaultArguments s3DefaultArguments, RCallNode call) { - assert (cachedVarArgSignature != null) == (varArgs != null); - if ((cachedVarArgSignature == null || cachedVarArgSignature == varArgs.getSignature()) && cachedS3DefaultArguments == s3DefaultArguments) { - return executeArgs(matchedArguments, matchedSuppliedSignature, frame); + private static RArgsValuesAndNames executeArgs(RNode[] arguments, ArgumentsSignature suppliedSignature, VirtualFrame frame) { + Object[] result = new Object[arguments.length]; + for (int i = 0; i < arguments.length; i++) { + result[i] = arguments[i].execute(frame); } - return next.execute(frame, varArgs, s3DefaultArguments, call); + return new RArgsValuesAndNames(result, suppliedSignature); } - } - - private static final class GenericPrepareArguments extends PrepareArguments { - private final RRootNode target; - private final CallArgumentsNode args; // not used as a node - - GenericPrepareArguments(RRootNode target, CallArgumentsNode args) { - this.target = target; - this.args = args; + @Specialization(limit = "CACHE_SIZE", guards = {"cachedVarArgSignature == null || cachedVarArgSignature == varArgs.getSignature()", "cachedS3DefaultArguments == s3DefaultArguments"}) + public RArgsValuesAndNames prepare(VirtualFrame frame, RArgsValuesAndNames varArgs, @SuppressWarnings("unused") S3DefaultArguments s3DefaultArguments, + @SuppressWarnings("unused") RCallNode call, + @Cached("getSignatureOrNull(varArgs)") ArgumentsSignature cachedVarArgSignature, + @Cached("createArguments(call, cachedVarArgSignature, s3DefaultArguments)") ArgumentsAndSignature arguments, + @SuppressWarnings("unused") @Cached("s3DefaultArguments") S3DefaultArguments cachedS3DefaultArguments) { + assert (cachedVarArgSignature != null) == (varArgs != null); + return executeArgs(arguments.matchedArguments, arguments.matchedSuppliedSignature, frame); } - @Override - public RArgsValuesAndNames execute(VirtualFrame frame, RArgsValuesAndNames varArgs, S3DefaultArguments s3DefaultArguments, RCallNode call) { + @Fallback + public RArgsValuesAndNames prepareGeneric(VirtualFrame frame, RArgsValuesAndNames varArgs, S3DefaultArguments s3DefaultArguments, @SuppressWarnings("unused") RCallNode call) { CompilerDirectives.transferToInterpreter(); ArgumentsSignature varArgSignature = varArgs == null ? null : varArgs.getSignature(); - Arguments<RNode> matchedArgs = ArgumentMatcher.matchArguments(target, args, varArgSignature, s3DefaultArguments, RError.ROOTNODE, true); - return executeArgs(matchedArgs, frame); + Arguments<RNode> matchedArgs = ArgumentMatcher.matchArguments(target, sourceArguments, varArgSignature, s3DefaultArguments, RError.ROOTNODE, true); + return executeArgs(matchedArgs.getArguments(), matchedArgs.getSignature(), frame); } } - private static final class UninitializedExplicitPrepareArguments extends PrepareArguments { + abstract static class PrepareArgumentsExplicit extends PrepareArguments { - private final RRootNode target; - private int depth = CACHE_SIZE; + protected final RRootNode target; + private final FormalArguments formals; - UninitializedExplicitPrepareArguments(RRootNode target) { + protected PrepareArgumentsExplicit(RRootNode target) { this.target = target; + this.formals = target.getFormalArguments(); } - @Override - public RArgsValuesAndNames execute(VirtualFrame frame, RArgsValuesAndNames explicitArgs, S3DefaultArguments s3DefaultArguments, RCallNode call) { - CompilerDirectives.transferToInterpreterAndInvalidate(); - PrepareArguments next; - if (depth-- > 0) { - next = new CachedExplicitPrepareArguments(this, target, call, explicitArgs == null ? null : explicitArgs.getSignature()); - } else { - next = new GenericExplicitPrepareArguments(target); - } - return replace(next).execute(frame, explicitArgs, s3DefaultArguments, call); + protected MatchPermutation createArguments(RCallNode call, ArgumentsSignature explicitArgSignature) { + return ArgumentMatcher.matchArguments(explicitArgSignature, formals.getSignature(), call, target.getBuiltin()); } - } - - private static final class CachedExplicitPrepareArguments extends PrepareArguments { - - @Child private PrepareArguments next; - - private final MatchPermutation permutation; - private final ArgumentsSignature cachedExplicitArgSignature; - private final FormalArguments formals; - CachedExplicitPrepareArguments(PrepareArguments next, RRootNode target, RCallNode call, ArgumentsSignature explicitArgSignature) { - this.next = next; - formals = target.getFormalArguments(); - permutation = ArgumentMatcher.matchArguments(explicitArgSignature, formals.getSignature(), call, target.getBuiltin()); - cachedExplicitArgSignature = explicitArgSignature; + @Specialization(limit = "CACHE_SIZE", guards = {"cachedExplicitArgSignature == explicitArgs.getSignature()"}) + public RArgsValuesAndNames prepare(RArgsValuesAndNames explicitArgs, S3DefaultArguments s3DefaultArguments, @SuppressWarnings("unused") RCallNode call, + @SuppressWarnings("unused") @Cached("explicitArgs.getSignature()") ArgumentsSignature cachedExplicitArgSignature, + @Cached("createArguments(call, cachedExplicitArgSignature)") MatchPermutation permutation) { + return ArgumentMatcher.matchArgumentsEvaluated(permutation, explicitArgs.getArguments(), s3DefaultArguments, formals); } - @Override - public RArgsValuesAndNames execute(VirtualFrame frame, RArgsValuesAndNames explicitArgs, S3DefaultArguments s3DefaultArguments, RCallNode call) { - if (cachedExplicitArgSignature == explicitArgs.getSignature()) { - return ArgumentMatcher.matchArgumentsEvaluated(permutation, explicitArgs.getArguments(), s3DefaultArguments, formals); - } - return next.execute(frame, explicitArgs, s3DefaultArguments, call); + @Fallback + @TruffleBoundary + public RArgsValuesAndNames prepareGeneric(RArgsValuesAndNames explicitArgs, S3DefaultArguments s3DefaultArguments, @SuppressWarnings("unused") RCallNode call) { + // Function and arguments may change every call: Flatt'n'Match on SlowPath! :-/ + return ArgumentMatcher.matchArgumentsEvaluated(target, explicitArgs, s3DefaultArguments, RError.ROOTNODE); } } - private static final class GenericExplicitPrepareArguments extends PrepareArguments { - - private final RRootNode target; + /** + * Returns the argument values and corresponding signature. The signature represents the + * original call signature reordered in the same way as the arguments. For s3DefaultArguments + * motivation see {@link RCallNode#callGroupGeneric}. + */ + public abstract RArgsValuesAndNames execute(VirtualFrame frame, RArgsValuesAndNames varArgs, S3DefaultArguments s3DefaultArguments, RCallNode call); - GenericExplicitPrepareArguments(RRootNode target) { - this.target = target; - } + public static PrepareArguments create(RRootNode target, CallArgumentsNode args, boolean noOpt) { + return PrepareArgumentsDefaultNodeGen.create(target, args, noOpt); + } - @Override - public RArgsValuesAndNames execute(VirtualFrame frame, RArgsValuesAndNames explicitArgs, S3DefaultArguments s3DefaultArguments, RCallNode call) { - CompilerDirectives.transferToInterpreter(); - // Function and arguments may change every call: Flatt'n'Match on SlowPath! :-/ - return ArgumentMatcher.matchArgumentsEvaluated(target, explicitArgs, s3DefaultArguments, RError.ROOTNODE); - } + public static PrepareArguments createExplicit(RRootNode target) { + return PrepareArgumentsExplicitNodeGen.create(target); } } diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/visibility/SetVisibilityNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/visibility/SetVisibilityNode.java index c4946fcc9e09c23827fa6b4c357ee1f852024382..e5315d7410c862e2c6038a5a747fcf663aab322c 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/visibility/SetVisibilityNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/visibility/SetVisibilityNode.java @@ -22,6 +22,7 @@ */ package com.oracle.truffle.r.nodes.function.visibility; +import com.oracle.truffle.api.CompilerAsserts; import com.oracle.truffle.api.CompilerDirectives; import com.oracle.truffle.api.CompilerDirectives.CompilationFinal; import com.oracle.truffle.api.frame.Frame; @@ -32,6 +33,7 @@ import com.oracle.truffle.api.frame.VirtualFrame; import com.oracle.truffle.api.nodes.Node; import com.oracle.truffle.api.nodes.NodeCost; import com.oracle.truffle.api.nodes.NodeInfo; +import com.oracle.truffle.api.nodes.RootNode; import com.oracle.truffle.r.runtime.RArguments; import com.oracle.truffle.r.runtime.RCaller; import com.oracle.truffle.r.runtime.RInternalError; @@ -86,12 +88,19 @@ public final class SetVisibilityNode extends Node { * Needs to be called at the end of each function, so that the visibility is transferred from * the current frame into the {@link RCaller}. */ - public void executeEndOfFunction(VirtualFrame frame) { + public void executeEndOfFunction(VirtualFrame frame, RootNode root) { ensureFrameSlot(frame); try { - Object visibility = frame.getBoolean(frameSlot); - if (visibility != null) { - RArguments.getCall(frame).setVisibility(visibility == Boolean.TRUE); + if (frame.isBoolean(frameSlot)) { + RArguments.getCall(frame).setVisibility(frame.getBoolean(frameSlot) == Boolean.TRUE); + } else { + CompilerDirectives.transferToInterpreter(); + /* + * Most likely the (only) builtin call in the function was configured to + * RVisibility.CUSTOM and didn't actually set the visibility. Another possible + * problem is a node that is created by RASTBuilder that does not set visibility. + */ + throw RInternalError.shouldNotReachHere("visibility not set at the end of " + root.getName()); } } catch (FrameSlotTypeException e) { throw RInternalError.shouldNotReachHere(e); @@ -102,6 +111,7 @@ public final class SetVisibilityNode extends Node { * Slow-path version of {@link #executeAfterCall(VirtualFrame, RCaller)}. */ public static void executeAfterCallSlowPath(Frame frame, RCaller caller) { + CompilerAsserts.neverPartOfCompilation(); frame.setBoolean(frame.getFrameDescriptor().findOrAddFrameSlot(RFrameSlot.Visibility, FrameSlotKind.Boolean), caller.getVisibility()); } } diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/CastListNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/CastListNode.java index 14ea322f9f4f9e49447990349ea395b987d9f135..606b54d966886466339e13999070d035d9622b8c 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/CastListNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/CastListNode.java @@ -101,8 +101,8 @@ public abstract class CastListNode extends CastBaseNode { if (attr.getName().equals(RRuntime.CLASS_ATTR_KEY)) { if (setClassAttrNode == null) { - setClassAttrNode = insert(SetClassAttributeNode.create()); CompilerDirectives.transferToInterpreterAndInvalidate(); + setClassAttrNode = insert(SetClassAttributeNode.create()); } setClassAttrNode.execute(result, attr.getValue()); diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/FastROptions.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/FastROptions.java index f0005b639aa32fc19806700f8fc22b15120367ad..767d9529d17dc088decc4f2074ea812f7b27f6bf 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/FastROptions.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/FastROptions.java @@ -53,6 +53,7 @@ public enum FastROptions { RefCountIncrementOnly("Disable reference count decrements for experimental state transition implementation", false), UseInternalGraphics("Whether the internal (Java) graphics subsystem should be used", false), UseSpecials("Whether the fast-path special call nodes should be created for simple enough arguments.", true), + ForceSources("Generate source sections for unserialized code", false), // Promises optimizations EagerEval("If enabled, overrides all other EagerEval switches (see EagerEvalHelper)", false), diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RCompression.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RCompression.java index 785970bd521f4d6985aa39935494d65c5a51df3a..ca59c7286623759f03f7c9623aa1f4af9a706e41 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RCompression.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RCompression.java @@ -22,14 +22,19 @@ */ package com.oracle.truffle.r.runtime; +import java.io.ByteArrayInputStream; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.lang.ProcessBuilder.Redirect; +import java.nio.file.Files; +import java.nio.file.OpenOption; +import java.nio.file.Paths; +import java.nio.file.StandardOpenOption; +import java.util.Arrays; import java.util.zip.GZIPInputStream; - -import com.oracle.truffle.r.runtime.conn.GZIPConnections.GZIPRConnection; +import org.tukaani.xz.LZMA2InputStream; import com.oracle.truffle.r.runtime.ffi.RFFIFactory; /** @@ -41,7 +46,7 @@ public class RCompression { NONE('0'), GZIP('1'), BZIP2('2'), - LZMA('Z'); + XZ('Z'); public final byte typeByte; @@ -70,7 +75,7 @@ public class RCompression { } else if (buf[0] == 'B' && buf[1] == 'Z' && buf[2] == 'h') { return RCompression.Type.BZIP2; } else if (buf[0] == (byte) 0xFD && buf[1] == '7' && buf[2] == 'z' && buf[3] == 'X' && buf[4] == 'Z') { - return RCompression.Type.LZMA; + return RCompression.Type.XZ; } else { return RCompression.Type.NONE; } @@ -88,6 +93,15 @@ public class RCompression { return RCompression.Type.NONE; } + /** + * Uncompress for internal use in {@code LazyLoadDBFetch} where size of uncompressed data is + * known. + * + * @param type compression type + * @param udata where to store uncompressed data + * @param cdata data to uncompress + * @return {@code true} iff success + */ public static boolean uncompress(Type type, byte[] udata, byte[] cdata) { switch (type) { case NONE: @@ -97,7 +111,7 @@ public class RCompression { return gzipUncompress(udata, cdata); case BZIP2: throw RInternalError.unimplemented("BZIP2 compression"); - case LZMA: + case XZ: return lzmaUncompress(udata, cdata); default: assert false; @@ -105,6 +119,15 @@ public class RCompression { } } + /** + * Uncompress for internal use in {@code LazyLoadDBInsertValue} where size of uncompressed data + * is known. + * + * @param type compression type + * @param udata uncompressed data + * @param cdata where to store compressed data + * @return {@code true} iff success + */ public static boolean compress(Type type, byte[] udata, byte[] cdata) { switch (type) { case NONE: @@ -114,7 +137,7 @@ public class RCompression { return gzipCompress(udata, cdata); case BZIP2: throw RInternalError.unimplemented("BZIP2 compression"); - case LZMA: + case XZ: return lzmaCompress(udata, cdata); default: assert false; @@ -132,6 +155,10 @@ public class RCompression { return rc == 0; } + /** + * There is no obvious counterpart to {@link LZMA2InputStream} and according to the XZ forum it + * is not implemented for Java, so have to use sub-process. + */ private static boolean lzmaCompress(byte[] udata, byte[] cdata) { int rc; ProcessBuilder pb = new ProcessBuilder("xz", "--compress", "--format=raw", "--lzma2", "--stdout"); @@ -157,67 +184,64 @@ public class RCompression { } private static boolean lzmaUncompress(byte[] udata, byte[] data) { - int rc; - ProcessBuilder pb = new ProcessBuilder("xz", "--decompress", "--format=raw", "--lzma2", "--stdout"); + int dictSize = udata.length < LZMA2InputStream.DICT_SIZE_MIN ? LZMA2InputStream.DICT_SIZE_MIN : udata.length; + try (LZMA2InputStream lzmaStream = new LZMA2InputStream(new ByteArrayInputStream(data), dictSize)) { + int totalRead = 0; + int n; + while ((n = lzmaStream.read(udata, totalRead, udata.length - totalRead)) > 0) { + totalRead += n; + } + return totalRead == udata.length; + } catch (IOException ex) { + return false; + } + } + + public static byte[] bzipUncompressFromFile(String path) throws IOException { + String[] command = new String[]{"bzip2", "-dc", path}; + ProcessBuilder pb = new ProcessBuilder(command); pb.redirectError(Redirect.INHERIT); + Process p = pb.start(); + InputStream is = p.getInputStream(); + ProcessOutputManager.OutputThreadVariable readThread = new ProcessOutputManager.OutputThreadVariable(command[0], is); + readThread.start(); try { - Process p = pb.start(); - OutputStream os = p.getOutputStream(); - InputStream is = p.getInputStream(); - ProcessOutputManager.OutputThread readThread = new ProcessOutputManager.OutputThreadFixed("xz", is, udata); - readThread.start(); - os.write(data); - os.close(); - rc = p.waitFor(); + int rc = p.waitFor(); if (rc == 0) { readThread.join(); - if (readThread.totalRead != udata.length) { - return false; - } + return Arrays.copyOf(readThread.getData(), readThread.getTotalRead()); } - } catch (InterruptedException | IOException ex) { - return false; + } catch (InterruptedException ex) { + // fall through } - return rc == 0; - } - - /** - * This is used by {@link GZIPRConnection}. - */ - public static byte[] lzmaUncompressFromFile(String path) { - return genericUncompressFromFile(new String[]{"xz", "--decompress", "--lzma2", "--stdout", path}); - } - - public static byte[] bzipUncompressFromFile(String path) { - return genericUncompressFromFile(new String[]{"bzip2", "-dc", path}); + throw new IOException(); } - private static byte[] genericUncompressFromFile(String[] command) { + public static void bzipCompressToFile(byte[] data, String path, boolean append) throws IOException { + String[] command = new String[]{"bzip2", "-zc"}; int rc; ProcessBuilder pb = new ProcessBuilder(command); pb.redirectError(Redirect.INHERIT); + Process p = pb.start(); + InputStream is = p.getInputStream(); + OutputStream os = p.getOutputStream(); + ProcessOutputManager.OutputThreadVariable readThread = new ProcessOutputManager.OutputThreadVariable(command[0], is); + readThread.start(); + os.write(data); + os.close(); try { - Process p = pb.start(); - InputStream is = p.getInputStream(); - ProcessOutputManager.OutputThreadVariable readThread = new ProcessOutputManager.OutputThreadVariable(command[0], is); - readThread.start(); rc = p.waitFor(); if (rc == 0) { readThread.join(); - return readThread.getData(); + byte[] cData = Arrays.copyOf(readThread.getData(), readThread.getTotalRead()); + OpenOption[] openOptions = append ? new OpenOption[]{StandardOpenOption.APPEND} : new OpenOption[0]; + Files.write(Paths.get(path), cData, openOptions); + return; } - } catch (InterruptedException | IOException ex) { + } catch (InterruptedException ex) { // fall through } - throw RInternalError.shouldNotReachHere(join(command)); + throw new IOException(); } - private static String join(String[] args) { - StringBuilder sb = new StringBuilder(); - for (String s : args) { - sb.append(s); - sb.append(' '); - } - return sb.toString(); - } } diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RError.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RError.java index 39504baf8e90020ba7d51c19460d27a600f91e3e..e61db9860abc7e1c0f104a9ab3636eca04da66f1 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RError.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RError.java @@ -527,6 +527,7 @@ public final class RError extends RuntimeException { NA_IN_PROB_VECTOR("NA in probability vector"), NEGATIVE_PROBABILITY("negative probability"), NO_POSITIVE_PROBABILITIES("no positive probabilities"), + QBETA_ACURACY_WARNING("qbeta(a, *) =: x0 with |pbeta(x0,*%s) - alpha| = %.5g is not accurate"), NON_POSITIVE_FILL("non-positive 'fill' argument will be ignored"), MUST_BE_ONE_BYTE("invalid %s: must be one byte"), INVALID_DECIMAL_SEP("invalid decimal separator"), diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RErrorHandling.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RErrorHandling.java index af99cbf6c7b6d7d62046e0d61ddd373c17a9866a..4b5b757cc622462911f7785b5707fdea6293530a 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RErrorHandling.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RErrorHandling.java @@ -215,6 +215,16 @@ public class RErrorHandling { errorHandlingState.restartStack = savedRestartStack; } + public static void restoreHandlerStack(Object savedHandlerStack) { + ContextStateImpl errorHandlingState = getRErrorHandlingState(); + errorHandlingState.handlerStack = savedHandlerStack; + } + + public static void restoreRestartStack(Object savedRestartStack) { + ContextStateImpl errorHandlingState = getRErrorHandlingState(); + errorHandlingState.restartStack = savedRestartStack; + } + public static Object createHandlers(RAbstractStringVector classes, RList handlers, REnvironment parentEnv, Object target, byte calling) { CompilerAsserts.neverPartOfCompilation(); Object oldStack = getRestartStack(); diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/Utils.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/Utils.java index 2562d2a0cb7881d5082219922dec5532d14746f9..f4f61fb5edcf57d2c3ffa6a1f4b517f9fd675de2 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/Utils.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/Utils.java @@ -550,48 +550,58 @@ public final class Utils { } private static void dumpFrame(StringBuilder str, CallTarget callTarget, Frame frame, boolean printFrameSlots, boolean isVirtual) { - if (str.length() > 0) { - str.append("\n"); - } - Frame unwrapped = RArguments.unwrap(frame); - if (!RArguments.isRFrame(unwrapped)) { - if (unwrapped.getArguments().length == 0) { - str.append("<empty frame>"); - } else { - str.append("<unknown frame>"); - } - } else { - if (callTarget.toString().equals("<promise>")) { - /* these have the same depth as the next frame, and add no useful info. */ - return; - } - RCaller call = RArguments.getCall(unwrapped); - if (call != null) { - String callSrc = call.isValidCaller() ? RContext.getRRuntimeASTAccess().getCallerSource(call) : "<invalid call>"; - int depth = RArguments.getDepth(unwrapped); - str.append("Frame(d=").append(depth).append("): ").append(callTarget).append(isVirtual ? " (virtual)" : ""); - str.append(" (called as: ").append(callSrc).append(')'); + try { + CompilerAsserts.neverPartOfCompilation(); + if (str.length() > 0) { + str.append("\n"); } - if (printFrameSlots) { - FrameDescriptor frameDescriptor = unwrapped.getFrameDescriptor(); - for (FrameSlot s : frameDescriptor.getSlots()) { - str.append("\n ").append(s.getIdentifier()).append(" = "); - Object value = unwrapped.getValue(s); - try { - if (value instanceof RAbstractContainer && ((RAbstractContainer) value).getLength() > 32) { - str.append('<').append(value.getClass().getSimpleName()).append(" with ").append(((RAbstractContainer) value).getLength()).append(" elements>"); - } else { - String text = String.valueOf(value); - str.append(text.length() < 256 ? text : text.substring(0, 256) + "..."); + Frame unwrapped = RArguments.unwrap(frame); + if (!RArguments.isRFrame(unwrapped)) { + if (unwrapped.getArguments().length == 0) { + str.append("<empty frame>"); + } else { + str.append("<unknown frame>"); + } + } else { + if (callTarget.toString().equals("<promise>")) { + /* these have the same depth as the next frame, and add no useful info. */ + return; + } + RCaller call = RArguments.getCall(unwrapped); + if (call != null) { + String callSrc = call.isValidCaller() ? RContext.getRRuntimeASTAccess().getCallerSource(call) : "<invalid call>"; + int depth = RArguments.getDepth(unwrapped); + str.append("Frame(d=").append(depth).append("): ").append(callTarget).append(isVirtual ? " (virtual)" : ""); + str.append(" (called as: ").append(callSrc).append(')'); + } + if (printFrameSlots) { + FrameDescriptor frameDescriptor = unwrapped.getFrameDescriptor(); + for (FrameSlot s : frameDescriptor.getSlots()) { + str.append("\n ").append(s.getIdentifier()).append(" = "); + Object value; + try { + value = unwrapped.getValue(s); + } catch (Throwable t) { + str.append("<exception ").append(t.getClass().getSimpleName()).append(" while acquiring slot ").append(s.getIdentifier()).append(">"); + continue; + } + try { + if (value instanceof RAbstractContainer && ((RAbstractContainer) value).getLength() > 32) { + str.append('<').append(value.getClass().getSimpleName()).append(" with ").append(((RAbstractContainer) value).getLength()).append(" elements>"); + } else { + String text = String.valueOf(value); + str.append(text.length() < 256 ? text : text.substring(0, 256) + "..."); + } + } catch (Throwable t) { + // RLanguage values may not react kindly to getLength() calls + str.append("<exception ").append(t.getClass().getSimpleName()).append(" while printing value of type ").append( + value == null ? "null" : value.getClass().getSimpleName()).append('>'); } - } catch (Throwable t) { - // RLanguage values may not react kindly to getLength() calls - str.append("<exception ").append(t.getClass().getSimpleName()).append(" while printing value of type ").append( - value == null ? "null" : value.getClass().getSimpleName()).append( - '>'); } } } + } catch (Throwable t) { + str.append("<exception ").append(t.getMessage()).append(" ").append(t.getClass().getSimpleName()).append("<"); } } diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/conn/GZIPConnections.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/conn/CompressedConnections.java similarity index 55% rename from com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/conn/GZIPConnections.java rename to com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/conn/CompressedConnections.java index 0928fe7df3d31e81432526ff5988f60fb0eebb83..4530f65c9fdf88e51cd6f695f3837f15e0fe423d 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/conn/GZIPConnections.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/conn/CompressedConnections.java @@ -23,6 +23,7 @@ package com.oracle.truffle.r.runtime.conn; import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; @@ -32,8 +33,15 @@ import java.nio.ByteBuffer; import java.util.zip.GZIPInputStream; import java.util.zip.GZIPOutputStream; +import org.tukaani.xz.LZMA2Options; +import org.tukaani.xz.XZ; +import org.tukaani.xz.XZInputStream; +import org.tukaani.xz.XZOutputStream; + import com.oracle.truffle.r.runtime.RCompression; +import com.oracle.truffle.r.runtime.RCompression.Type; import com.oracle.truffle.r.runtime.RError; +import com.oracle.truffle.r.runtime.RInternalError; import com.oracle.truffle.r.runtime.conn.ConnectionSupport.AbstractOpenMode; import com.oracle.truffle.r.runtime.conn.ConnectionSupport.BasePathRConnection; import com.oracle.truffle.r.runtime.conn.ConnectionSupport.ConnectionClass; @@ -43,20 +51,42 @@ import com.oracle.truffle.r.runtime.conn.ConnectionSupport.DelegateWriteRConnect import com.oracle.truffle.r.runtime.conn.ConnectionSupport.ReadWriteHelper; import com.oracle.truffle.r.runtime.data.model.RAbstractStringVector; -public class GZIPConnections { +public class CompressedConnections { public static final int GZIP_BUFFER_SIZE = (2 << 20); /** - * Base class for all modes of gzfile connections. N.B. gzfile is defined to be able to read - * gzip, bzip, lzma and uncompressed files, which has to be implemented by reading the first few - * bytes of the file and detecting the type of the file. + * Base class for all modes of gzfile/bzfile/xzfile connections. N.B. In GNU R these can read + * gzip, bzip, lzma and uncompressed files, and this has to be implemented by reading the first + * few bytes of the file and detecting the type of the file. */ - public static class GZIPRConnection extends BasePathRConnection { - public GZIPRConnection(String path, String modeString) throws IOException { - super(path, ConnectionClass.GZFile, modeString, AbstractOpenMode.ReadBinary); + public static class CompressedRConnection extends BasePathRConnection { + private final RCompression.Type cType; + @SuppressWarnings("unused") private final String encoding; // TODO + @SuppressWarnings("unused") private final int compression; // TODO + + public CompressedRConnection(String path, String modeString, Type cType, String encoding, int compression) throws IOException { + super(path, mapConnectionClass(cType), modeString, AbstractOpenMode.ReadBinary); + this.cType = cType; + this.encoding = encoding; + this.compression = compression; openNonLazyConnection(); } + private static ConnectionClass mapConnectionClass(RCompression.Type cType) { + switch (cType) { + case NONE: + return ConnectionClass.File; + case GZIP: + return ConnectionClass.GZFile; + case BZIP2: + return ConnectionClass.BZFile; + case XZ: + return ConnectionClass.XZFile; + default: + throw RInternalError.shouldNotReachHere(); + } + } + @Override protected void createDelegateConnection() throws IOException { DelegateRConnection delegate = null; @@ -64,8 +94,15 @@ public class GZIPConnections { switch (openMode) { case Read: case ReadBinary: - RCompression.Type cType = RCompression.getCompressionType(path); - switch (cType) { + /* + * For input, we check the actual compression type as GNU R is permissive about + * the claimed type. + */ + RCompression.Type cTypeActual = RCompression.getCompressionType(path); + if (cTypeActual != cType) { + updateConnectionClass(mapConnectionClass(cTypeActual)); + } + switch (cTypeActual) { case NONE: if (openMode == AbstractOpenMode.ReadBinary) { delegate = new FileConnections.FileReadBinaryRConnection(this); @@ -74,26 +111,36 @@ public class GZIPConnections { } break; case GZIP: - delegate = new GZIPInputRConnection(this); + delegate = new CompressedInputRConnection(this, new GZIPInputStream(new FileInputStream(path), GZIP_BUFFER_SIZE)); break; - case LZMA: - /* - * no lzma support in Java. For now we use RCompression to a byte array - * and return a ByteArrayInputStream on that. - */ - byte[] lzmaUdata = RCompression.lzmaUncompressFromFile(path); - delegate = new ByteGZipInputRConnection(this, new ByteArrayInputStream(lzmaUdata)); + case XZ: + delegate = new CompressedInputRConnection(this, new XZInputStream(new FileInputStream(path))); break; case BZIP2: - // ditto + // no in Java support, so go via byte array byte[] bzipUdata = RCompression.bzipUncompressFromFile(path); - delegate = new ByteGZipInputRConnection(this, new ByteArrayInputStream(bzipUdata)); + delegate = new ByteStreamCompressedInputRConnection(this, new ByteArrayInputStream(bzipUdata)); } break; + + case Append: + case AppendBinary: case Write: - case WriteBinary: - delegate = new GZIPOutputRConnection(this); + case WriteBinary: { + boolean append = openMode == AbstractOpenMode.Append || openMode == AbstractOpenMode.AppendBinary; + switch (cType) { + case GZIP: + delegate = new CompressedOutputRConnection(this, new GZIPOutputStream(new FileOutputStream(path, append), GZIP_BUFFER_SIZE)); + break; + case BZIP2: + delegate = new BZip2OutputRConnection(this, new ByteArrayOutputStream(), append); + break; + case XZ: + delegate = new CompressedOutputRConnection(this, new XZOutputStream(new FileOutputStream(path, append), new LZMA2Options(), XZ.CHECK_CRC32)); + break; + } break; + } default: throw RError.nyi(RError.SHOW_CALLER2, "open mode: " + getOpenMode()); } @@ -109,15 +156,10 @@ public class GZIPConnections { // } } - private static class GZIPInputRConnection extends DelegateReadRConnection implements ReadWriteHelper { + private static class CompressedInputRConnection extends DelegateReadRConnection implements ReadWriteHelper { private InputStream inputStream; - GZIPInputRConnection(GZIPRConnection base) throws IOException { - super(base); - inputStream = new GZIPInputStream(new FileInputStream(base.path), GZIP_BUFFER_SIZE); - } - - protected GZIPInputRConnection(GZIPRConnection base, InputStream is) { + protected CompressedInputRConnection(CompressedRConnection base, InputStream is) { super(base); this.inputStream = is; } @@ -159,18 +201,18 @@ public class GZIPConnections { } } - private static class ByteGZipInputRConnection extends GZIPInputRConnection { - ByteGZipInputRConnection(GZIPRConnection base, ByteArrayInputStream is) { + private static class ByteStreamCompressedInputRConnection extends CompressedInputRConnection { + ByteStreamCompressedInputRConnection(CompressedRConnection base, ByteArrayInputStream is) { super(base, is); } } - private static class GZIPOutputRConnection extends DelegateWriteRConnection implements ReadWriteHelper { - private GZIPOutputStream outputStream; + private static class CompressedOutputRConnection extends DelegateWriteRConnection implements ReadWriteHelper { + protected OutputStream outputStream; - GZIPOutputRConnection(GZIPRConnection base) throws IOException { + protected CompressedOutputRConnection(CompressedRConnection base, OutputStream os) { super(base); - outputStream = new GZIPOutputStream(new FileOutputStream(base.path), GZIP_BUFFER_SIZE); + this.outputStream = os; } @Override @@ -215,4 +257,25 @@ public class GZIPConnections { outputStream.flush(); } } + + private static class BZip2OutputRConnection extends CompressedOutputRConnection { + private final ByteArrayOutputStream bos; + private final boolean append; + + BZip2OutputRConnection(CompressedRConnection base, ByteArrayOutputStream os, boolean append) { + super(base, os); + this.bos = os; + this.append = append; + } + + @Override + public void close() throws IOException { + flush(); + outputStream.close(); + // Now actually do the compression using sub-process + byte[] data = bos.toByteArray(); + RCompression.bzipCompressToFile(data, ((BasePathRConnection) base).path, append); + } + } + } diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/conn/ConnectionSupport.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/conn/ConnectionSupport.java index e53c581f1a97c8d6741feb1e4dbb16d038e5a219..25922b8644237f0845edce7260dae41b5560c662 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/conn/ConnectionSupport.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/conn/ConnectionSupport.java @@ -308,6 +308,8 @@ public class ConnectionSupport { Terminal("terminal"), File("file"), GZFile("gzfile"), + BZFile("bzfile"), + XZFile("xzfile"), Socket("sockconn"), Text("textConnection"), URL("url"), @@ -511,7 +513,7 @@ public class ConnectionSupport { */ private int descriptor; - private final ConnectionClass conClass; + private ConnectionClass conClass; /** * The constructor for every connection class except {@link StdConnections}. @@ -548,6 +550,13 @@ public class ConnectionSupport { return conClass; } + /** + * {@code gzfile} can open other connection classes, and this isn't known initially. + */ + public final void updateConnectionClass(ConnectionClass conClass) { + this.conClass = conClass; + } + protected void openNonLazyConnection() throws IOException { if (openMode.abstractOpenMode != AbstractOpenMode.Lazy) { createDelegateConnection(); diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/conn/FileConnections.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/conn/FileConnections.java index 0c02b5bbe9c8164f46e13be57d5b16e3ef3aeccb..0d9d532e6b8067c4cd06176db2782bde0f2c6513 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/conn/FileConnections.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/conn/FileConnections.java @@ -24,6 +24,7 @@ package com.oracle.truffle.r.runtime.conn; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; +import java.io.ByteArrayInputStream; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; @@ -33,6 +34,8 @@ import java.io.RandomAccessFile; import java.nio.ByteBuffer; import java.util.zip.GZIPInputStream; +import org.tukaani.xz.XZInputStream; + import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary; import com.oracle.truffle.r.runtime.RCompression; import com.oracle.truffle.r.runtime.RError; @@ -110,7 +113,15 @@ public class FileConnections { inputStream = new BufferedInputStream(new FileInputStream(base.path)); break; case GZIP: - inputStream = new GZIPInputStream(new FileInputStream(base.path), GZIPConnections.GZIP_BUFFER_SIZE); + inputStream = new GZIPInputStream(new FileInputStream(base.path), CompressedConnections.GZIP_BUFFER_SIZE); + break; + case BZIP2: + // no in Java support, so go via byte array + byte[] bzipUdata = RCompression.bzipUncompressFromFile(base.path); + inputStream = new ByteArrayInputStream(bzipUdata); + break; + case XZ: + inputStream = new XZInputStream(new FileInputStream(base.path)); break; default: throw RError.nyi(RError.SHOW_CALLER2, "compression type: " + cType.name()); diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/env/frame/RFrameSlot.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/env/frame/RFrameSlot.java index 81e2536a03764a896477ce6218dd8856acaaa115..e303fac170654063244a601a7b1891c87fb7e9cb 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/env/frame/RFrameSlot.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/env/frame/RFrameSlot.java @@ -51,5 +51,13 @@ public enum RFrameSlot { * each call site, the value of {@link RCaller#getVisibility()} is extracted and stored into the * frame slot. */ - Visibility; + Visibility, + /** + * Used to save the handler stack in frames that modify it. + */ + HandlerStack, + /** + * Used to save the restart stack in frames that modify it. + */ + RestartStack } 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 e2a1e08eea91c971c252535a6fcf9a5212b842de..4dad57349fa713356bf4d4918aa9edb3bfe5f9a8 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 @@ -50624,7 +50624,7 @@ foo.bar(y, 42) #{ foo<-function(x, z) UseMethod("foo"); foo.baz<-function(x, z) NextMethod(); y<-1; class(y)<-c("baz", "bar"); foo.bar<-function(x, z) sys.call(0); foo(y, 42) } foo.bar(y, 42) -##com.oracle.truffle.r.test.builtins.TestBuiltin_syscall.testSysCall# +##com.oracle.truffle.r.test.builtins.TestBuiltin_syscall.testSysCall#Output.IgnoreWhitespace# #{ x<-(function(f) f())(function() sys.call(1)); list(x[[1]], x[[2]][[1]], x[[2]][[2]], x[[2]][[3]]) } [[1]] (function(f) f()) @@ -55237,6 +55237,66 @@ attr(,"id") attr(,"id") [1] "An Example" +##com.oracle.truffle.r.test.builtins.TestBuiltin_zzfile.test1# +#{ f <- tempfile(); c <- bzfile(f); writeLines(as.character(1:100), c); close(c); readLines(f) } + [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" + [13] "13" "14" "15" "16" "17" "18" "19" "20" "21" "22" "23" "24" + [25] "25" "26" "27" "28" "29" "30" "31" "32" "33" "34" "35" "36" + [37] "37" "38" "39" "40" "41" "42" "43" "44" "45" "46" "47" "48" + [49] "49" "50" "51" "52" "53" "54" "55" "56" "57" "58" "59" "60" + [61] "61" "62" "63" "64" "65" "66" "67" "68" "69" "70" "71" "72" + [73] "73" "74" "75" "76" "77" "78" "79" "80" "81" "82" "83" "84" + [85] "85" "86" "87" "88" "89" "90" "91" "92" "93" "94" "95" "96" + [97] "97" "98" "99" "100" + +##com.oracle.truffle.r.test.builtins.TestBuiltin_zzfile.test1# +#{ f <- tempfile(); c <- gzfile(f); writeLines(as.character(1:100), c); close(c); readLines(f) } + [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" + [13] "13" "14" "15" "16" "17" "18" "19" "20" "21" "22" "23" "24" + [25] "25" "26" "27" "28" "29" "30" "31" "32" "33" "34" "35" "36" + [37] "37" "38" "39" "40" "41" "42" "43" "44" "45" "46" "47" "48" + [49] "49" "50" "51" "52" "53" "54" "55" "56" "57" "58" "59" "60" + [61] "61" "62" "63" "64" "65" "66" "67" "68" "69" "70" "71" "72" + [73] "73" "74" "75" "76" "77" "78" "79" "80" "81" "82" "83" "84" + [85] "85" "86" "87" "88" "89" "90" "91" "92" "93" "94" "95" "96" + [97] "97" "98" "99" "100" + +##com.oracle.truffle.r.test.builtins.TestBuiltin_zzfile.test1# +#{ f <- tempfile(); c <- xzfile(f); writeLines(as.character(1:100), c); close(c); readLines(f) } + [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" + [13] "13" "14" "15" "16" "17" "18" "19" "20" "21" "22" "23" "24" + [25] "25" "26" "27" "28" "29" "30" "31" "32" "33" "34" "35" "36" + [37] "37" "38" "39" "40" "41" "42" "43" "44" "45" "46" "47" "48" + [49] "49" "50" "51" "52" "53" "54" "55" "56" "57" "58" "59" "60" + [61] "61" "62" "63" "64" "65" "66" "67" "68" "69" "70" "71" "72" + [73] "73" "74" "75" "76" "77" "78" "79" "80" "81" "82" "83" "84" + [85] "85" "86" "87" "88" "89" "90" "91" "92" "93" "94" "95" "96" + [97] "97" "98" "99" "100" + +##com.oracle.truffle.r.test.builtins.TestBuiltin_zzfile.test2# +#{ f <- tempfile(); c <- bzfile(f); writeLines(as.character(1:50), c); close(c); c <- bzfile(f, "a"); writeLines(as.character(51:70), c); close(c); readLines(f) } + [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" "13" "14" "15" +[16] "16" "17" "18" "19" "20" "21" "22" "23" "24" "25" "26" "27" "28" "29" "30" +[31] "31" "32" "33" "34" "35" "36" "37" "38" "39" "40" "41" "42" "43" "44" "45" +[46] "46" "47" "48" "49" "50" "51" "52" "53" "54" "55" "56" "57" "58" "59" "60" +[61] "61" "62" "63" "64" "65" "66" "67" "68" "69" "70" + +##com.oracle.truffle.r.test.builtins.TestBuiltin_zzfile.test2# +#{ f <- tempfile(); c <- gzfile(f); writeLines(as.character(1:50), c); close(c); c <- gzfile(f, "a"); writeLines(as.character(51:70), c); close(c); readLines(f) } + [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" "13" "14" "15" +[16] "16" "17" "18" "19" "20" "21" "22" "23" "24" "25" "26" "27" "28" "29" "30" +[31] "31" "32" "33" "34" "35" "36" "37" "38" "39" "40" "41" "42" "43" "44" "45" +[46] "46" "47" "48" "49" "50" "51" "52" "53" "54" "55" "56" "57" "58" "59" "60" +[61] "61" "62" "63" "64" "65" "66" "67" "68" "69" "70" + +##com.oracle.truffle.r.test.builtins.TestBuiltin_zzfile.test2# +#{ f <- tempfile(); c <- xzfile(f); writeLines(as.character(1:50), c); close(c); c <- xzfile(f, "a"); writeLines(as.character(51:70), c); close(c); readLines(f) } + [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" "13" "14" "15" +[16] "16" "17" "18" "19" "20" "21" "22" "23" "24" "25" "26" "27" "28" "29" "30" +[31] "31" "32" "33" "34" "35" "36" "37" "38" "39" "40" "41" "42" "43" "44" "45" +[46] "46" "47" "48" "49" "50" "51" "52" "53" "54" "55" "56" "57" "58" "59" "60" +[61] "61" "62" "63" "64" "65" "66" "67" "68" "69" "70" + ##com.oracle.truffle.r.test.builtins.TestMiscBuiltins.testArrayConstructors# #{ character(1L) } [1] "" @@ -59309,6 +59369,11 @@ f first 1 #{f<-function(x){UseMethod("f")};f.logical<-function(x){print("logical")};f(TRUE)} [1] "logical" +##com.oracle.truffle.r.test.library.base.TestConditionHandling.testTryCatch# +#{ e <- simpleError("test error"); f <- function() { tryCatch(1, finally = print("Hello")); stop(e)}; f() } +[1] "Hello" +Error: test error + ##com.oracle.truffle.r.test.library.base.TestConditionHandling.testTryCatch# #{ e <- simpleError("test error"); tryCatch(stop(e), error = function(e) e, finally = print("Hello"))} [1] "Hello" @@ -59319,6 +59384,14 @@ f first 1 Error: test error [1] "Hello" +##com.oracle.truffle.r.test.library.base.TestConditionHandling.testTryCatch# +#{ f <- function() { tryCatch(1, error = function(e) print("Hello")); stop("fred")}; f() } +Error in f() : fred + +##com.oracle.truffle.r.test.library.base.TestConditionHandling.testTryCatch# +#{ f <- function() { tryCatch(stop("fred"), error = function(e) print("Hello"))}; f() } +[1] "Hello" + ##com.oracle.truffle.r.test.library.base.TestConditionHandling.testTryCatch# #{ tryCatch(1, finally = print("Hello")) } [1] "Hello" @@ -111391,6 +111464,16 @@ a b c d e #if (length(grep("FastR", R.Version()$version.string)) != 1) { as.character(123) } else { .fastr.interop.eval('application/x-r', 'as.character(123)') } [1] "123" +##com.oracle.truffle.r.test.library.fastr.TestInterop.testInteropEvalFile# +#if (length(grep("FastR", R.Version()$version.string)) != 1) { cat('[1] "Error reading file: /a/b.R"\n') } else { tryCatch(.fastr.interop.evalFile("/a/b.R"), error = function(e) e$message) } +[1] "Error reading file: /a/b.R" + +##com.oracle.truffle.r.test.library.fastr.TestInterop.testInteropEvalFile# +#if (length(grep("FastR", R.Version()$version.string)) != 1) { x<-c(1);cat(x) } else { fileConn<-file("testScript.R");writeLines(c("x<-c(1)","cat(x)"), fileConn);close(fileConn);.fastr.interop.evalFile("testScript.R") } +1 +##com.oracle.truffle.r.test.library.fastr.TestInterop.testInteropEvalFile# +#if (length(grep("FastR", R.Version()$version.string)) != 1) { x<-c(1);cat(x) } else { fileConn<-file("testScript.R");writeLines(c("x<-c(1)","cat(x)"), fileConn);close(fileConn);.fastr.interop.evalFile("testScript.R","application/x-r") } +1 ##com.oracle.truffle.r.test.library.fastr.TestInterop.testInteropExport# #if (length(grep("FastR", R.Version()$version.string)) != 1) { invisible() } else { .fastr.interop.export('foo', 'foo') } @@ -111492,6 +111575,157 @@ Error: 'x' is NULL #.Call(stats:::C_cov, c('1','2','3','4','5'), 1:5, 4, FALSE) [1] 2.5 +##com.oracle.truffle.r.test.library.stats.TestExternal_qbeta.testQBeta# +#qbeta(0.1, 0, 0, lower.tail=F, log.p=F) +[1] 0 + +##com.oracle.truffle.r.test.library.stats.TestExternal_qbeta.testQBeta# +#qbeta(0.1, 0, 0, lower.tail=T, log.p=F) +[1] 0 + +##com.oracle.truffle.r.test.library.stats.TestExternal_qbeta.testQBeta# +#qbeta(0.5, 0, 0, lower.tail=F, log.p=F) +[1] 0.5 + +##com.oracle.truffle.r.test.library.stats.TestExternal_qbeta.testQBeta# +#qbeta(0.5, 0, 0, lower.tail=T, log.p=F) +[1] 0.5 + +##com.oracle.truffle.r.test.library.stats.TestExternal_qbeta.testQBeta# +#qbeta(0.7, 0, 0, lower.tail=F, log.p=F) +[1] 1 + +##com.oracle.truffle.r.test.library.stats.TestExternal_qbeta.testQBeta# +#qbeta(0.7, 0, 0, lower.tail=T, log.p=F) +[1] 1 + +##com.oracle.truffle.r.test.library.stats.TestExternal_qbeta.testQBeta# +#qbeta(0.7, 0, 1/0, lower.tail=F, log.p=F) +[1] 0 + +##com.oracle.truffle.r.test.library.stats.TestExternal_qbeta.testQBeta# +#qbeta(0.7, 0, 1/0, lower.tail=T, log.p=F) +[1] 0 + +##com.oracle.truffle.r.test.library.stats.TestExternal_qbeta.testQBeta# +#qbeta(0.7, 1/0, 0, lower.tail=F, log.p=F) +[1] 1 + +##com.oracle.truffle.r.test.library.stats.TestExternal_qbeta.testQBeta# +#qbeta(0.7, 1/0, 0, lower.tail=T, log.p=F) +[1] 1 + +##com.oracle.truffle.r.test.library.stats.TestExternal_qbeta.testQBeta#Output.MayIgnoreWarningContext# +#qbeta(log(0), -1, 3, lower.tail=T, log.p=T) +[1] NaN +Warning message: +In qbeta(log(0), -1, 3, lower.tail = T, log.p = T) : NaNs produced + +##com.oracle.truffle.r.test.library.stats.TestExternal_qbeta.testQBeta# +#qbeta(log(0), 0.1, 3, lower.tail=T, log.p=T) +[1] 0 + +##com.oracle.truffle.r.test.library.stats.TestExternal_qbeta.testQBeta#Output.MayIgnoreWarningContext# +#qbeta(log(0.1), -1, 3, lower.tail=T, log.p=T) +[1] NaN +Warning message: +In qbeta(log(0.1), -1, 3, lower.tail = T, log.p = T) : NaNs produced + +##com.oracle.truffle.r.test.library.stats.TestExternal_qbeta.testQBeta# +#qbeta(log(0.1), 0, 0, lower.tail=F, log.p=T) +[1] 0 + +##com.oracle.truffle.r.test.library.stats.TestExternal_qbeta.testQBeta# +#qbeta(log(0.1), 0, 0, lower.tail=T, log.p=T) +[1] 0 + +##com.oracle.truffle.r.test.library.stats.TestExternal_qbeta.testQBeta# +#qbeta(log(0.1), 0.1, 3, lower.tail=T, log.p=T) +[1] 2.366901e-11 + +##com.oracle.truffle.r.test.library.stats.TestExternal_qbeta.testQBeta#Output.MayIgnoreWarningContext# +#qbeta(log(0.5), -1, 3, lower.tail=T, log.p=T) +[1] NaN +Warning message: +In qbeta(log(0.5), -1, 3, lower.tail = T, log.p = T) : NaNs produced + +##com.oracle.truffle.r.test.library.stats.TestExternal_qbeta.testQBeta# +#qbeta(log(0.5), 0, 0, lower.tail=F, log.p=T) +[1] 0.5 + +##com.oracle.truffle.r.test.library.stats.TestExternal_qbeta.testQBeta# +#qbeta(log(0.5), 0, 0, lower.tail=T, log.p=T) +[1] 0.5 + +##com.oracle.truffle.r.test.library.stats.TestExternal_qbeta.testQBeta# +#qbeta(log(0.5), 0.1, 3, lower.tail=T, log.p=T) +[1] 0.0002312399 + +##com.oracle.truffle.r.test.library.stats.TestExternal_qbeta.testQBeta#Output.MayIgnoreWarningContext# +#qbeta(log(0.7), -1, 3, lower.tail=T, log.p=T) +[1] NaN +Warning message: +In qbeta(log(0.7), -1, 3, lower.tail = T, log.p = T) : NaNs produced + +##com.oracle.truffle.r.test.library.stats.TestExternal_qbeta.testQBeta# +#qbeta(log(0.7), 0, 0, lower.tail=F, log.p=T) +[1] 1 + +##com.oracle.truffle.r.test.library.stats.TestExternal_qbeta.testQBeta# +#qbeta(log(0.7), 0, 0, lower.tail=T, log.p=T) +[1] 1 + +##com.oracle.truffle.r.test.library.stats.TestExternal_qbeta.testQBeta# +#qbeta(log(0.7), 0, 1/0, lower.tail=F, log.p=T) +[1] 0 + +##com.oracle.truffle.r.test.library.stats.TestExternal_qbeta.testQBeta# +#qbeta(log(0.7), 0, 1/0, lower.tail=T, log.p=T) +[1] 0 + +##com.oracle.truffle.r.test.library.stats.TestExternal_qbeta.testQBeta# +#qbeta(log(0.7), 0.1, 3, lower.tail=T, log.p=T) +[1] 0.006768603 + +##com.oracle.truffle.r.test.library.stats.TestExternal_qbeta.testQBeta# +#qbeta(log(0.7), 1/0, 0, lower.tail=F, log.p=T) +[1] 1 + +##com.oracle.truffle.r.test.library.stats.TestExternal_qbeta.testQBeta# +#qbeta(log(0.7), 1/0, 0, lower.tail=T, log.p=T) +[1] 1 + +##com.oracle.truffle.r.test.library.stats.TestExternal_qbeta.testQBeta#Output.MayIgnoreWarningContext# +#qbeta(log(1), -1, 3, lower.tail=T, log.p=T) +[1] NaN +Warning message: +In qbeta(log(1), -1, 3, lower.tail = T, log.p = T) : NaNs produced + +##com.oracle.truffle.r.test.library.stats.TestExternal_qbeta.testQBeta# +#qbeta(log(1), 0.1, 3, lower.tail=T, log.p=T) +[1] 1 + +##com.oracle.truffle.r.test.library.stats.TestExternal_qbeta.testQBeta#Output.MayIgnoreWarningContext# +#qbeta(log(1-42e-80), -1, 3, lower.tail=T, log.p=T) +[1] NaN +Warning message: +In qbeta(log(1 - 4.2e-79), -1, 3, lower.tail = T, log.p = T) : + NaNs produced + +##com.oracle.truffle.r.test.library.stats.TestExternal_qbeta.testQBeta# +#qbeta(log(1-42e-80), 0.1, 3, lower.tail=T, log.p=T) +[1] 1 + +##com.oracle.truffle.r.test.library.stats.TestExternal_qbeta.testQBeta#Output.MayIgnoreWarningContext# +#qbeta(log(42e-80), -1, 3, lower.tail=T, log.p=T) +[1] NaN +Warning message: +In qbeta(log(4.2e-79), -1, 3, lower.tail = T, log.p = T) : NaNs produced + +##com.oracle.truffle.r.test.library.stats.TestExternal_qbeta.testQBeta# +#qbeta(log(42e-80), 0.1, 3, lower.tail=T, log.p=T) +[1] 1.112537e-308 + ##com.oracle.truffle.r.test.library.stats.TestExternal_qgamma.testQgamma# #qgamma(0, 1) [1] 0 @@ -114853,6 +115087,389 @@ In pexp(c(NA, 0, NaN, 1/0, -1/0), rep(c(1, 0, 0.1), 5)) : NaNs produced #set.seed(1); pexp(rep(c(1, 0, 0.1), 5), c(NA, 0, NaN, 1/0, -1/0)) [1] NA 0 NaN 1 0 NA 0 NaN 1 -Inf NA 0 NaN 0 -Inf +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions22#Output.IgnoreWhitespace# +#set.seed(1); pgeom(0, 10, lower.tail=FALSE, log.p=FALSE) +[1] NaN +Warning message: +In pgeom(0, 10, lower.tail = FALSE, log.p = FALSE) : NaNs produced + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions22#Output.IgnoreWhitespace# +#set.seed(1); pgeom(0, 10, lower.tail=FALSE, log.p=TRUE) +[1] NaN +Warning message: +In pgeom(0, 10, lower.tail = FALSE, log.p = TRUE) : NaNs produced + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions22#Output.IgnoreWhitespace# +#set.seed(1); pgeom(0, 10, lower.tail=TRUE, log.p=FALSE) +[1] NaN +Warning message: +In pgeom(0, 10, lower.tail = TRUE, log.p = FALSE) : NaNs produced + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions22#Output.IgnoreWhitespace# +#set.seed(1); pgeom(0, 10, lower.tail=TRUE, log.p=TRUE) +[1] NaN +Warning message: +In pgeom(0, 10, lower.tail = TRUE, log.p = TRUE) : NaNs produced + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions22#Output.IgnoreWhitespace# +#set.seed(1); pgeom(0, c(0.0653, 0.000123, 32e-80, 8833, 79e70, 0, -1), lower.tail=FALSE, log.p=FALSE) +[1] 0.934700 0.999877 1.000000 NaN NaN NaN NaN +Warning message: +In pgeom(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); pgeom(0, c(0.0653, 0.000123, 32e-80, 8833, 79e70, 0, -1), lower.tail=FALSE, log.p=TRUE) +[1] -6.752966e-02 -1.230076e-04 -3.200000e-79 NaN NaN +[6] NaN NaN +Warning message: +In pgeom(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); pgeom(0, c(0.0653, 0.000123, 32e-80, 8833, 79e70, 0, -1), lower.tail=TRUE, log.p=FALSE) +[1] 6.53e-02 1.23e-04 3.20e-79 NaN NaN NaN NaN +Warning message: +In pgeom(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); pgeom(0, c(0.0653, 0.000123, 32e-80, 8833, 79e70, 0, -1), lower.tail=TRUE, log.p=TRUE) +[1] -2.728763 -9.003326 -180.741072 NaN NaN NaN +[7] NaN +Warning message: +In pgeom(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); pgeom(c(-1, 0, 0.2, 2), rep(c(-1, 0, 0.1, 0.9, 3), 4), lower.tail=FALSE, log.p=FALSE) + [1] NaN NaN 0.900 0.001 NaN NaN NaN 0.729 1.000 NaN NaN NaN +[13] 1.000 0.100 NaN NaN NaN 0.900 0.100 NaN +Warning message: +In pgeom(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); pgeom(c(-1, 0, 0.2, 2), rep(c(-1, 0, 0.1, 0.9, 3), 4), lower.tail=FALSE, log.p=TRUE) + [1] NaN NaN -0.1053605 -6.9077553 NaN NaN + [7] NaN -0.3160815 0.0000000 NaN NaN NaN +[13] 0.0000000 -2.3025851 NaN NaN NaN -0.1053605 +[19] -2.3025851 NaN +Warning message: +In pgeom(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); pgeom(c(-1, 0, 0.2, 2), rep(c(-1, 0, 0.1, 0.9, 3), 4), lower.tail=TRUE, log.p=FALSE) + [1] NaN NaN 0.100 0.999 NaN NaN NaN 0.271 0.000 NaN NaN NaN +[13] 0.000 0.900 NaN NaN NaN 0.100 0.900 NaN +Warning message: +In pgeom(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); pgeom(c(-1, 0, 0.2, 2), rep(c(-1, 0, 0.1, 0.9, 3), 4), lower.tail=TRUE, log.p=TRUE) + [1] NaN NaN -2.3025851 -0.0010005 NaN NaN + [7] NaN -1.3056365 -Inf NaN NaN NaN +[13] -Inf -0.1053605 NaN NaN NaN -2.3025851 +[19] -0.1053605 NaN +Warning message: +In pgeom(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); pgeom(c(NA, 0, NaN, 1/0, -1/0), rep(c(1, 0, 0.1), 5)) + [1] NA NaN NaN 1.0 NaN NA 1.0 NaN 1.0 0.0 NA 0.1 NaN NaN 0.0 +Warning message: +In pgeom(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); pgeom(rep(c(1, 0, 0.1), 5), c(NA, 0, NaN, 1/0, -1/0)) + [1] NA NaN NaN NaN NaN NA NaN NaN NaN NaN NA NaN NaN NaN NaN +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 + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions22#Output.IgnoreWhitespace# +#set.seed(1); pt(0, 10, lower.tail=FALSE, log.p=TRUE) +[1] -0.6931472 + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions22#Output.IgnoreWhitespace# +#set.seed(1); pt(0, 10, lower.tail=TRUE, log.p=FALSE) +[1] 0.5 + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions22#Output.IgnoreWhitespace# +#set.seed(1); pt(0, 10, lower.tail=TRUE, log.p=TRUE) +[1] -0.6931472 + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions22#Output.IgnoreWhitespace# +#set.seed(1); pt(0, c(0.0653, 0.000123, 32e-80, 8833, 79e70, 0, -1), lower.tail=FALSE, log.p=FALSE) +[1] 0.5 0.5 0.5 0.5 0.5 NaN NaN +Warning message: +In pt(0, c(0.0653, 0.000123, 3.2e-79, 8833, 7.9e+71, 0, -1), lower.tail = FALSE, : + NaNs produced + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions22#Output.IgnoreWhitespace# +#set.seed(1); pt(0, c(0.0653, 0.000123, 32e-80, 8833, 79e70, 0, -1), lower.tail=FALSE, log.p=TRUE) +[1] -0.6931472 -0.6931472 -0.6931472 -0.6931472 -0.6931472 NaN NaN +Warning message: +In pt(0, c(0.0653, 0.000123, 3.2e-79, 8833, 7.9e+71, 0, -1), lower.tail = FALSE, : + NaNs produced + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions22#Output.IgnoreWhitespace# +#set.seed(1); pt(0, c(0.0653, 0.000123, 32e-80, 8833, 79e70, 0, -1), lower.tail=TRUE, log.p=FALSE) +[1] 0.5 0.5 0.5 0.5 0.5 NaN NaN +Warning message: +In pt(0, c(0.0653, 0.000123, 3.2e-79, 8833, 7.9e+71, 0, -1), lower.tail = TRUE, : + NaNs produced + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions22#Output.IgnoreWhitespace# +#set.seed(1); pt(0, c(0.0653, 0.000123, 32e-80, 8833, 79e70, 0, -1), lower.tail=TRUE, log.p=TRUE) +[1] -0.6931472 -0.6931472 -0.6931472 -0.6931472 -0.6931472 NaN NaN +Warning message: +In pt(0, c(0.0653, 0.000123, 3.2e-79, 8833, 7.9e+71, 0, -1), lower.tail = TRUE, : + NaNs produced + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions22#Output.IgnoreWhitespace# +#set.seed(1); pt(c(-1, 0, 0.2, 2), rep(c(-1, 0, 0.1, 0.9, 3), 4), lower.tail=FALSE, log.p=FALSE) + [1] NaN NaN 0.47222678 0.15801721 0.80449889 NaN + [7] NaN 0.38917711 0.74287641 0.50000000 NaN NaN +[13] 0.58367176 0.50000000 0.42713516 NaN NaN 0.50000000 +[19] 0.43852072 0.06966298 +Warning message: +In pt(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); pt(c(-1, 0, 0.2, 2), rep(c(-1, 0, 0.1, 0.9, 3), 4), lower.tail=FALSE, log.p=TRUE) + [1] NaN NaN -0.7502959 -1.8450513 -0.2175357 NaN + [7] NaN -0.9437207 -0.2972256 -0.6931472 NaN NaN +[13] -0.5384165 -0.6931472 -0.8506548 NaN NaN -0.6931472 +[19] -0.8243482 -2.6640862 +Warning message: +In pt(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); pt(c(-1, 0, 0.2, 2), rep(c(-1, 0, 0.1, 0.9, 3), 4), lower.tail=TRUE, log.p=FALSE) + [1] NaN NaN 0.5277732 0.8419828 0.1955011 NaN NaN + [8] 0.6108229 0.2571236 0.5000000 NaN NaN 0.4163282 0.5000000 +[15] 0.5728648 NaN NaN 0.5000000 0.5614793 0.9303370 +Warning message: +In pt(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); pt(c(-1, 0, 0.2, 2), rep(c(-1, 0, 0.1, 0.9, 3), 4), lower.tail=TRUE, log.p=TRUE) + [1] NaN NaN -0.63908859 -0.17199570 -1.63218922 NaN + [7] NaN -0.49294824 -1.35819841 -0.69314718 NaN NaN +[13] -0.87628129 -0.69314718 -0.55710548 NaN NaN -0.69314718 +[19] -0.57718041 -0.07220838 +Warning message: +In pt(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); pt(c(NA, 0, NaN, 1/0, -1/0), rep(c(1, 0, 0.1), 5)) + [1] NA NaN NaN 1.0 NaN NA 0.5 NaN 1.0 0.0 NA 0.5 NaN NaN 0.0 +Warning message: +In pt(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); pt(rep(c(1, 0, 0.1), 5), c(NA, 0, NaN, 1/0, -1/0)) + [1] NA NaN NaN 0.8413447 NaN NA NaN + [8] NaN 0.5398278 NaN NA NaN NaN 0.5000000 +[15] NaN +Warning message: +In pt(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); qchisq(0, 10, lower.tail=FALSE, log.p=FALSE) +[1] Inf + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions22#Output.IgnoreWhitespace# +#set.seed(1); qchisq(0, 10, lower.tail=FALSE, log.p=TRUE) +[1] 0 + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions22#Output.IgnoreWhitespace# +#set.seed(1); qchisq(0, 10, lower.tail=TRUE, log.p=FALSE) +[1] 0 + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions22#Output.IgnoreWhitespace# +#set.seed(1); qchisq(0, 10, lower.tail=TRUE, log.p=TRUE) +[1] Inf + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions22#Output.IgnoreWhitespace# +#set.seed(1); qchisq(0, c(0.0653, 0.000123, 32e-80, 8833, 79e70, 0, -1), lower.tail=FALSE, log.p=FALSE) +[1] Inf Inf Inf Inf Inf Inf Inf + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions22#Output.IgnoreWhitespace# +#set.seed(1); qchisq(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 0 + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions22#Output.IgnoreWhitespace# +#set.seed(1); qchisq(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 0 + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions22#Output.IgnoreWhitespace# +#set.seed(1); qchisq(0, c(0.0653, 0.000123, 32e-80, 8833, 79e70, 0, -1), lower.tail=TRUE, log.p=TRUE) +[1] Inf Inf Inf Inf Inf Inf Inf + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions22#Output.IgnoreWhitespace# +#set.seed(1); qchisq(c(-1, 0, 0.2, 2), rep(c(-1, 0, 0.1, 0.9, 3), 4), lower.tail=FALSE, log.p=FALSE) + [1] NaN Inf 0.013564 NaN NaN Inf 0.000000 NaN + [9] NaN Inf NaN NaN NaN Inf 4.641628 NaN +[17] NaN Inf 1.468957 NaN +Warning message: +In qchisq(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); qchisq(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.000000000 NaN NaN 3.158142952 0.000000000 + [7] NaN NaN 0.691572992 0.000000000 NaN NaN +[13] 0.000121286 0.000000000 NaN NaN 0.000000000 0.000000000 +[19] NaN NaN +Warning message: +In qchisq(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); qchisq(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.000000e+00 1.225708e-14 NaN NaN + [6] 0.000000e+00 0.000000e+00 NaN NaN 0.000000e+00 +[11] NaN NaN NaN 0.000000e+00 1.005174e+00 +[16] NaN NaN 0.000000e+00 4.335644e-02 NaN +Warning message: +In qchisq(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); qchisq(c(-1, 0, 0.2, 2), rep(c(-1, 0, 0.1, 0.9, 3), 4), lower.tail=TRUE, log.p=TRUE) + [1] NaN Inf NaN NaN 1.721698e+00 + [6] Inf NaN NaN 1.756852e-01 Inf +[11] NaN NaN 2.409337e-09 Inf NaN +[16] NaN 0.000000e+00 Inf NaN NaN +Warning message: +In qchisq(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); qchisq(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 qchisq(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); qchisq(rep(c(1, 0, 0.1), 5), c(NA, 0, NaN, 1/0, -1/0)) + [1] NA 0 NaN Inf 0 NA Inf NaN Inf Inf NA 0 NaN 0 NaN +Warning messages: +1: In qchisq(rep(c(1, 0, 0.1), 5), c(NA, 0, NaN, 1/0, -1/0)) : + value out of range in 'lgamma' +2: In qchisq(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); qexp(0, 10, lower.tail=FALSE, log.p=FALSE) [1] Inf @@ -115044,6 +115661,179 @@ 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 + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions22#Output.IgnoreWhitespace# +#set.seed(1); qt(0, 10, lower.tail=FALSE, log.p=TRUE) +[1] -Inf + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions22#Output.IgnoreWhitespace# +#set.seed(1); qt(0, 10, lower.tail=TRUE, log.p=FALSE) +[1] -Inf + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions22#Output.IgnoreWhitespace# +#set.seed(1); qt(0, 10, lower.tail=TRUE, log.p=TRUE) +[1] Inf + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions22#Output.IgnoreWhitespace# +#set.seed(1); qt(0, c(0.0653, 0.000123, 32e-80, 8833, 79e70, 0, -1), lower.tail=FALSE, log.p=FALSE) +[1] Inf Inf Inf Inf Inf Inf Inf + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions22#Output.IgnoreWhitespace# +#set.seed(1); qt(0, c(0.0653, 0.000123, 32e-80, 8833, 79e70, 0, -1), lower.tail=FALSE, log.p=TRUE) +[1] -Inf -Inf -Inf -Inf -Inf -Inf -Inf + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions22#Output.IgnoreWhitespace# +#set.seed(1); qt(0, c(0.0653, 0.000123, 32e-80, 8833, 79e70, 0, -1), lower.tail=TRUE, log.p=FALSE) +[1] -Inf -Inf -Inf -Inf -Inf -Inf -Inf + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions22#Output.IgnoreWhitespace# +#set.seed(1); qt(0, c(0.0653, 0.000123, 32e-80, 8833, 79e70, 0, -1), lower.tail=TRUE, log.p=TRUE) +[1] Inf Inf Inf Inf Inf Inf Inf + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions22#Output.IgnoreWhitespace# +#set.seed(1); qt(c(-1, 0, 0.2, 2), rep(c(-1, 0, 0.1, 0.9, 3), 4), lower.tail=FALSE, log.p=FALSE) + [1] NaN Inf 1566.8219615 NaN NaN + [6] Inf NaN NaN NaN Inf +[11] NaN NaN NaN Inf 0.9784723 +[16] NaN NaN Inf 1.4638968 NaN +Warning message: +In qt(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); qt(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 NaN NaN 0.3702990 -Inf NaN + [8] NaN 0.4528167 -Inf NaN NaN 3.5265712 -Inf +[15] NaN NaN NaN -Inf NaN NaN +Warning message: +In qt(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); qt(c(-1, 0, 0.2, 2), rep(c(-1, 0, 0.1, 0.9, 3), 4), lower.tail=TRUE, log.p=FALSE) + [1] NaN -Inf -1566.8219615 NaN NaN + [6] -Inf NaN NaN NaN -Inf +[11] NaN NaN NaN -Inf -0.9784723 +[16] NaN NaN -Inf -1.4638968 NaN +Warning message: +In qt(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); qt(c(-1, 0, 0.2, 2), rep(c(-1, 0, 0.1, 0.9, 3), 4), lower.tail=TRUE, log.p=TRUE) + [1] NaN Inf NaN NaN -0.3702990 Inf + [7] NaN NaN -0.4528167 Inf NaN NaN +[13] -3.5265712 Inf NaN NaN NaN Inf +[19] NaN NaN +Warning message: +In qt(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); qt(c(NA, 0, NaN, 1/0, -1/0), rep(c(1, 0, 0.1), 5)) + [1] NA -Inf NaN NaN NaN NA -Inf NaN NaN NaN NA -Inf NaN NaN NaN +Warning message: +In qt(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); qt(rep(c(1, 0, 0.1), 5), c(NA, 0, NaN, 1/0, -1/0)) + [1] NA -Inf NaN Inf -Inf NA Inf + [8] NaN -1.281552 Inf NA NaN NaN -Inf +[15] NaN +Warning message: +In qt(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.testFunctions31#Output.IgnoreWhitespace# #set.seed(1); dbeta(0, c(0.0653, 0.000123, 32e-80, 8833, 79e70), c(0.0653, 0.000123, 32e-80, 8833, 79e70, 0, -1), log=FALSE) [1] Inf Inf Inf 0 0 0 NaN @@ -115270,23 +116060,150 @@ In dlnorm(c(-1, 0, 1), c(-1, 0, 0.2, 2:5), rep(c(-1, 0, 0.1, 0.9, : #set.seed(1); dlnorm(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.IgnoreWhitespace# +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions31#Output.IgnoreWhitespace# +#set.seed(1); dlogis(0, c(0.0653, 0.000123, 32e-80, 8833, 79e70), c(0.0653, 0.000123, 32e-80, 8833, 79e70, 0, -1), log=FALSE) +[1] 3.010902e+00 1.598471e+03 6.144123e+77 2.225879e-05 2.488759e-73 +[6] NaN NaN +Warning message: +In dlogis(0, c(0.0653, 0.000123, 3.2e-79, 8833, 7.9e+71), c(0.0653, : + NaNs produced + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions31#Output.IgnoreWhitespace# +#set.seed(1); dlogis(0, c(NA, 0, NaN, 1/0, -1/0), c(NaN, NaN, NA, 0, 1/0, -1/0), log=FALSE) +[1] NA NaN NA NaN NaN NA +Warning message: +In dlogis(0, c(NA, 0, NaN, 1/0, -1/0), c(NaN, NaN, NA, 0, 1/0, -1/0), : + NaNs produced + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions31#Output.IgnoreWhitespace# +#set.seed(1); dlogis(10, 10, 10, log=TRUE) +[1] -3.688879 + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions31#Output.IgnoreWhitespace# +#set.seed(1); dlogis(3, 3, 3, log=FALSE) +[1] 0.08333333 + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions31#Output.IgnoreWhitespace# +#set.seed(1); dlogis(c(-1, 0, 1), c(-1, 0, 0.2, 2:5), rep(c(-1, 0, 0.1, 0.9, 3), 12), log=FALSE) + [1] NaN NaN 3.352377e-03 3.695414e-02 6.553731e-02 + [6] NaN NaN 4.539581e-04 2.070294e-01 8.008692e-02 +[11] NaN NaN 1.928750e-21 4.262447e-03 7.471913e-02 +[16] NaN NaN 4.539581e-04 1.274732e-02 5.503034e-02 +[21] NaN NaN 2.500000e+00 2.294007e-01 6.553731e-02 +[26] NaN NaN 8.756511e-26 2.070294e-01 8.106072e-02 +[31] NaN NaN 2.061154e-08 4.262447e-03 4.454324e-02 +[36] NaN NaN 1.049936e+00 2.070294e-01 5.503034e-02 +[41] NaN NaN 2.500000e+00 2.777778e-01 8.186923e-02 +[46] NaN NaN 9.357623e-13 1.410445e-03 8.106072e-02 +[51] NaN NaN 2.061154e-08 9.801458e-02 4.454324e-02 +[56] NaN NaN 4.539581e-04 2.743765e-01 8.106072e-02 +Warning message: +In dlogis(c(-1, 0, 1), c(-1, 0, 0.2, 2:5), rep(c(-1, 0, 0.1, 0.9, : + NaNs produced + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions31#Output.IgnoreWhitespace# +#set.seed(1); dlogis(c(-1, 0, 1), c(-1, 0, 0.2, 2:5), rep(c(-1, 0, 0.1, 0.9, 3), 12), log=TRUE) + [1] NaN NaN -5.69808572 -3.29807765 -2.72513566 + [6] NaN NaN -7.69750570 -1.57489456 -2.52464279 +[11] NaN NaN -47.69741491 -5.45791197 -2.59401913 +[16] NaN NaN -7.69750570 -4.36243434 -2.89987067 +[21] NaN NaN 0.91629073 -1.47228488 -2.72513566 +[26] NaN NaN -57.69741491 -1.57489456 -2.51255677 +[31] NaN NaN -17.69741491 -5.45791197 -3.11129493 +[36] NaN NaN 0.04872907 -1.57489456 -2.89987067 +[41] NaN NaN 0.91629073 -1.28093385 -2.50263200 +[46] NaN NaN -27.69741491 -6.56384980 -2.51255677 +[51] NaN NaN -17.69741491 -2.32263907 -3.11129493 +[56] NaN NaN -7.69750570 -1.29325421 -2.51255677 +Warning message: +In dlogis(c(-1, 0, 1), c(-1, 0, 0.2, 2:5), rep(c(-1, 0, 0.1, 0.9, : + NaNs produced + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions31#Output.IgnoreWhitespace# +#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.testFunctions31#Output.IgnoreWhitespace# +#set.seed(1); dunif(0, c(0.0653, 0.000123, 32e-80, 8833, 79e70), c(0.0653, 0.000123, 32e-80, 8833, 79e70, 0, -1), log=FALSE) +[1] NaN NaN NaN NaN NaN NaN NaN +Warning message: +In dunif(0, c(0.0653, 0.000123, 3.2e-79, 8833, 7.9e+71), c(0.0653, : + NaNs produced + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions31#Output.IgnoreWhitespace# +#set.seed(1); dunif(0, c(NA, 0, NaN, 1/0, -1/0), c(NaN, NaN, NA, 0, 1/0, -1/0), log=FALSE) +[1] NA NaN NA NaN 0 NA +Warning message: +In dunif(0, c(NA, 0, NaN, 1/0, -1/0), c(NaN, NaN, NA, 0, 1/0, -1/0), : + NaNs produced + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions31#Output.IgnoreWhitespace# +#set.seed(1); dunif(10, 10, 10, log=TRUE) +[1] NaN +Warning message: +In dunif(10, 10, 10, log = TRUE) : NaNs produced + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions31#Output.IgnoreWhitespace# +#set.seed(1); dunif(3, 3, 3, log=FALSE) +[1] NaN +Warning message: +In dunif(3, 3, 3, log = FALSE) : NaNs produced + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions31#Output.IgnoreWhitespace# +#set.seed(1); dunif(c(-1, 0, 1), c(-1, 0, 0.2, 2:5), rep(c(-1, 0, 0.1, 0.9, 3), 12), log=FALSE) + [1] NaN NaN NaN NaN NaN NaN + [7] NaN 0.9090909 0.0000000 0.0000000 NaN NaN +[13] NaN NaN 0.2500000 NaN NaN NaN +[19] NaN NaN NaN 1.0000000 10.0000000 0.0000000 +[25] 0.0000000 NaN NaN NaN 0.5263158 0.3333333 +[31] NaN NaN NaN NaN NaN NaN +[37] NaN NaN NaN NaN NaN NaN +[43] 0.9090909 1.1111111 0.3571429 NaN NaN NaN +[49] NaN 0.2500000 NaN NaN NaN NaN +[55] NaN NaN 0.0000000 0.0000000 0.0000000 0.0000000 +Warning message: +In dunif(c(-1, 0, 1), c(-1, 0, 0.2, 2:5), rep(c(-1, 0, 0.1, 0.9, : + NaNs produced + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions31#Output.IgnoreWhitespace# +#set.seed(1); dunif(c(-1, 0, 1), c(-1, 0, 0.2, 2:5), rep(c(-1, 0, 0.1, 0.9, 3), 12), log=TRUE) + [1] NaN NaN NaN NaN NaN NaN + [7] NaN -0.09531018 -Inf -Inf NaN NaN +[13] NaN NaN -1.38629436 NaN NaN NaN +[19] NaN NaN NaN 0.00000000 2.30258509 -Inf +[25] -Inf NaN NaN NaN -0.64185389 -1.09861229 +[31] NaN NaN NaN NaN NaN NaN +[37] NaN NaN NaN NaN NaN NaN +[43] -0.09531018 0.10536052 -1.02961942 NaN NaN NaN +[49] NaN -1.38629436 NaN NaN NaN NaN +[55] NaN NaN -Inf -Inf -Inf -Inf +Warning message: +In dunif(c(-1, 0, 1), c(-1, 0, 0.2, 2:5), rep(c(-1, 0, 0.1, 0.9, : + NaNs produced + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions31#Output.IgnoreWhitespace# +#set.seed(1); dunif(c(NA, NaN, 1/0, -1/0), 2, 2, log=FALSE) +[1] NA NaN NaN NaN +Warning message: +In dunif(c(NA, NaN, 1/0, -1/0), 2, 2, log = FALSE) : NaNs produced + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# #set.seed(1); pbeta(0, 10, 10, lower.tail=FALSE, log.p=FALSE) [1] 1 -##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.IgnoreWhitespace# +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# #set.seed(1); pbeta(0, 10, 10, lower.tail=FALSE, log.p=TRUE) [1] 0 -##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.IgnoreWhitespace# +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# #set.seed(1); pbeta(0, 10, 10, lower.tail=TRUE, log.p=FALSE) [1] 0 -##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.IgnoreWhitespace# +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# #set.seed(1); pbeta(0, 10, 10, lower.tail=TRUE, log.p=TRUE) [1] -Inf -##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.IgnoreWhitespace# +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# #set.seed(1); pbeta(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] 1 1 1 1 1 1 NaN 1 1 1 1 1 1 NaN 1 1 1 1 1 [20] 1 NaN 1 1 1 1 1 1 NaN 1 1 1 1 1 1 NaN @@ -115294,7 +116211,7 @@ Warning message: In pbeta(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.IgnoreWhitespace# +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# #set.seed(1); pbeta(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] 0 0 0 0 0 0 NaN 0 0 0 0 0 0 NaN 0 0 0 0 0 [20] 0 NaN 0 0 0 0 0 0 NaN 0 0 0 0 0 0 NaN @@ -115302,7 +116219,7 @@ Warning message: In pbeta(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.IgnoreWhitespace# +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# #set.seed(1); pbeta(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] 0 0 0 0 0 0 NaN 0 0 0 0 0 0 NaN 0 0 0 0 0 [20] 0 NaN 0 0 0 0 0 0 NaN 0 0 0 0 0 0 NaN @@ -115310,7 +116227,7 @@ Warning message: In pbeta(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.IgnoreWhitespace# +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# #set.seed(1); pbeta(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] -Inf -Inf -Inf -Inf -Inf -Inf NaN -Inf -Inf -Inf -Inf -Inf -Inf NaN -Inf [16] -Inf -Inf -Inf -Inf -Inf NaN -Inf -Inf -Inf -Inf -Inf -Inf NaN -Inf -Inf @@ -115319,7 +116236,7 @@ Warning message: In pbeta(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.IgnoreWhitespace# +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# #set.seed(1); pbeta(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 1.0000000 0.1486601 0.0000000 NaN NaN NaN [8] 0.0000000 1.0000000 1.0000000 NaN 0.0000000 NaN 1.0000000 @@ -115343,7 +116260,7 @@ Warning message: In pbeta(c(-1, 0, 0.2, 2), c(-1, 0, 0.1, 0.9, 3), rep(c(-1, 0, 1, : NaNs produced -##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.IgnoreWhitespace# +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# #set.seed(1); pbeta(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.000000000 -1.906092939 -Inf NaN [6] NaN NaN -Inf 0.000000000 0.000000000 @@ -115373,7 +116290,7 @@ Warning message: In pbeta(c(-1, 0, 0.2, 2), c(-1, 0, 0.1, 0.9, 3), rep(c(-1, 0, 1, : NaNs produced -##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.IgnoreWhitespace# +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# #set.seed(1); pbeta(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.0000000 0.8513399 1.0000000 NaN NaN NaN [8] 1.0000000 0.0000000 0.0000000 NaN 1.0000000 NaN 0.0000000 @@ -115397,7 +116314,7 @@ Warning message: In pbeta(c(-1, 0, 0.2, 2), c(-1, 0, 0.1, 0.9, 3), rep(c(-1, 0, 1, : NaNs produced -##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.IgnoreWhitespace# +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# #set.seed(1); pbeta(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 -Inf -0.1609438 0.0000000 NaN NaN [7] NaN 0.0000000 -Inf -Inf NaN 0.0000000 @@ -115423,41 +116340,230 @@ Warning message: In pbeta(c(-1, 0, 0.2, 2), c(-1, 0, 0.1, 0.9, 3), rep(c(-1, 0, 1, : NaNs produced -##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.IgnoreWarningContext# +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# #set.seed(1); pbeta(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 1 0 NA 0 NaN 1 0 NA 0 NaN 1 0 -##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.IgnoreWarningContext# +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# #set.seed(1); pbeta(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 1 NaN NA 1 NaN 0 NaN NA 1 NaN 0 NaN Warning message: In pbeta(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.IgnoreWhitespace# +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# #set.seed(1); pbeta(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 1 NaN NA 1 NaN 1 NaN NA 0 NaN 0 NaN Warning message: In pbeta(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.IgnoreWhitespace# +##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); pcauchy(0, 10, 10, lower.tail=FALSE, log.p=FALSE) [1] 0.75 -##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.IgnoreWhitespace# +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# #set.seed(1); pcauchy(0, 10, 10, lower.tail=FALSE, log.p=TRUE) [1] -0.2876821 -##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.IgnoreWhitespace# +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# #set.seed(1); pcauchy(0, 10, 10, lower.tail=TRUE, log.p=FALSE) [1] 0.25 -##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.IgnoreWhitespace# +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# #set.seed(1); pcauchy(0, 10, 10, lower.tail=TRUE, log.p=TRUE) [1] -1.386294 -##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.IgnoreWhitespace# +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# #set.seed(1); pcauchy(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] 7.500000e-01 7.500000e-01 7.500000e-01 7.500000e-01 7.500000e-01 [6] 5.000000e-01 3.915212e-05 1.000000e+00 5.000000e-01 5.000000e-01 @@ -115467,7 +116573,7 @@ In pbeta(rep(c(1, 0, 0.1), 5), rep(c(1, 0, 0.1), 5), c(NA, 0, NaN, : [26] 1.000000e+00 5.000000e-01 1.018592e-79 5.000024e-01 5.000000e-01 [31] 5.000000e-01 1.000000e+00 1.000000e+00 5.000000e-01 5.000000e-01 -##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.IgnoreWhitespace# +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# #set.seed(1); pcauchy(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] -2.876821e-01 -2.876821e-01 -2.876821e-01 -2.876821e-01 -2.876821e-01 [6] -6.931472e-01 -1.014806e+01 -1.559865e-78 -6.931472e-01 -6.931472e-01 @@ -115477,7 +116583,7 @@ In pbeta(rep(c(1, 0, 0.1), 5), rep(c(1, 0, 0.1), 5), c(NA, 0, NaN, : [26] -2.631093e-74 -6.931472e-01 -1.818858e+02 -6.931425e-01 -6.931472e-01 [31] -6.931472e-01 -4.432482e-09 -1.289357e-151 -6.931472e-01 -6.931472e-01 -##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.IgnoreWhitespace# +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# #set.seed(1); pcauchy(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] 2.500000e-01 2.500000e-01 2.500000e-01 2.500000e-01 2.500000e-01 [6] 5.000000e-01 9.999608e-01 1.559865e-78 5.000000e-01 5.000000e-01 @@ -115487,7 +116593,7 @@ In pbeta(rep(c(1, 0, 0.1), 5), rep(c(1, 0, 0.1), 5), c(NA, 0, NaN, : [26] 2.631093e-74 5.000000e-01 1.000000e+00 4.999976e-01 5.000000e-01 [31] 5.000000e-01 4.432482e-09 1.289357e-151 5.000000e-01 5.000000e-01 -##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.IgnoreWhitespace# +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# #set.seed(1); pcauchy(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] -1.386294e+00 -1.386294e+00 -1.386294e+00 -1.386294e+00 -1.386294e+00 [6] -6.931472e-01 -3.915288e-05 -1.791570e+02 -6.931472e-01 -6.931472e-01 @@ -115497,7 +116603,7 @@ In pbeta(rep(c(1, 0, 0.1), 5), rep(c(1, 0, 0.1), 5), c(NA, 0, NaN, : [26] -1.694239e+02 -6.931472e-01 -1.018592e-79 -6.931519e-01 -6.931472e-01 [31] -6.931472e-01 -1.923431e+01 -3.474362e+02 -6.931472e-01 -6.931472e-01 -##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.IgnoreWhitespace# +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# #set.seed(1); pcauchy(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 NaN 4.682745e-01 2.885794e-02 NaN [6] 3.183099e-05 NaN NaN 8.457859e-01 9.893936e-01 @@ -115527,7 +116633,7 @@ Warning message: In pcauchy(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.IgnoreWhitespace# +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# #set.seed(1); pcauchy(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 NaN -7.587007e-01 -3.545370e+00 NaN [6] -1.035507e+01 NaN NaN -1.674890e-01 -1.066305e-02 @@ -115557,7 +116663,7 @@ Warning message: In pcauchy(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.IgnoreWhitespace# +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# #set.seed(1); pcauchy(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 NaN 5.317255e-01 9.711421e-01 NaN [6] 9.999682e-01 NaN NaN 1.542141e-01 1.060640e-02 @@ -115587,7 +116693,7 @@ Warning message: In pcauchy(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.IgnoreWhitespace# +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# #set.seed(1); pcauchy(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 NaN -6.316279e-01 -2.928252e-02 NaN [6] -3.183150e-05 NaN NaN -1.869413e+00 -4.546297e+00 @@ -115617,62 +116723,246 @@ Warning message: In pcauchy(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.IgnoreWarningContext# +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# #set.seed(1); pcauchy(c(NA, 0, NaN, 1/0, -1/0), rep(c(1, 0, 0.1), 5), rep(c(1, 0, 0.1), 5)) [1] NA NaN NaN 1.00 NaN NA 0.25 NaN 1.00 0.00 NA 0.25 NaN NaN 0.00 Warning message: In pcauchy(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.IgnoreWarningContext# +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# #set.seed(1); pcauchy(rep(c(1, 0, 0.1), 5), c(NA, 0, NaN, 1/0, -1/0), rep(c(1, 0, 0.1), 5)) [1] NA NaN NaN 0.00 NaN NA 0.75 NaN 0.00 1.00 NA 0.75 NaN NaN 1.00 Warning message: In pcauchy(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.IgnoreWhitespace# +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# #set.seed(1); pcauchy(rep(c(1, 0, 0.1), 5), rep(c(1, 0, 0.1), 5), c(NA, 0, NaN, 1/0, -1/0)) [1] NA NaN NaN 0.5 NaN NA NaN NaN 0.5 NaN NA NaN NaN 0.5 NaN Warning message: In pcauchy(rep(c(1, 0, 0.1), 5), rep(c(1, 0, 0.1), 5), c(NA, 0, : NaNs produced -##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.IgnoreWhitespace# +##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 + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# +#set.seed(1); pf(0, 10, 10, lower.tail=FALSE, log.p=TRUE) +[1] 0 + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# +#set.seed(1); pf(0, 10, 10, lower.tail=TRUE, log.p=FALSE) +[1] 0 + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# +#set.seed(1); pf(0, 10, 10, lower.tail=TRUE, log.p=TRUE) +[1] -Inf + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# +#set.seed(1); pf(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] 1 1 1 1 1 NaN NaN 1 1 1 1 1 NaN NaN 1 1 1 1 1 +[20] NaN NaN 1 1 1 1 1 NaN NaN 1 1 1 1 1 NaN NaN +Warning message: +In pf(0, c(0.0653, 0.000123, 3.2e-79, 8833, 7.9e+71, 0, -1), rep(c(0.0653, : + NaNs produced + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# +#set.seed(1); pf(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] 0 0 0 0 0 NaN NaN 0 0 0 0 0 NaN NaN 0 0 0 0 0 +[20] NaN NaN 0 0 0 0 0 NaN NaN 0 0 0 0 0 NaN NaN +Warning message: +In pf(0, c(0.0653, 0.000123, 3.2e-79, 8833, 7.9e+71, 0, -1), rep(c(0.0653, : + NaNs produced + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# +#set.seed(1); pf(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] 0 0 0 0 0 NaN NaN 0 0 0 0 0 NaN NaN 0 0 0 0 0 +[20] NaN NaN 0 0 0 0 0 NaN NaN 0 0 0 0 0 NaN NaN +Warning message: +In pf(0, c(0.0653, 0.000123, 3.2e-79, 8833, 7.9e+71, 0, -1), rep(c(0.0653, : + NaNs produced + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# +#set.seed(1); pf(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] -Inf -Inf -Inf -Inf -Inf NaN NaN -Inf -Inf -Inf -Inf -Inf NaN NaN -Inf +[16] -Inf -Inf -Inf -Inf NaN NaN -Inf -Inf -Inf -Inf -Inf NaN NaN -Inf -Inf +[31] -Inf -Inf -Inf NaN NaN +Warning message: +In pf(0, c(0.0653, 0.000123, 3.2e-79, 8833, 7.9e+71, 0, -1), rep(c(0.0653, : + NaNs produced + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# +#set.seed(1); pf(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 NaN 0.2301826 0.7995678 NaN NaN NaN + [8] NaN 1.0000000 1.0000000 NaN NaN NaN NaN + [15] 0.8886328 NaN NaN 1.0000000 NaN NaN NaN + [22] NaN NaN 0.9994274 NaN NaN NaN 0.4838017 + [29] NaN 1.0000000 NaN NaN 1.0000000 1.0000000 NaN + [36] NaN NaN NaN 0.7109050 0.8385293 NaN NaN + [43] NaN NaN 1.0000000 NaN NaN 0.9986254 NaN + [50] NaN NaN NaN NaN 1.0000000 NaN NaN + [57] NaN 1.0000000 NaN 0.9994807 NaN NaN 0.2301826 + [64] 0.7995678 NaN NaN NaN NaN 1.0000000 1.0000000 + [71] NaN NaN NaN NaN 0.8886328 NaN NaN + [78] 1.0000000 NaN NaN NaN NaN NaN 0.9994274 + [85] NaN NaN NaN 0.4838017 NaN 1.0000000 NaN + [92] NaN 1.0000000 1.0000000 NaN NaN NaN NaN + [99] 0.7109050 0.8385293 NaN NaN NaN NaN 1.0000000 +[106] NaN NaN 0.9986254 NaN NaN NaN NaN +[113] NaN 1.0000000 NaN NaN NaN 1.0000000 NaN +[120] 0.9994807 +Warning message: +In pf(c(-1, 0, 0.2, 2), c(-1, 0, 0.1, 0.9, 3), rep(c(-1, 0, 1, 0.1, : + NaNs produced + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# +#set.seed(1); pf(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 NaN -1.4688821632 -0.2236838870 NaN + [6] NaN NaN NaN 0.0000000000 0.0000000000 + [11] NaN NaN NaN NaN -0.1180711262 + [16] NaN NaN 0.0000000000 NaN NaN + [21] NaN NaN NaN -0.0005727184 NaN + [26] NaN NaN -0.7260801256 NaN 0.0000000000 + [31] NaN NaN 0.0000000000 0.0000000000 NaN + [36] NaN NaN NaN -0.3412165338 -0.1761057482 + [41] NaN NaN NaN NaN 0.0000000000 + [46] NaN NaN -0.0013755783 NaN NaN + [51] NaN NaN NaN 0.0000000000 NaN + [56] NaN NaN 0.0000000000 NaN -0.0005194218 + [61] NaN NaN -1.4688821632 -0.2236838870 NaN + [66] NaN NaN NaN 0.0000000000 0.0000000000 + [71] NaN NaN NaN NaN -0.1180711262 + [76] NaN NaN 0.0000000000 NaN NaN + [81] NaN NaN NaN -0.0005727184 NaN + [86] NaN NaN -0.7260801256 NaN 0.0000000000 + [91] NaN NaN 0.0000000000 0.0000000000 NaN + [96] NaN NaN NaN -0.3412165338 -0.1761057482 +[101] NaN NaN NaN NaN 0.0000000000 +[106] NaN NaN -0.0013755783 NaN NaN +[111] NaN NaN NaN 0.0000000000 NaN +[116] NaN NaN 0.0000000000 NaN -0.0005194218 +Warning message: +In pf(c(-1, 0, 0.2, 2), c(-1, 0, 0.1, 0.9, 3), rep(c(-1, 0, 1, 0.1, : + NaNs produced + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# +#set.seed(1); pf(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 NaN 0.7698173519 0.2004321518 NaN + [6] NaN NaN NaN 0.0000000000 0.0000000000 + [11] NaN NaN NaN NaN 0.1113671547 + [16] NaN NaN 0.0000000000 NaN NaN + [21] NaN NaN NaN 0.0005725544 NaN + [26] NaN NaN 0.5161982800 NaN 0.0000000000 + [31] NaN NaN 0.0000000000 0.0000000000 NaN + [36] NaN NaN NaN 0.2890950434 0.1614706943 + [41] NaN NaN NaN NaN 0.0000000000 + [46] NaN NaN 0.0013746326 NaN NaN + [51] NaN NaN NaN 0.0000000000 NaN + [56] NaN NaN 0.0000000000 NaN 0.0005192870 + [61] NaN NaN 0.7698173519 0.2004321518 NaN + [66] NaN NaN NaN 0.0000000000 0.0000000000 + [71] NaN NaN NaN NaN 0.1113671547 + [76] NaN NaN 0.0000000000 NaN NaN + [81] NaN NaN NaN 0.0005725544 NaN + [86] NaN NaN 0.5161982800 NaN 0.0000000000 + [91] NaN NaN 0.0000000000 0.0000000000 NaN + [96] NaN NaN NaN 0.2890950434 0.1614706943 +[101] NaN NaN NaN NaN 0.0000000000 +[106] NaN NaN 0.0013746326 NaN NaN +[111] NaN NaN NaN 0.0000000000 NaN +[116] NaN NaN 0.0000000000 NaN 0.0005192870 +Warning message: +In pf(c(-1, 0, 0.2, 2), c(-1, 0, 0.1, 0.9, 3), rep(c(-1, 0, 1, 0.1, : + NaNs produced + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# +#set.seed(1); pf(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 NaN -0.2616020 -1.6072795 NaN NaN + [7] NaN NaN -Inf -Inf NaN NaN + [13] NaN NaN -2.1949228 NaN NaN -Inf + [19] NaN NaN NaN NaN NaN -7.4654027 + [25] NaN NaN NaN -0.6612643 NaN -Inf + [31] NaN NaN -Inf -Inf NaN NaN + [37] NaN NaN -1.2409998 -1.8234316 NaN NaN + [43] NaN NaN -Inf NaN NaN -6.5895688 + [49] NaN NaN NaN NaN NaN -Inf + [55] NaN NaN NaN -Inf NaN -7.5630539 + [61] NaN NaN -0.2616020 -1.6072795 NaN NaN + [67] NaN NaN -Inf -Inf NaN NaN + [73] NaN NaN -2.1949228 NaN NaN -Inf + [79] NaN NaN NaN NaN NaN -7.4654027 + [85] NaN NaN NaN -0.6612643 NaN -Inf + [91] NaN NaN -Inf -Inf NaN NaN + [97] NaN NaN -1.2409998 -1.8234316 NaN NaN +[103] NaN NaN -Inf NaN NaN -6.5895688 +[109] NaN NaN NaN NaN NaN -Inf +[115] NaN NaN NaN -Inf NaN -7.5630539 +Warning message: +In pf(c(-1, 0, 0.2, 2), c(-1, 0, 0.1, 0.9, 3), rep(c(-1, 0, 1, 0.1, : + NaNs produced + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# +#set.seed(1); pf(c(NA, 0, NaN, 1/0, -1/0), rep(c(1, 0, 0.1), 5), rep(c(1, 0, 0.1), 5)) + [1] NA NaN NaN 1 NaN NA 0 NaN 1 0 NA 0 NaN NaN 0 +Warning message: +In pf(c(NA, 0, NaN, 1/0, -1/0), rep(c(1, 0, 0.1), 5), rep(c(1, 0, : + NaNs produced + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# +#set.seed(1); pf(rep(c(1, 0, 0.1), 5), c(NA, 0, NaN, 1/0, -1/0), rep(c(1, 0, 0.1), 5)) + [1] NA NaN NaN 0.31731051 NaN NA + [7] NaN NaN 0.02868263 NaN NA NaN +[13] NaN NaN NaN +Warning message: +In pf(rep(c(1, 0, 0.1), 5), c(NA, 0, NaN, 1/0, -1/0), rep(c(1, 0, : + NaNs produced + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# +#set.seed(1); pf(rep(c(1, 0, 0.1), 5), rep(c(1, 0, 0.1), 5), c(NA, 0, NaN, 1/0, -1/0)) + [1] NA NaN NaN 0.6826895 NaN NA NaN + [8] NaN 0.7879658 NaN NA NaN NaN NaN +[15] NaN +Warning message: +In pf(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); plnorm(0, 10, 10, lower.tail=FALSE, log.p=FALSE) [1] 1 -##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.IgnoreWhitespace# +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# #set.seed(1); plnorm(0, 10, 10, lower.tail=FALSE, log.p=TRUE) [1] 0 -##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.IgnoreWhitespace# +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# #set.seed(1); plnorm(0, 10, 10, lower.tail=TRUE, log.p=FALSE) [1] 0 -##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.IgnoreWhitespace# +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# #set.seed(1); plnorm(0, 10, 10, lower.tail=TRUE, log.p=TRUE) [1] -Inf -##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.IgnoreWhitespace# +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# #set.seed(1); plnorm(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] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.IgnoreWhitespace# +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# #set.seed(1); plnorm(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] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.IgnoreWhitespace# +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# #set.seed(1); plnorm(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] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.IgnoreWhitespace# +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# #set.seed(1); plnorm(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] -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf [16] -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf [31] -Inf -Inf -Inf -Inf -Inf -##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.IgnoreWhitespace# +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# #set.seed(1); plnorm(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 1.000000e+00 9.563151e-01 9.807048e-01 NaN [6] 1.000000e+00 NaN 0.000000e+00 1.000000e+00 1.000000e+00 @@ -115702,7 +116992,7 @@ Warning message: In plnorm(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.IgnoreWhitespace# +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# #set.seed(1); plnorm(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.000000e+00 -4.466785e-02 -1.948377e-02 NaN [6] 0.000000e+00 NaN -Inf 0.000000e+00 0.000000e+00 @@ -115732,7 +117022,7 @@ Warning message: In plnorm(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.IgnoreWhitespace# +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# #set.seed(1); plnorm(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.000000e+00 4.368493e-02 1.929519e-02 NaN [6] 0.000000e+00 NaN 1.000000e+00 0.000000e+00 0.000000e+00 @@ -115762,7 +117052,7 @@ Warning message: In plnorm(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.IgnoreWhitespace# +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# #set.seed(1); plnorm(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 -Inf -3.130752e+00 -3.947899e+00 NaN [6] -Inf NaN 0.000000e+00 -Inf -Inf @@ -115792,62 +117082,962 @@ Warning message: In plnorm(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.IgnoreWarningContext# +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# #set.seed(1); plnorm(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 1 0 NA 0 NaN 1 0 NA 0 NaN 1 0 -##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.IgnoreWarningContext# +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# #set.seed(1); plnorm(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.000000e+00 NaN 0.000000e+00 0.000000e+00 [6] NA 5.000000e-01 NaN 0.000000e+00 1.000000e+00 [11] NA 1.284176e-117 NaN 0.000000e+00 1.000000e+00 -##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.IgnoreWhitespace# +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# #set.seed(1); plnorm(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.0 NaN 0.5 NaN NA 0.0 NaN 0.5 NaN NA 0.0 NaN 0.0 NaN Warning message: In plnorm(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.IgnoreWhitespace# +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# +#set.seed(1); plogis(0, 10, 10, lower.tail=FALSE, log.p=FALSE) +[1] 0.7310586 + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# +#set.seed(1); plogis(0, 10, 10, lower.tail=FALSE, log.p=TRUE) +[1] -0.3132617 + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# +#set.seed(1); plogis(0, 10, 10, lower.tail=TRUE, log.p=FALSE) +[1] 0.2689414 + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# +#set.seed(1); plogis(0, 10, 10, lower.tail=TRUE, log.p=TRUE) +[1] -1.313262 + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# +#set.seed(1); plogis(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] 7.310586e-01 7.310586e-01 7.310586e-01 7.310586e-01 7.310586e-01 + [6] 5.000000e-01 0.000000e+00 1.000000e+00 5.000000e-01 5.000000e-01 +[11] 1.000000e+00 1.000000e+00 5.000000e-01 4.999717e-01 5.000000e-01 +[16] 5.004709e-01 5.000000e-01 1.000000e+00 1.000000e+00 5.000000e-01 +[21] 2.234818e-07 1.000000e+00 1.000000e+00 5.000000e-01 5.000000e-01 +[26] 1.000000e+00 5.000000e-01 0.000000e+00 5.000018e-01 5.000000e-01 +[31] 5.000000e-01 1.000000e+00 1.000000e+00 5.000000e-01 5.000000e-01 + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# +#set.seed(1); plogis(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] -3.132617e-01 -3.132617e-01 -3.132617e-01 -3.132617e-01 -3.132617e-01 + [6] -6.931472e-01 -8.130081e+03 0.000000e+00 -6.931472e-01 -6.931472e-01 +[11] 0.000000e+00 0.000000e+00 -6.931472e-01 -6.932038e-01 -6.931472e-01 +[16] -6.922058e-01 -6.931472e-01 0.000000e+00 0.000000e+00 -6.931472e-01 +[21] -1.531394e+01 -2.726033e-231 0.000000e+00 -6.931472e-01 -6.931472e-01 +[26] 0.000000e+00 -6.931472e-01 -3.125000e+78 -6.931435e-01 -6.931472e-01 +[31] -6.931472e-01 0.000000e+00 0.000000e+00 -6.931472e-01 -6.931472e-01 + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# +#set.seed(1); plogis(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] 2.689414e-01 2.689414e-01 2.689414e-01 2.689414e-01 2.689414e-01 + [6] 5.000000e-01 1.000000e+00 0.000000e+00 5.000000e-01 5.000000e-01 +[11] 0.000000e+00 0.000000e+00 5.000000e-01 5.000283e-01 5.000000e-01 +[16] 4.995291e-01 5.000000e-01 0.000000e+00 0.000000e+00 5.000000e-01 +[21] 9.999998e-01 2.726033e-231 0.000000e+00 5.000000e-01 5.000000e-01 +[26] 0.000000e+00 5.000000e-01 1.000000e+00 4.999982e-01 5.000000e-01 +[31] 5.000000e-01 0.000000e+00 0.000000e+00 5.000000e-01 5.000000e-01 + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# +#set.seed(1); plogis(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] -1.313262e+00 -1.313262e+00 -1.313262e+00 -1.313262e+00 -1.313262e+00 + [6] -6.931472e-01 0.000000e+00 -2.040625e+77 -6.931472e-01 -6.931472e-01 +[11] -1.352680e+05 -6.422764e+75 -6.931472e-01 -6.930906e-01 -6.931472e-01 +[16] -6.940894e-01 -6.931472e-01 -2.760313e+82 -8.943734e+67 -6.931472e-01 +[21] -2.234818e-07 -5.308943e+02 -3.843750e+74 -6.931472e-01 -6.931472e-01 +[26] -1.209801e+73 -6.931472e-01 0.000000e+00 -6.931509e-01 -6.931472e-01 +[31] -6.931472e-01 -7.181301e+07 -2.468750e+150 -6.931472e-01 -6.931472e-01 + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# +#set.seed(1); plogis(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 NaN 4.750208e-01 1.670142e-05 NaN + [6] 0.000000e+00 NaN NaN 8.698915e-01 1.000000e+00 + [11] NaN 0.000000e+00 NaN NaN 9.426758e-01 + [16] 9.357623e-14 NaN 1.000000e+00 NaN NaN + [21] 5.000000e-01 5.000000e-01 NaN 0.000000e+00 NaN + [26] NaN 4.501660e-01 5.602796e-09 NaN 1.000000e+00 + [31] NaN NaN 7.502601e-01 9.998766e-01 NaN + [36] 0.000000e+00 NaN NaN 6.681878e-01 9.999546e-01 + [41] NaN 5.000000e-01 NaN NaN 9.820138e-01 + [46] 4.539787e-05 NaN 0.000000e+00 NaN NaN + [51] 2.314752e-01 2.061154e-09 NaN 1.000000e+00 NaN + [56] NaN 7.310586e-01 7.310586e-01 NaN 1.000000e+00 + [61] NaN NaN 4.750208e-01 1.670142e-05 NaN + [66] 0.000000e+00 NaN NaN 8.698915e-01 1.000000e+00 + [71] NaN 0.000000e+00 NaN NaN 9.426758e-01 + [76] 9.357623e-14 NaN 1.000000e+00 NaN NaN + [81] 5.000000e-01 5.000000e-01 NaN 0.000000e+00 NaN + [86] NaN 4.501660e-01 5.602796e-09 NaN 1.000000e+00 + [91] NaN NaN 7.502601e-01 9.998766e-01 NaN + [96] 0.000000e+00 NaN NaN 6.681878e-01 9.999546e-01 +[101] NaN 5.000000e-01 NaN NaN 9.820138e-01 +[106] 4.539787e-05 NaN 0.000000e+00 NaN NaN +[111] 2.314752e-01 2.061154e-09 NaN 1.000000e+00 NaN +[116] NaN 7.310586e-01 7.310586e-01 NaN 1.000000e+00 +Warning message: +In plogis(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); plogis(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 NaN -7.443967e-01 -1.100002e+01 NaN + [6] -1.000000e+04 NaN NaN -1.393868e-01 -9.357623e-14 + [11] NaN -2.000000e+04 NaN NaN -5.903283e-02 + [16] -3.000000e+01 NaN 0.000000e+00 NaN NaN + [21] -6.931472e-01 -6.931472e-01 NaN -1.100000e+04 NaN + [26] NaN -7.981389e-01 -1.900000e+01 NaN 0.000000e+00 + [31] NaN NaN -2.873353e-01 -1.234022e-04 NaN + [36] -3.000000e+04 NaN NaN -4.031860e-01 -4.539890e-05 + [41] NaN -6.931472e-01 NaN NaN -1.814993e-02 + [46] -1.000005e+01 NaN -1.900000e+04 NaN NaN + [51] -1.463282e+00 -2.000000e+01 NaN 0.000000e+00 NaN + [56] NaN -3.132617e-01 -3.132617e-01 NaN 0.000000e+00 + [61] NaN NaN -7.443967e-01 -1.100002e+01 NaN + [66] -1.000000e+04 NaN NaN -1.393868e-01 -9.357623e-14 + [71] NaN -2.000000e+04 NaN NaN -5.903283e-02 + [76] -3.000000e+01 NaN 0.000000e+00 NaN NaN + [81] -6.931472e-01 -6.931472e-01 NaN -1.100000e+04 NaN + [86] NaN -7.981389e-01 -1.900000e+01 NaN 0.000000e+00 + [91] NaN NaN -2.873353e-01 -1.234022e-04 NaN + [96] -3.000000e+04 NaN NaN -4.031860e-01 -4.539890e-05 +[101] NaN -6.931472e-01 NaN NaN -1.814993e-02 +[106] -1.000005e+01 NaN -1.900000e+04 NaN NaN +[111] -1.463282e+00 -2.000000e+01 NaN 0.000000e+00 NaN +[116] NaN -3.132617e-01 -3.132617e-01 NaN 0.000000e+00 +Warning message: +In plogis(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); plogis(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 NaN 5.249792e-01 9.999833e-01 NaN + [6] 1.000000e+00 NaN NaN 1.301085e-01 9.357623e-14 + [11] NaN 1.000000e+00 NaN NaN 5.732418e-02 + [16] 1.000000e+00 NaN 0.000000e+00 NaN NaN + [21] 5.000000e-01 5.000000e-01 NaN 1.000000e+00 NaN + [26] NaN 5.498340e-01 1.000000e+00 NaN 0.000000e+00 + [31] NaN NaN 2.497399e-01 1.233946e-04 NaN + [36] 1.000000e+00 NaN NaN 3.318122e-01 4.539787e-05 + [41] NaN 5.000000e-01 NaN NaN 1.798621e-02 + [46] 9.999546e-01 NaN 1.000000e+00 NaN NaN + [51] 7.685248e-01 1.000000e+00 NaN 0.000000e+00 NaN + [56] NaN 2.689414e-01 2.689414e-01 NaN 0.000000e+00 + [61] NaN NaN 5.249792e-01 9.999833e-01 NaN + [66] 1.000000e+00 NaN NaN 1.301085e-01 9.357623e-14 + [71] NaN 1.000000e+00 NaN NaN 5.732418e-02 + [76] 1.000000e+00 NaN 0.000000e+00 NaN NaN + [81] 5.000000e-01 5.000000e-01 NaN 1.000000e+00 NaN + [86] NaN 5.498340e-01 1.000000e+00 NaN 0.000000e+00 + [91] NaN NaN 2.497399e-01 1.233946e-04 NaN + [96] 1.000000e+00 NaN NaN 3.318122e-01 4.539787e-05 +[101] NaN 5.000000e-01 NaN NaN 1.798621e-02 +[106] 9.999546e-01 NaN 1.000000e+00 NaN NaN +[111] 7.685248e-01 1.000000e+00 NaN 0.000000e+00 NaN +[116] NaN 2.689414e-01 2.689414e-01 NaN 0.000000e+00 +Warning message: +In plogis(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); plogis(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 NaN -6.443967e-01 -1.670156e-05 NaN + [6] 0.000000e+00 NaN NaN -2.039387e+00 -3.000000e+01 + [11] NaN 0.000000e+00 NaN NaN -2.859033e+00 + [16] -9.357623e-14 NaN -1.000000e+03 NaN NaN + [21] -6.931472e-01 -6.931472e-01 NaN 0.000000e+00 NaN + [26] NaN -5.981389e-01 -5.602796e-09 NaN -3.000000e+04 + [31] NaN NaN -1.387335e+00 -9.000123e+00 NaN + [36] 0.000000e+00 NaN NaN -1.103186e+00 -1.000005e+01 + [41] NaN -6.931472e-01 NaN NaN -4.018150e+00 + [46] -4.539890e-05 NaN 0.000000e+00 NaN NaN + [51] -2.632825e-01 -2.061154e-09 NaN -9.000000e+03 NaN + [56] NaN -1.313262e+00 -1.313262e+00 NaN -1.000000e+04 + [61] NaN NaN -6.443967e-01 -1.670156e-05 NaN + [66] 0.000000e+00 NaN NaN -2.039387e+00 -3.000000e+01 + [71] NaN 0.000000e+00 NaN NaN -2.859033e+00 + [76] -9.357623e-14 NaN -1.000000e+03 NaN NaN + [81] -6.931472e-01 -6.931472e-01 NaN 0.000000e+00 NaN + [86] NaN -5.981389e-01 -5.602796e-09 NaN -3.000000e+04 + [91] NaN NaN -1.387335e+00 -9.000123e+00 NaN + [96] 0.000000e+00 NaN NaN -1.103186e+00 -1.000005e+01 +[101] NaN -6.931472e-01 NaN NaN -4.018150e+00 +[106] -4.539890e-05 NaN 0.000000e+00 NaN NaN +[111] -2.632825e-01 -2.061154e-09 NaN -9.000000e+03 NaN +[116] NaN -1.313262e+00 -1.313262e+00 NaN -1.000000e+04 +Warning message: +In plogis(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); plogis(c(NA, 0, NaN, 1/0, -1/0), rep(c(1, 0, 0.1), 5), rep(c(1, 0, 0.1), 5)) + [1] NA NaN NaN 1.0000000 NaN NA 0.2689414 + [8] NaN 1.0000000 0.0000000 NA 0.2689414 NaN NaN +[15] 0.0000000 +Warning message: +In plogis(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); plogis(rep(c(1, 0, 0.1), 5), c(NA, 0, NaN, 1/0, -1/0), rep(c(1, 0, 0.1), 5)) + [1] NA NaN NaN 0.0000000 NaN NA 0.7310586 + [8] NaN 0.0000000 1.0000000 NA 0.7310586 NaN NaN +[15] 1.0000000 +Warning message: +In plogis(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); plogis(rep(c(1, 0, 0.1), 5), rep(c(1, 0, 0.1), 5), c(NA, 0, NaN, 1/0, -1/0)) + [1] NA NaN NaN 0.5 NaN NA NaN NaN 0.5 NaN NA NaN NaN 0.5 NaN +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); pnorm(0, 10, 10, lower.tail=FALSE, log.p=FALSE) +[1] 0.8413447 + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# +#set.seed(1); pnorm(0, 10, 10, lower.tail=FALSE, log.p=TRUE) +[1] -0.1727538 + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# +#set.seed(1); pnorm(0, 10, 10, lower.tail=TRUE, log.p=FALSE) +[1] 0.1586553 + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# +#set.seed(1); pnorm(0, 10, 10, lower.tail=TRUE, log.p=TRUE) +[1] -1.841022 + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# +#set.seed(1); pnorm(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] 8.413447e-01 8.413447e-01 8.413447e-01 8.413447e-01 8.413447e-01 + [6] 5.000000e-01 0.000000e+00 1.000000e+00 5.000000e-01 5.000000e-01 +[11] 1.000000e+00 1.000000e+00 5.000000e-01 4.999548e-01 5.000000e-01 +[16] 5.007515e-01 5.000000e-01 1.000000e+00 1.000000e+00 5.000000e-01 +[21] 3.085691e-53 1.000000e+00 1.000000e+00 5.000000e-01 5.000000e-01 +[26] 1.000000e+00 5.000000e-01 0.000000e+00 5.000029e-01 5.000000e-01 +[31] 5.000000e-01 1.000000e+00 1.000000e+00 5.000000e-01 5.000000e-01 + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# +#set.seed(1); pnorm(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] -1.727538e-01 -1.727538e-01 -1.727538e-01 -1.727538e-01 -1.727538e-01 + [6] -6.931472e-01 -3.304912e+07 0.000000e+00 -6.931472e-01 -6.931472e-01 +[11] 0.000000e+00 0.000000e+00 -6.931472e-01 -6.932375e-01 -6.931472e-01 +[16] -6.916454e-01 -6.931472e-01 0.000000e+00 0.000000e+00 -6.931472e-01 +[21] -1.209102e+02 0.000000e+00 0.000000e+00 -6.931472e-01 -6.931472e-01 +[26] 0.000000e+00 -6.931472e-01 -4.882813e+156 -6.931413e-01 -6.931472e-01 +[31] -6.931472e-01 0.000000e+00 0.000000e+00 -6.931472e-01 -6.931472e-01 + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# +#set.seed(1); pnorm(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] 0.1586553 0.1586553 0.1586553 0.1586553 0.1586553 0.5000000 1.0000000 + [8] 0.0000000 0.5000000 0.5000000 0.0000000 0.0000000 0.5000000 0.5000452 +[15] 0.5000000 0.4992485 0.5000000 0.0000000 0.0000000 0.5000000 1.0000000 +[22] 0.0000000 0.0000000 0.5000000 0.5000000 0.0000000 0.5000000 1.0000000 +[29] 0.4999971 0.5000000 0.5000000 0.0000000 0.0000000 0.5000000 0.5000000 + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# +#set.seed(1); pnorm(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] -1.841022e+00 -1.841022e+00 -1.841022e+00 -1.841022e+00 -1.841022e+00 + [6] -6.931472e-01 0.000000e+00 -2.082075e+154 -6.931472e-01 -6.931472e-01 +[11] -9.148715e+09 -2.062595e+151 -6.931472e-01 -6.930569e-01 -6.931472e-01 +[16] -6.946512e-01 -6.931472e-01 -3.809663e+164 -3.999519e+135 -6.931472e-01 +[21] -3.085691e-53 -1.409316e+05 -7.387207e+148 -6.931472e-01 -6.931472e-01 +[26] -7.318091e+145 -6.931472e-01 0.000000e+00 -6.931531e-01 -6.931472e-01 +[31] -6.931472e-01 -2.578554e+15 -3.047363e+300 -6.931472e-01 -6.931472e-01 + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# +#set.seed(1); pnorm(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.000000e+00 4.601722e-01 1.910660e-28 NaN + [6] 0.000000e+00 NaN 0.000000e+00 9.712834e-01 1.000000e+00 + [11] NaN 0.000000e+00 NaN 1.000000e+00 9.974449e-01 + [16] 4.906714e-198 NaN 1.000000e+00 NaN 1.000000e+00 + [21] 5.000000e-01 5.000000e-01 NaN 0.000000e+00 NaN + [26] 0.000000e+00 4.207403e-01 8.527224e-81 NaN 1.000000e+00 + [31] NaN 0.000000e+00 8.643339e-01 1.000000e+00 NaN + [36] 0.000000e+00 NaN 1.000000e+00 7.580363e-01 1.000000e+00 + [41] NaN 5.000000e-01 NaN 0.000000e+00 9.999683e-01 + [46] 7.619853e-24 NaN 0.000000e+00 NaN 1.000000e+00 + [51] 1.150697e-01 2.753624e-89 NaN 1.000000e+00 NaN + [56] 0.000000e+00 8.413447e-01 8.413447e-01 NaN 1.000000e+00 + [61] NaN 0.000000e+00 4.601722e-01 1.910660e-28 NaN + [66] 0.000000e+00 NaN 0.000000e+00 9.712834e-01 1.000000e+00 + [71] NaN 0.000000e+00 NaN 1.000000e+00 9.974449e-01 + [76] 4.906714e-198 NaN 1.000000e+00 NaN 1.000000e+00 + [81] 5.000000e-01 5.000000e-01 NaN 0.000000e+00 NaN + [86] 0.000000e+00 4.207403e-01 8.527224e-81 NaN 1.000000e+00 + [91] NaN 0.000000e+00 8.643339e-01 1.000000e+00 NaN + [96] 0.000000e+00 NaN 1.000000e+00 7.580363e-01 1.000000e+00 +[101] NaN 5.000000e-01 NaN 0.000000e+00 9.999683e-01 +[106] 7.619853e-24 NaN 0.000000e+00 NaN 1.000000e+00 +[111] 1.150697e-01 2.753624e-89 NaN 1.000000e+00 NaN +[116] 0.000000e+00 8.413447e-01 8.413447e-01 NaN 1.000000e+00 +Warning message: +In pnorm(c(-1, 0, 0.2, 2), c(-1, 0, 0.1, 0.9, 3), rep(c(-1, 0, 1, : + NaNs produced + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# +#set.seed(1); pnorm(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 -7.761546e-01 -6.382493e+01 NaN + [6] -5.000001e+07 NaN -Inf -2.913695e-02 -4.906714e-198 + [11] NaN -2.000000e+08 NaN 0.000000e+00 -2.558400e-03 + [16] -4.543212e+02 NaN 0.000000e+00 NaN 0.000000e+00 + [21] -6.931472e-01 -6.931472e-01 NaN -6.050001e+07 NaN + [26] -Inf -8.657395e-01 -1.843661e+02 NaN 0.000000e+00 + [31] NaN -Inf -1.457961e-01 -1.128588e-19 NaN + [36] -4.500000e+08 NaN 0.000000e+00 -2.770239e-01 -7.619853e-24 + [41] NaN -6.931472e-01 NaN -Inf -3.167174e-05 + [46] -5.323129e+01 NaN -1.805000e+08 NaN 0.000000e+00 + [51] -2.162218e+00 -2.039172e+02 NaN 0.000000e+00 NaN + [56] -Inf -1.727538e-01 -1.727538e-01 NaN 0.000000e+00 + [61] NaN -Inf -7.761546e-01 -6.382493e+01 NaN + [66] -5.000001e+07 NaN -Inf -2.913695e-02 -4.906714e-198 + [71] NaN -2.000000e+08 NaN 0.000000e+00 -2.558400e-03 + [76] -4.543212e+02 NaN 0.000000e+00 NaN 0.000000e+00 + [81] -6.931472e-01 -6.931472e-01 NaN -6.050001e+07 NaN + [86] -Inf -8.657395e-01 -1.843661e+02 NaN 0.000000e+00 + [91] NaN -Inf -1.457961e-01 -1.128588e-19 NaN + [96] -4.500000e+08 NaN 0.000000e+00 -2.770239e-01 -7.619853e-24 +[101] NaN -6.931472e-01 NaN -Inf -3.167174e-05 +[106] -5.323129e+01 NaN -1.805000e+08 NaN 0.000000e+00 +[111] -2.162218e+00 -2.039172e+02 NaN 0.000000e+00 NaN +[116] -Inf -1.727538e-01 -1.727538e-01 NaN 0.000000e+00 +Warning message: +In pnorm(c(-1, 0, 0.2, 2), c(-1, 0, 0.1, 0.9, 3), rep(c(-1, 0, 1, : + NaNs produced + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# +#set.seed(1); pnorm(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.000000e+00 5.398278e-01 1.000000e+00 NaN + [6] 1.000000e+00 NaN 1.000000e+00 2.871656e-02 4.906714e-198 + [11] NaN 1.000000e+00 NaN 0.000000e+00 2.555130e-03 + [16] 1.000000e+00 NaN 0.000000e+00 NaN 0.000000e+00 + [21] 5.000000e-01 5.000000e-01 NaN 1.000000e+00 NaN + [26] 1.000000e+00 5.792597e-01 1.000000e+00 NaN 0.000000e+00 + [31] NaN 1.000000e+00 1.356661e-01 1.128588e-19 NaN + [36] 1.000000e+00 NaN 0.000000e+00 2.419637e-01 7.619853e-24 + [41] NaN 5.000000e-01 NaN 1.000000e+00 3.167124e-05 + [46] 1.000000e+00 NaN 1.000000e+00 NaN 0.000000e+00 + [51] 8.849303e-01 1.000000e+00 NaN 0.000000e+00 NaN + [56] 1.000000e+00 1.586553e-01 1.586553e-01 NaN 0.000000e+00 + [61] NaN 1.000000e+00 5.398278e-01 1.000000e+00 NaN + [66] 1.000000e+00 NaN 1.000000e+00 2.871656e-02 4.906714e-198 + [71] NaN 1.000000e+00 NaN 0.000000e+00 2.555130e-03 + [76] 1.000000e+00 NaN 0.000000e+00 NaN 0.000000e+00 + [81] 5.000000e-01 5.000000e-01 NaN 1.000000e+00 NaN + [86] 1.000000e+00 5.792597e-01 1.000000e+00 NaN 0.000000e+00 + [91] NaN 1.000000e+00 1.356661e-01 1.128588e-19 NaN + [96] 1.000000e+00 NaN 0.000000e+00 2.419637e-01 7.619853e-24 +[101] NaN 5.000000e-01 NaN 1.000000e+00 3.167124e-05 +[106] 1.000000e+00 NaN 1.000000e+00 NaN 0.000000e+00 +[111] 8.849303e-01 1.000000e+00 NaN 0.000000e+00 NaN +[116] 1.000000e+00 1.586553e-01 1.586553e-01 NaN 0.000000e+00 +Warning message: +In pnorm(c(-1, 0, 0.2, 2), c(-1, 0, 0.1, 0.9, 3), rep(c(-1, 0, 1, : + NaNs produced + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# +#set.seed(1); pnorm(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 -6.165050e-01 -1.910660e-28 NaN + [6] 0.000000e+00 NaN 0.000000e+00 -3.550281e+00 -4.543212e+02 + [11] NaN 0.000000e+00 NaN -Inf -5.969652e+00 + [16] -4.906714e-198 NaN -5.000078e+05 NaN -Inf + [21] -6.931472e-01 -6.931472e-01 NaN 0.000000e+00 NaN + [26] 0.000000e+00 -5.460044e-01 -8.527224e-81 NaN -4.500000e+08 + [31] NaN 0.000000e+00 -1.997559e+00 -4.362815e+01 NaN + [36] 0.000000e+00 NaN -Inf -1.418968e+00 -5.323129e+01 + [41] NaN -6.931472e-01 NaN 0.000000e+00 -1.036010e+01 + [46] -7.619853e-24 NaN 0.000000e+00 NaN -Inf + [51] -1.222464e-01 -2.753624e-89 NaN -4.050001e+07 NaN + [56] 0.000000e+00 -1.841022e+00 -1.841022e+00 NaN -5.000001e+07 + [61] NaN 0.000000e+00 -6.165050e-01 -1.910660e-28 NaN + [66] 0.000000e+00 NaN 0.000000e+00 -3.550281e+00 -4.543212e+02 + [71] NaN 0.000000e+00 NaN -Inf -5.969652e+00 + [76] -4.906714e-198 NaN -5.000078e+05 NaN -Inf + [81] -6.931472e-01 -6.931472e-01 NaN 0.000000e+00 NaN + [86] 0.000000e+00 -5.460044e-01 -8.527224e-81 NaN -4.500000e+08 + [91] NaN 0.000000e+00 -1.997559e+00 -4.362815e+01 NaN + [96] 0.000000e+00 NaN -Inf -1.418968e+00 -5.323129e+01 +[101] NaN -6.931472e-01 NaN 0.000000e+00 -1.036010e+01 +[106] -7.619853e-24 NaN 0.000000e+00 NaN -Inf +[111] -1.222464e-01 -2.753624e-89 NaN -4.050001e+07 NaN +[116] 0.000000e+00 -1.841022e+00 -1.841022e+00 NaN -5.000001e+07 +Warning message: +In pnorm(c(-1, 0, 0.2, 2), c(-1, 0, 0.1, 0.9, 3), rep(c(-1, 0, 1, : + NaNs produced + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# +#set.seed(1); pnorm(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.0000000 NaN 1.0000000 0.0000000 NA 0.1586553 + [8] NaN 1.0000000 0.0000000 NA 0.1586553 NaN 1.0000000 +[15] 0.0000000 + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# +#set.seed(1); pnorm(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.0000000 NaN 0.0000000 1.0000000 NA 0.8413447 + [8] NaN 0.0000000 1.0000000 NA 0.8413447 NaN 0.0000000 +[15] 1.0000000 + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# +#set.seed(1); pnorm(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.0 NaN 0.5 NaN NA 1.0 NaN 0.5 NaN NA 1.0 NaN 0.5 NaN +Warning message: +In pnorm(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); punif(0, 10, 10, lower.tail=FALSE, log.p=FALSE) +[1] 1 + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# +#set.seed(1); punif(0, 10, 10, lower.tail=FALSE, log.p=TRUE) +[1] 0 + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# +#set.seed(1); punif(0, 10, 10, lower.tail=TRUE, log.p=FALSE) +[1] 0 + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# +#set.seed(1); punif(0, 10, 10, lower.tail=TRUE, log.p=TRUE) +[1] -Inf + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# +#set.seed(1); punif(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] 1.000000e+00 1.000000e+00 1.000000e+00 1.000000e+00 1.000000e+00 + [6] 1.000000e+00 1.229849e-04 NaN 1.000000e+00 1.000000e+00 +[11] NaN NaN 1.000000e+00 9.998868e-01 1.000000e+00 +[16] 1.000000e+00 1.000000e+00 NaN NaN 1.000000e+00 +[21] 6.129729e-02 NaN NaN 1.000000e+00 1.000000e+00 +[26] NaN 1.000000e+00 3.200000e-79 1.000000e+00 1.000000e+00 +[31] 1.000000e+00 NaN NaN 1.000000e+00 1.000000e+00 +Warning message: +In punif(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); punif(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] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 + [6] 0.000000e+00 -9.003449e+00 NaN 0.000000e+00 0.000000e+00 +[11] NaN NaN 0.000000e+00 -1.132054e-04 0.000000e+00 +[16] 0.000000e+00 0.000000e+00 NaN NaN 0.000000e+00 +[21] -2.792020e+00 NaN NaN 0.000000e+00 0.000000e+00 +[26] NaN 0.000000e+00 -1.807411e+02 0.000000e+00 0.000000e+00 +[31] 0.000000e+00 NaN NaN 0.000000e+00 0.000000e+00 +Warning message: +In punif(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); punif(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] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 + [6] 0.000000e+00 9.998770e-01 NaN 0.000000e+00 0.000000e+00 +[11] NaN NaN 0.000000e+00 1.131990e-04 0.000000e+00 +[16] 0.000000e+00 0.000000e+00 NaN NaN 0.000000e+00 +[21] 9.387027e-01 NaN NaN 0.000000e+00 0.000000e+00 +[26] NaN 0.000000e+00 1.000000e+00 0.000000e+00 0.000000e+00 +[31] 0.000000e+00 NaN NaN 0.000000e+00 1.265823e-72 +Warning message: +In punif(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); punif(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] -Inf -Inf -Inf -Inf -Inf + [6] -Inf -1.229924e-04 NaN -Inf -Inf +[11] NaN NaN -Inf -9.086363e+00 -Inf +[16] -Inf -Inf NaN NaN -Inf +[21] -6.325645e-02 NaN NaN -Inf -Inf +[26] NaN -Inf 0.000000e+00 -Inf -Inf +[31] -Inf NaN NaN -Inf -1.655504e+02 +Warning message: +In punif(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); punif(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] 0.00000000 0.00000000 0.88888889 NaN NaN 0.00009999 + [7] NaN NaN 1.00000000 NaN 0.00000000 0.00000000 + [13] NaN NaN NaN 0.00000000 NaN NaN + [19] NaN NaN 1.00000000 1.00000000 NaN NaN + [25] NaN 0.00000000 0.80000000 0.00000000 NaN NaN + [31] 0.00000000 0.00000000 1.00000000 NaN NaN 0.00000000 + [37] NaN NaN 1.00000000 NaN 1.00000000 1.00000000 + [43] NaN NaN NaN 0.09090909 NaN NaN + [49] NaN NaN 0.40000000 0.00000000 NaN NaN + [55] NaN 0.00000000 1.00000000 1.00000000 NaN NaN + [61] 0.00000000 0.00000000 0.88888889 NaN NaN 0.00009999 + [67] NaN NaN 1.00000000 NaN 0.00000000 0.00000000 + [73] NaN NaN NaN 0.00000000 NaN NaN + [79] NaN NaN 1.00000000 1.00000000 NaN NaN + [85] NaN 0.00000000 0.80000000 0.00000000 NaN NaN + [91] 0.00000000 0.00000000 1.00000000 NaN NaN 0.00000000 + [97] NaN NaN 1.00000000 NaN 1.00000000 1.00000000 +[103] NaN NaN NaN 0.09090909 NaN NaN +[109] NaN NaN 0.40000000 0.00000000 NaN NaN +[115] NaN 0.00000000 1.00000000 1.00000000 NaN NaN +Warning message: +In punif(c(-1, 0, 0.2, 2), c(-1, 0, 0.1, 0.9, 3), rep(c(-1, 0, 1, : + NaNs produced + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# +#set.seed(1); punif(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] -Inf -Inf -0.1177830 NaN NaN -9.2104404 + [7] NaN NaN 0.0000000 NaN -Inf -Inf + [13] NaN NaN NaN -Inf NaN NaN + [19] NaN NaN 0.0000000 0.0000000 NaN NaN + [25] NaN -Inf -0.2231436 -Inf NaN NaN + [31] -Inf -Inf 0.0000000 NaN NaN -Inf + [37] NaN NaN 0.0000000 NaN 0.0000000 0.0000000 + [43] NaN NaN NaN -2.3978953 NaN NaN + [49] NaN NaN -0.9162907 -Inf NaN NaN + [55] NaN -Inf 0.0000000 0.0000000 NaN NaN + [61] -Inf -Inf -0.1177830 NaN NaN -9.2104404 + [67] NaN NaN 0.0000000 NaN -Inf -Inf + [73] NaN NaN NaN -Inf NaN NaN + [79] NaN NaN 0.0000000 0.0000000 NaN NaN + [85] NaN -Inf -0.2231436 -Inf NaN NaN + [91] -Inf -Inf 0.0000000 NaN NaN -Inf + [97] NaN NaN 0.0000000 NaN 0.0000000 0.0000000 +[103] NaN NaN NaN -2.3978953 NaN NaN +[109] NaN NaN -0.9162907 -Inf NaN NaN +[115] NaN -Inf 0.0000000 0.0000000 NaN NaN +Warning message: +In punif(c(-1, 0, 0.2, 2), c(-1, 0, 0.1, 0.9, 3), rep(c(-1, 0, 1, : + NaNs produced + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# +#set.seed(1); punif(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] 1.0000000 1.0000000 0.1111111 NaN NaN 0.9999000 NaN + [8] NaN 0.0000000 NaN 1.0000000 1.0000000 NaN NaN + [15] NaN 1.0000000 NaN NaN NaN NaN 0.0000000 + [22] 0.0000000 NaN NaN NaN 1.0000000 0.2000000 1.0000000 + [29] NaN NaN 1.0000000 1.0000000 0.0000000 NaN NaN + [36] 1.0000000 NaN NaN 0.0000000 NaN 0.0000000 0.0000000 + [43] NaN NaN NaN 0.9090909 NaN NaN NaN + [50] NaN 0.6000000 1.0000000 NaN NaN NaN 1.0000000 + [57] 0.0000000 0.0000000 NaN NaN 1.0000000 1.0000000 0.1111111 + [64] NaN NaN 0.9999000 NaN NaN 0.0000000 NaN + [71] 1.0000000 1.0000000 NaN NaN NaN 1.0000000 NaN + [78] NaN NaN NaN 0.0000000 0.0000000 NaN NaN + [85] NaN 1.0000000 0.2000000 1.0000000 NaN NaN 1.0000000 + [92] 1.0000000 0.0000000 NaN NaN 1.0000000 NaN NaN + [99] 0.0000000 NaN 0.0000000 0.0000000 NaN NaN NaN +[106] 0.9090909 NaN NaN NaN NaN 0.6000000 1.0000000 +[113] NaN NaN NaN 1.0000000 0.0000000 0.0000000 NaN +[120] NaN +Warning message: +In punif(c(-1, 0, 0.2, 2), c(-1, 0, 0.1, 0.9, 3), rep(c(-1, 0, 1, : + NaNs produced + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# +#set.seed(1); punif(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] 0.000000000 0.000000000 -2.197224577 NaN NaN + [6] -0.000099995 NaN NaN -Inf NaN + [11] 0.000000000 0.000000000 NaN NaN NaN + [16] 0.000000000 NaN NaN NaN NaN + [21] -Inf -Inf NaN NaN NaN + [26] 0.000000000 -1.609437912 0.000000000 NaN NaN + [31] 0.000000000 0.000000000 -Inf NaN NaN + [36] 0.000000000 NaN NaN -Inf NaN + [41] -Inf -Inf NaN NaN NaN + [46] -0.095310180 NaN NaN NaN NaN + [51] -0.510825624 0.000000000 NaN NaN NaN + [56] 0.000000000 -Inf -Inf NaN NaN + [61] 0.000000000 0.000000000 -2.197224577 NaN NaN + [66] -0.000099995 NaN NaN -Inf NaN + [71] 0.000000000 0.000000000 NaN NaN NaN + [76] 0.000000000 NaN NaN NaN NaN + [81] -Inf -Inf NaN NaN NaN + [86] 0.000000000 -1.609437912 0.000000000 NaN NaN + [91] 0.000000000 0.000000000 -Inf NaN NaN + [96] 0.000000000 NaN NaN -Inf NaN +[101] -Inf -Inf NaN NaN NaN +[106] -0.095310180 NaN NaN NaN NaN +[111] -0.510825624 0.000000000 NaN NaN NaN +[116] 0.000000000 -Inf -Inf NaN NaN +Warning message: +In punif(c(-1, 0, 0.2, 2), c(-1, 0, 0.1, 0.9, 3), rep(c(-1, 0, 1, : + NaNs produced + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# +#set.seed(1); punif(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 1 0 NA 0 NaN 1 0 + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# +#set.seed(1); punif(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 punif(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); punif(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 NaN NaN NaN NaN NA NaN NaN NaN NaN +Warning message: +In punif(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); qbeta(0, 10, 10, lower.tail=FALSE, log.p=FALSE) +[1] 1 + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# +#set.seed(1); qbeta(0, 10, 10, lower.tail=FALSE, log.p=TRUE) +[1] 0 + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# +#set.seed(1); qbeta(0, 10, 10, lower.tail=TRUE, log.p=FALSE) +[1] 0 + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# +#set.seed(1); qbeta(0, 10, 10, lower.tail=TRUE, log.p=TRUE) +[1] 1 + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# +#set.seed(1); qbeta(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] 1 1 1 1 1 1 NaN 1 1 1 1 1 1 NaN 1 1 1 1 1 +[20] 1 NaN 1 1 1 1 1 1 NaN 1 1 1 1 1 1 NaN +Warning message: +In qbeta(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); qbeta(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] 0 0 0 0 0 0 NaN 0 0 0 0 0 0 NaN 0 0 0 0 0 +[20] 0 NaN 0 0 0 0 0 0 NaN 0 0 0 0 0 0 NaN +Warning message: +In qbeta(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); qbeta(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] 0 0 0 0 0 0 NaN 0 0 0 0 0 0 NaN 0 0 0 0 0 +[20] 0 NaN 0 0 0 0 0 0 NaN 0 0 0 0 0 0 NaN +Warning message: +In qbeta(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); qbeta(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] 1 1 1 1 1 1 NaN 1 1 1 1 1 1 NaN 1 1 1 1 1 +[20] 1 NaN 1 1 1 1 1 1 NaN 1 1 1 1 1 1 NaN +Warning message: +In qbeta(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); qbeta(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 1.0000000 0.1073742 NaN NaN NaN NaN + [8] NaN NaN 1.0000000 NaN NaN NaN 1.0000000 + [15] 0.9283178 NaN NaN 1.0000000 NaN NaN NaN + [22] 1.0000000 NaN NaN NaN NaN 0.0000000 NaN + [29] NaN 1.0000000 NaN NaN NaN 1.0000000 NaN + [36] NaN NaN 1.0000000 0.7804089 NaN NaN 1.0000000 + [43] NaN NaN NaN NaN NaN NaN NaN + [50] 1.0000000 NaN NaN NaN 1.0000000 NaN NaN + [57] NaN 1.0000000 NaN NaN NaN 1.0000000 0.1073742 + [64] NaN NaN NaN NaN NaN NaN 1.0000000 + [71] NaN NaN NaN 1.0000000 0.9283178 NaN NaN + [78] 1.0000000 NaN NaN NaN 1.0000000 NaN NaN + [85] NaN NaN 0.0000000 NaN NaN 1.0000000 NaN + [92] NaN NaN 1.0000000 NaN NaN NaN 1.0000000 + [99] 0.7804089 NaN NaN 1.0000000 NaN NaN NaN +[106] NaN NaN NaN NaN 1.0000000 NaN NaN +[113] NaN 1.0000000 NaN NaN NaN 1.0000000 NaN +[120] NaN +Warning message: +In qbeta(c(-1, 0, 0.2, 2), c(-1, 0, 0.1, 0.9, 3), rep(c(-1, 0, 1, : + NaNs produced + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# +#set.seed(1); qbeta(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.00000000 NaN NaN NaN NaN + [7] NaN NaN 0.60071237 0.00000000 NaN NaN + [13] NaN 0.00000000 NaN NaN NaN 0.00000000 + [19] NaN NaN NaN 0.00000000 NaN NaN + [25] NaN NaN NaN NaN NaN 0.00000000 + [31] NaN NaN 0.01018589 0.00000000 NaN NaN + [37] NaN 0.00000000 NaN NaN NaN 0.00000000 + [43] NaN NaN 0.85822265 NaN NaN NaN + [49] NaN 0.00000000 NaN NaN NaN 0.00000000 + [55] NaN NaN 0.00000000 0.00000000 NaN NaN + [61] NaN 0.00000000 NaN NaN NaN NaN + [67] NaN NaN 0.60071237 0.00000000 NaN NaN + [73] NaN 0.00000000 NaN NaN NaN 0.00000000 + [79] NaN NaN NaN 0.00000000 NaN NaN + [85] NaN NaN NaN NaN NaN 0.00000000 + [91] NaN NaN 0.01018589 0.00000000 NaN NaN + [97] NaN 0.00000000 NaN NaN NaN 0.00000000 +[103] NaN NaN 0.85822265 NaN NaN NaN +[109] NaN 0.00000000 NaN NaN NaN 0.00000000 +[115] NaN NaN 0.00000000 0.00000000 NaN NaN +Warning message: +In qbeta(c(-1, 0, 0.2, 2), c(-1, 0, 0.1, 0.9, 3), rep(c(-1, 0, 1, : + NaNs produced + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# +#set.seed(1); qbeta(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.0000000000 0.0000001024 NaN NaN + [6] NaN NaN NaN NaN 0.0000000000 + [11] NaN NaN NaN 0.0000000000 0.5848035476 + [16] NaN NaN 0.0000000000 NaN NaN + [21] NaN 0.0000000000 NaN NaN NaN + [26] NaN 0.0000000000 NaN NaN 0.0000000000 + [31] NaN NaN NaN 0.0000000000 NaN + [36] NaN NaN 0.0000000000 0.1672502062 NaN + [41] NaN 0.0000000000 NaN NaN NaN + [46] NaN NaN NaN NaN 0.0000000000 + [51] NaN NaN NaN 0.0000000000 NaN + [56] NaN NaN 0.0000000000 NaN NaN + [61] NaN 0.0000000000 0.0000001024 NaN NaN + [66] NaN NaN NaN NaN 0.0000000000 + [71] NaN NaN NaN 0.0000000000 0.5848035476 + [76] NaN NaN 0.0000000000 NaN NaN + [81] NaN 0.0000000000 NaN NaN NaN + [86] NaN 0.0000000000 NaN NaN 0.0000000000 + [91] NaN NaN NaN 0.0000000000 NaN + [96] NaN NaN 0.0000000000 0.1672502062 NaN +[101] NaN 0.0000000000 NaN NaN NaN +[106] NaN NaN NaN NaN 0.0000000000 +[111] NaN NaN NaN 0.0000000000 NaN +[116] NaN NaN 0.0000000000 NaN NaN +Warning message: +In qbeta(c(-1, 0, 0.2, 2), c(-1, 0, 0.1, 0.9, 3), rep(c(-1, 0, 1, : + NaNs produced + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# +#set.seed(1); qbeta(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 1.000000e+00 NaN NaN NaN + [6] NaN NaN NaN 3.291930e-01 1.000000e+00 + [11] NaN NaN NaN 1.000000e+00 NaN + [16] NaN NaN 1.000000e+00 NaN NaN + [21] NaN 1.000000e+00 NaN NaN NaN + [26] NaN NaN NaN NaN 1.000000e+00 + [31] NaN NaN 4.539993e-05 1.000000e+00 NaN + [36] NaN NaN 1.000000e+00 NaN NaN + [41] NaN 1.000000e+00 NaN NaN 7.165313e-01 + [46] NaN NaN NaN NaN 1.000000e+00 + [51] NaN NaN NaN 1.000000e+00 NaN + [56] NaN 0.000000e+00 1.000000e+00 NaN NaN + [61] NaN 1.000000e+00 NaN NaN NaN + [66] NaN NaN NaN 3.291930e-01 1.000000e+00 + [71] NaN NaN NaN 1.000000e+00 NaN + [76] NaN NaN 1.000000e+00 NaN NaN + [81] NaN 1.000000e+00 NaN NaN NaN + [86] NaN NaN NaN NaN 1.000000e+00 + [91] NaN NaN 4.539993e-05 1.000000e+00 NaN + [96] NaN NaN 1.000000e+00 NaN NaN +[101] NaN 1.000000e+00 NaN NaN 7.165313e-01 +[106] NaN NaN NaN NaN 1.000000e+00 +[111] NaN NaN NaN 1.000000e+00 NaN +[116] NaN 0.000000e+00 1.000000e+00 NaN NaN +Warning message: +In qbeta(c(-1, 0, 0.2, 2), c(-1, 0, 0.1, 0.9, 3), rep(c(-1, 0, 1, : + NaNs produced + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# +#set.seed(1); qbeta(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 0 NaN NaN NaN +Warning message: +In qbeta(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); qbeta(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 1 NaN NA 1 NaN 1 NaN NA 0 NaN 0 NaN +Warning message: +In qbeta(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); qbeta(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 1 NaN NA 1 NaN 0 NaN NA 1 NaN 0 NaN +Warning message: +In qbeta(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); qcauchy(0, 10, 10, lower.tail=FALSE, log.p=FALSE) [1] Inf -##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.IgnoreWhitespace# +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# #set.seed(1); qcauchy(0, 10, 10, lower.tail=FALSE, log.p=TRUE) [1] -Inf -##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.IgnoreWhitespace# +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# #set.seed(1); qcauchy(0, 10, 10, lower.tail=TRUE, log.p=FALSE) [1] -Inf -##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.IgnoreWhitespace# +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# #set.seed(1); qcauchy(0, 10, 10, lower.tail=TRUE, log.p=TRUE) [1] Inf -##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.IgnoreWhitespace# +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# #set.seed(1); qcauchy(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] Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf [20] Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf -##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.IgnoreWhitespace# +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# #set.seed(1); qcauchy(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] -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf [16] -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf [31] -Inf -Inf -Inf -Inf -Inf -##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.IgnoreWhitespace# +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# #set.seed(1); qcauchy(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] -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf [16] -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf [31] -Inf -Inf -Inf -Inf -Inf -##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.IgnoreWhitespace# +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# #set.seed(1); qcauchy(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] Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf [20] Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf -##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.IgnoreWhitespace# +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# #set.seed(1); qcauchy(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.0000000 1.4763819 NaN NaN Inf [7] NaN NaN NaN Inf NaN NaN @@ -115873,7 +118063,7 @@ Warning message: In qcauchy(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.IgnoreWhitespace# +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# #set.seed(1); qcauchy(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.0000000 NaN NaN NaN -Inf [7] NaN NaN 1.3406711 -Inf NaN NaN @@ -115899,7 +118089,7 @@ Warning message: In qcauchy(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.IgnoreWhitespace# +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# #set.seed(1); qcauchy(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.0000000 -1.2763819 NaN NaN -Inf [7] NaN NaN NaN -Inf NaN NaN @@ -115925,7 +118115,7 @@ Warning message: In qcauchy(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.IgnoreWhitespace# +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# #set.seed(1); qcauchy(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.0000000 NaN NaN NaN Inf [7] NaN NaN 0.4593289 Inf NaN NaN @@ -115951,14 +118141,14 @@ Warning message: In qcauchy(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.IgnoreWarningContext# +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# #set.seed(1); qcauchy(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 -Inf NaN NaN NaN NA -Inf NaN NaN NaN Warning message: In qcauchy(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.IgnoreWarningContext# +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# #set.seed(1); qcauchy(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.0000000 NaN Inf -Inf NA [7] Inf NaN Inf NaN NA -0.3077684 @@ -115967,48 +118157,232 @@ Warning message: In qcauchy(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.IgnoreWhitespace# +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# #set.seed(1); qcauchy(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.0 NaN NaN NaN NA 1.0 NaN NaN NaN NA 0.1 NaN NaN NaN Warning message: In qcauchy(rep(c(1, 0, 0.1), 5), rep(c(1, 0, 0.1), 5), c(NA, 0, : NaNs produced -##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.IgnoreWhitespace# +##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 + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# +#set.seed(1); qf(0, 10, 10, lower.tail=FALSE, log.p=TRUE) +[1] 0 + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# +#set.seed(1); qf(0, 10, 10, lower.tail=TRUE, log.p=FALSE) +[1] 0 + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# +#set.seed(1); qf(0, 10, 10, lower.tail=TRUE, log.p=TRUE) +[1] Inf + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# +#set.seed(1); qf(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] Inf Inf Inf Inf Inf NaN NaN Inf Inf Inf Inf Inf NaN NaN Inf Inf Inf Inf Inf +[20] NaN NaN Inf Inf Inf Inf Inf NaN NaN Inf Inf Inf Inf Inf NaN NaN +Warning message: +In qf(0, c(0.0653, 0.000123, 3.2e-79, 8833, 7.9e+71, 0, -1), rep(c(0.0653, : + NaNs produced + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# +#set.seed(1); qf(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] 0 0 0 0 0 NaN NaN 0 0 0 0 0 NaN NaN 0 0 0 0 0 +[20] NaN NaN 0 0 0 0 0 NaN NaN 0 0 0 0 0 NaN NaN +Warning message: +In qf(0, c(0.0653, 0.000123, 3.2e-79, 8833, 7.9e+71, 0, -1), rep(c(0.0653, : + NaNs produced + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# +#set.seed(1); qf(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] 0 0 0 0 0 NaN NaN 0 0 0 0 0 NaN NaN 0 0 0 0 0 +[20] NaN NaN 0 0 0 0 0 NaN NaN 0 0 0 0 0 NaN NaN +Warning message: +In qf(0, c(0.0653, 0.000123, 3.2e-79, 8833, 7.9e+71, 0, -1), rep(c(0.0653, : + NaNs produced + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# +#set.seed(1); qf(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] Inf Inf Inf Inf Inf NaN NaN Inf Inf Inf Inf Inf NaN NaN Inf Inf Inf Inf Inf +[20] NaN NaN Inf Inf Inf Inf Inf NaN NaN Inf Inf Inf Inf Inf NaN NaN +Warning message: +In qf(0, c(0.0653, 0.000123, 3.2e-79, 8833, 7.9e+71, 0, -1), rep(c(0.0653, : + NaNs produced + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# +#set.seed(1); qf(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 NaN 0.4368535 NaN NaN NaN + [7] NaN NaN NaN Inf NaN NaN + [13] NaN NaN 13.0639281 NaN NaN Inf + [19] NaN NaN NaN NaN NaN NaN + [25] NaN NaN NaN NaN NaN Inf + [31] NaN NaN NaN Inf NaN NaN + [37] NaN NaN 9.0192419 NaN NaN NaN + [43] NaN NaN NaN NaN NaN NaN + [49] NaN NaN NaN NaN NaN Inf + [55] NaN NaN NaN Inf NaN NaN + [61] NaN NaN 0.4368535 NaN NaN NaN + [67] NaN NaN NaN Inf NaN NaN + [73] NaN NaN 13.0639281 NaN NaN Inf + [79] NaN NaN NaN NaN NaN NaN + [85] NaN NaN NaN NaN NaN Inf + [91] NaN NaN NaN Inf NaN NaN + [97] NaN NaN 9.0192419 NaN NaN NaN +[103] NaN NaN NaN NaN NaN NaN +[109] NaN NaN NaN NaN NaN Inf +[115] NaN NaN NaN Inf NaN NaN +Warning message: +In qf(c(-1, 0, 0.2, 2), c(-1, 0, 0.1, 0.9, 3), rep(c(-1, 0, 1, 0.1, : + NaNs produced + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# +#set.seed(1); qf(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 NaN NaN NaN NaN NaN + [7] NaN NaN 2.19885391 0.00000000 NaN NaN + [13] NaN NaN NaN NaN NaN 0.00000000 + [19] NaN NaN NaN NaN NaN NaN + [25] NaN NaN NaN NaN NaN 0.00000000 + [31] NaN NaN 0.00384456 0.00000000 NaN NaN + [37] NaN NaN NaN NaN NaN NaN + [43] NaN NaN 3.54447244 NaN NaN NaN + [49] NaN NaN NaN NaN NaN 0.00000000 + [55] NaN NaN NaN 0.00000000 NaN NaN + [61] NaN NaN NaN NaN NaN NaN + [67] NaN NaN 2.19885391 0.00000000 NaN NaN + [73] NaN NaN NaN NaN NaN 0.00000000 + [79] NaN NaN NaN NaN NaN NaN + [85] NaN NaN NaN NaN NaN 0.00000000 + [91] NaN NaN 0.00384456 0.00000000 NaN NaN + [97] NaN NaN NaN NaN NaN NaN +[103] NaN NaN 3.54447244 NaN NaN NaN +[109] NaN NaN NaN NaN NaN 0.00000000 +[115] NaN NaN NaN 0.00000000 NaN NaN +Warning message: +In qf(c(-1, 0, 0.2, 2), c(-1, 0, 0.1, 0.9, 3), rep(c(-1, 0, 1, 0.1, : + NaNs produced + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# +#set.seed(1); qf(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 NaN 3.885781e-13 NaN NaN + [6] NaN NaN NaN NaN 0.000000e+00 + [11] NaN NaN NaN NaN 3.728274e-01 + [16] NaN NaN 0.000000e+00 NaN NaN + [21] NaN NaN NaN NaN NaN + [26] NaN NaN NaN NaN 0.000000e+00 + [31] NaN NaN NaN 0.000000e+00 NaN + [36] NaN NaN NaN 8.286649e-02 NaN + [41] NaN NaN NaN NaN NaN + [46] NaN NaN NaN NaN NaN + [51] NaN NaN NaN 0.000000e+00 NaN + [56] NaN NaN 0.000000e+00 NaN NaN + [61] NaN NaN 3.885781e-13 NaN NaN + [66] NaN NaN NaN NaN 0.000000e+00 + [71] NaN NaN NaN NaN 3.728274e-01 + [76] NaN NaN 0.000000e+00 NaN NaN + [81] NaN NaN NaN NaN NaN + [86] NaN NaN NaN NaN 0.000000e+00 + [91] NaN NaN NaN 0.000000e+00 NaN + [96] NaN NaN NaN 8.286649e-02 NaN +[101] NaN NaN NaN NaN NaN +[106] NaN NaN NaN NaN NaN +[111] NaN NaN NaN 0.000000e+00 NaN +[116] NaN NaN 0.000000e+00 NaN NaN +Warning message: +In qf(c(-1, 0, 0.2, 2), c(-1, 0, 0.1, 0.9, 3), rep(c(-1, 0, 1, 0.1, : + NaNs produced + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# +#set.seed(1); qf(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 NaN NaN NaN NaN + [6] NaN NaN NaN 3.712400e-01 Inf + [11] NaN NaN NaN NaN NaN + [16] NaN NaN Inf NaN NaN + [21] NaN NaN NaN NaN NaN + [26] NaN NaN NaN NaN Inf + [31] NaN NaN 7.636093e-08 Inf NaN + [36] NaN NaN NaN NaN NaN + [41] NaN NaN NaN NaN 8.941077e-01 + [46] NaN NaN NaN NaN NaN + [51] NaN NaN NaN Inf NaN + [56] NaN NaN Inf NaN NaN + [61] NaN NaN NaN NaN NaN + [66] NaN NaN NaN 3.712400e-01 Inf + [71] NaN NaN NaN NaN NaN + [76] NaN NaN Inf NaN NaN + [81] NaN NaN NaN NaN NaN + [86] NaN NaN NaN NaN Inf + [91] NaN NaN 7.636093e-08 Inf NaN + [96] NaN NaN NaN NaN NaN +[101] NaN NaN NaN NaN 8.941077e-01 +[106] NaN NaN NaN NaN NaN +[111] NaN NaN NaN Inf NaN +[116] NaN NaN Inf NaN NaN +Warning message: +In qf(c(-1, 0, 0.2, 2), c(-1, 0, 0.1, 0.9, 3), rep(c(-1, 0, 1, 0.1, : + NaNs produced + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# +#set.seed(1); qf(c(NA, 0, NaN, 1/0, -1/0), rep(c(1, 0, 0.1), 5), rep(c(1, 0, 0.1), 5)) + [1] NA NaN NaN NaN NaN NA 0 NaN NaN NaN NA 0 NaN NaN NaN +Warning message: +In qf(c(NA, 0, NaN, 1/0, -1/0), rep(c(1, 0, 0.1), 5), rep(c(1, 0, : + NaNs produced + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# +#set.seed(1); qf(rep(c(1, 0, 0.1), 5), c(NA, 0, NaN, 1/0, -1/0), rep(c(1, 0, 0.1), 5)) + [1] NA NaN NaN Inf NaN NA NaN NaN + [9] 0.655161 NaN NA NaN NaN NaN NaN +Warning message: +In qf(rep(c(1, 0, 0.1), 5), c(NA, 0, NaN, 1/0, -1/0), rep(c(1, 0, : + NaNs produced + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# +#set.seed(1); qf(rep(c(1, 0, 0.1), 5), rep(c(1, 0, 0.1), 5), c(NA, 0, NaN, 1/0, -1/0)) + [1] NA NaN NaN Inf NaN + [6] NA NaN NaN 1.168926e-19 NaN +[11] NA NaN NaN NaN NaN +Warning message: +In qf(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); qlnorm(0, 10, 10, lower.tail=FALSE, log.p=FALSE) [1] Inf -##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.IgnoreWhitespace# +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# #set.seed(1); qlnorm(0, 10, 10, lower.tail=FALSE, log.p=TRUE) [1] 0 -##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.IgnoreWhitespace# +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# #set.seed(1); qlnorm(0, 10, 10, lower.tail=TRUE, log.p=FALSE) [1] 0 -##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.IgnoreWhitespace# +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# #set.seed(1); qlnorm(0, 10, 10, lower.tail=TRUE, log.p=TRUE) [1] Inf -##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.IgnoreWhitespace# +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# #set.seed(1); qlnorm(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] Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf [20] Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf -##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.IgnoreWhitespace# +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# #set.seed(1); qlnorm(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] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.IgnoreWhitespace# +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# #set.seed(1); qlnorm(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] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.IgnoreWhitespace# +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# #set.seed(1); qlnorm(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] Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf [20] Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf -##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.IgnoreWhitespace# +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# #set.seed(1); qlnorm(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 Inf 2.5641351 NaN NaN Inf [7] NaN NaN NaN Inf NaN NaN @@ -116034,7 +118408,7 @@ Warning message: In qlnorm(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.IgnoreWhitespace# +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# #set.seed(1); qlnorm(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.0000000 NaN NaN NaN 0.0000000 [7] NaN NaN 3.4468989 0.0000000 NaN NaN @@ -116060,7 +118434,7 @@ Warning message: In qlnorm(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.IgnoreWhitespace# +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# #set.seed(1); qlnorm(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.0000000 0.4763410 NaN NaN 0.0000000 NaN [8] NaN NaN 0.0000000 NaN NaN NaN 0.0000000 @@ -116084,7 +118458,7 @@ Warning message: In qlnorm(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.IgnoreWhitespace# +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# #set.seed(1); qlnorm(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 Inf NaN NaN NaN Inf [7] NaN NaN 1.7550986 Inf NaN NaN @@ -116110,20 +118484,20 @@ Warning message: In qlnorm(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.IgnoreWarningContext# +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# #set.seed(1); qlnorm(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 0 NaN NaN NaN Warning message: In qlnorm(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.IgnoreWarningContext# +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# #set.seed(1); qlnorm(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.0000000 NaN Inf 0.0000000 NA Inf [8] NaN Inf Inf NA 0.8797169 NaN 0.0000000 [15] 0.0000000 -##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.IgnoreWhitespace# +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# #set.seed(1); qlnorm(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.000000 NaN Inf 0.000000 NA Inf NaN [9] 0.000000 Inf NA 1.105171 NaN 0.000000 NaN @@ -116131,6 +118505,495 @@ Warning message: In qlnorm(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); qlogis(0, 10, 10, lower.tail=FALSE, log.p=FALSE) +[1] Inf + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# +#set.seed(1); qlogis(0, 10, 10, lower.tail=FALSE, log.p=TRUE) +[1] -Inf + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# +#set.seed(1); qlogis(0, 10, 10, lower.tail=TRUE, log.p=FALSE) +[1] -Inf + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# +#set.seed(1); qlogis(0, 10, 10, lower.tail=TRUE, log.p=TRUE) +[1] Inf + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# +#set.seed(1); qlogis(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] Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf +[20] Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# +#set.seed(1); qlogis(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] -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf +[16] -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf +[31] -Inf -Inf -Inf -Inf -Inf + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# +#set.seed(1); qlogis(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] -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf +[16] -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf +[31] -Inf -Inf -Inf -Inf -Inf + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# +#set.seed(1); qlogis(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] Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf +[20] Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# +#set.seed(1); qlogis(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 Inf 1.4862944 NaN NaN Inf NaN + [8] NaN NaN Inf NaN NaN NaN Inf + [15] 4.3862944 NaN NaN Inf NaN NaN NaN + [22] Inf NaN NaN NaN Inf 1.3862944 NaN + [29] NaN Inf NaN NaN NaN Inf NaN + [36] NaN NaN Inf 2.2862944 NaN NaN Inf + [43] NaN NaN NaN Inf NaN NaN NaN + [50] Inf 0.3862944 NaN NaN Inf NaN NaN + [57] NaN Inf NaN NaN NaN Inf 1.4862944 + [64] NaN NaN Inf NaN NaN NaN Inf + [71] NaN NaN NaN Inf 4.3862944 NaN NaN + [78] Inf NaN NaN NaN Inf NaN NaN + [85] NaN Inf 1.3862944 NaN NaN Inf NaN + [92] NaN NaN Inf NaN NaN NaN Inf + [99] 2.2862944 NaN NaN Inf NaN NaN NaN +[106] Inf NaN NaN NaN Inf 0.3862944 NaN +[113] NaN Inf NaN NaN NaN Inf NaN +[120] NaN +Warning message: +In qlogis(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); qlogis(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 -Inf + [7] NaN NaN 1.4413249 -Inf NaN NaN + [13] NaN -Inf NaN NaN NaN -Inf + [19] NaN NaN -0.4586751 -Inf NaN NaN + [25] NaN -Inf NaN NaN NaN -Inf + [31] NaN NaN 0.6413249 -Inf NaN NaN + [37] NaN -Inf NaN NaN NaN -Inf + [43] NaN NaN 3.5413249 -Inf NaN NaN + [49] NaN -Inf NaN NaN NaN -Inf + [55] NaN NaN 0.5413249 -Inf NaN NaN + [61] NaN -Inf NaN NaN NaN -Inf + [67] NaN NaN 1.4413249 -Inf NaN NaN + [73] NaN -Inf NaN NaN NaN -Inf + [79] NaN NaN -0.4586751 -Inf NaN NaN + [85] NaN -Inf NaN NaN NaN -Inf + [91] NaN NaN 0.6413249 -Inf NaN NaN + [97] NaN -Inf NaN NaN NaN -Inf +[103] NaN NaN 3.5413249 -Inf NaN NaN +[109] NaN -Inf NaN NaN NaN -Inf +[115] NaN NaN 0.5413249 -Inf NaN NaN +Warning message: +In qlogis(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); qlogis(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 -Inf -1.2862944 NaN NaN -Inf + [7] NaN NaN NaN -Inf NaN NaN + [13] NaN -Inf 1.6137056 NaN NaN -Inf + [19] NaN NaN NaN -Inf NaN NaN + [25] NaN -Inf -1.3862944 NaN NaN -Inf + [31] NaN NaN NaN -Inf NaN NaN + [37] NaN -Inf -0.4862944 NaN NaN -Inf + [43] NaN NaN NaN -Inf NaN NaN + [49] NaN -Inf -2.3862944 NaN NaN -Inf + [55] NaN NaN NaN -Inf NaN NaN + [61] NaN -Inf -1.2862944 NaN NaN -Inf + [67] NaN NaN NaN -Inf NaN NaN + [73] NaN -Inf 1.6137056 NaN NaN -Inf + [79] NaN NaN NaN -Inf NaN NaN + [85] NaN -Inf -1.3862944 NaN NaN -Inf + [91] NaN NaN NaN -Inf NaN NaN + [97] NaN -Inf -0.4862944 NaN NaN -Inf +[103] NaN NaN NaN -Inf NaN NaN +[109] NaN -Inf -2.3862944 NaN NaN -Inf +[115] NaN NaN NaN -Inf NaN NaN +Warning message: +In qlogis(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); qlogis(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 Inf NaN NaN NaN Inf + [7] NaN NaN 0.3586751 Inf NaN NaN + [13] NaN Inf NaN NaN NaN Inf + [19] NaN NaN -1.5413249 Inf NaN NaN + [25] NaN Inf NaN NaN NaN Inf + [31] NaN NaN -0.4413249 Inf NaN NaN + [37] NaN Inf NaN NaN NaN Inf + [43] NaN NaN 2.4586751 Inf NaN NaN + [49] NaN Inf NaN NaN NaN Inf + [55] NaN NaN -0.5413249 Inf NaN NaN + [61] NaN Inf NaN NaN NaN Inf + [67] NaN NaN 0.3586751 Inf NaN NaN + [73] NaN Inf NaN NaN NaN Inf + [79] NaN NaN -1.5413249 Inf NaN NaN + [85] NaN Inf NaN NaN NaN Inf + [91] NaN NaN -0.4413249 Inf NaN NaN + [97] NaN Inf NaN NaN NaN Inf +[103] NaN NaN 2.4586751 Inf NaN NaN +[109] NaN Inf NaN NaN NaN Inf +[115] NaN NaN -0.5413249 Inf NaN NaN +Warning message: +In qlogis(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); qlogis(c(NA, 0, NaN, 1/0, -1/0), rep(c(1, 0, 0.1), 5), rep(c(1, 0, 0.1), 5)) + [1] NA -Inf NaN NaN NaN NA -Inf NaN NaN NaN NA -Inf NaN NaN NaN +Warning message: +In qlogis(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); qlogis(rep(c(1, 0, 0.1), 5), c(NA, 0, NaN, 1/0, -1/0), rep(c(1, 0, 0.1), 5)) + [1] NA -Inf NaN Inf -Inf NA + [7] Inf NaN Inf Inf NA -0.2197225 +[13] NaN -Inf -Inf + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# +#set.seed(1); qlogis(rep(c(1, 0, 0.1), 5), rep(c(1, 0, 0.1), 5), c(NA, 0, NaN, 1/0, -1/0)) + [1] NA -Inf NaN Inf -Inf NA Inf NaN -Inf Inf NA 0.1 NaN -Inf NaN +Warning message: +In qlogis(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); qnorm(0, 10, 10, lower.tail=FALSE, log.p=FALSE) +[1] Inf + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# +#set.seed(1); qnorm(0, 10, 10, lower.tail=FALSE, log.p=TRUE) +[1] -Inf + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# +#set.seed(1); qnorm(0, 10, 10, lower.tail=TRUE, log.p=FALSE) +[1] -Inf + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# +#set.seed(1); qnorm(0, 10, 10, lower.tail=TRUE, log.p=TRUE) +[1] Inf + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# +#set.seed(1); qnorm(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] Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf +[20] Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# +#set.seed(1); qnorm(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] -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf +[16] -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf +[31] -Inf -Inf -Inf -Inf -Inf + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# +#set.seed(1); qnorm(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] -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf +[16] -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf +[31] -Inf -Inf -Inf -Inf -Inf + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# +#set.seed(1); qnorm(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] Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf +[20] Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# +#set.seed(1); qnorm(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 Inf 0.9416212 NaN NaN Inf + [7] NaN NaN NaN Inf NaN NaN + [13] NaN Inf 3.8416212 NaN NaN Inf + [19] NaN NaN NaN Inf NaN NaN + [25] NaN Inf 0.8416212 NaN NaN Inf + [31] NaN NaN NaN Inf NaN NaN + [37] NaN Inf 1.7416212 NaN NaN Inf + [43] NaN NaN NaN Inf NaN NaN + [49] NaN Inf -0.1583788 NaN NaN Inf + [55] NaN NaN NaN Inf NaN NaN + [61] NaN Inf 0.9416212 NaN NaN Inf + [67] NaN NaN NaN Inf NaN NaN + [73] NaN Inf 3.8416212 NaN NaN Inf + [79] NaN NaN NaN Inf NaN NaN + [85] NaN Inf 0.8416212 NaN NaN Inf + [91] NaN NaN NaN Inf NaN NaN + [97] NaN Inf 1.7416212 NaN NaN Inf +[103] NaN NaN NaN Inf NaN NaN +[109] NaN Inf -0.1583788 NaN NaN Inf +[115] NaN NaN NaN Inf NaN NaN +Warning message: +In qnorm(c(-1, 0, 0.2, 2), c(-1, 0, 0.1, 0.9, 3), rep(c(-1, 0, 1, : + NaNs produced + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# +#set.seed(1); qnorm(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 -Inf NaN + [8] NaN 1.237475 -Inf NaN NaN NaN -Inf + [15] NaN NaN NaN -Inf NaN NaN -0.662525 + [22] -Inf NaN NaN NaN -Inf NaN NaN + [29] NaN -Inf NaN NaN 0.437475 -Inf NaN + [36] NaN NaN -Inf NaN NaN NaN -Inf + [43] NaN NaN 3.337475 -Inf NaN NaN NaN + [50] -Inf NaN NaN NaN -Inf NaN NaN + [57] 0.337475 -Inf NaN NaN NaN -Inf NaN + [64] NaN NaN -Inf NaN NaN 1.237475 -Inf + [71] NaN NaN NaN -Inf NaN NaN NaN + [78] -Inf NaN NaN -0.662525 -Inf NaN NaN + [85] NaN -Inf NaN NaN NaN -Inf NaN + [92] NaN 0.437475 -Inf NaN NaN NaN -Inf + [99] NaN NaN NaN -Inf NaN NaN 3.337475 +[106] -Inf NaN NaN NaN -Inf NaN NaN +[113] NaN -Inf NaN NaN 0.337475 -Inf NaN +[120] NaN +Warning message: +In qnorm(c(-1, 0, 0.2, 2), c(-1, 0, 0.1, 0.9, 3), rep(c(-1, 0, 1, : + NaNs produced + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# +#set.seed(1); qnorm(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 -Inf -0.74162123 NaN NaN -Inf + [7] NaN NaN NaN -Inf NaN NaN + [13] NaN -Inf 2.15837877 NaN NaN -Inf + [19] NaN NaN NaN -Inf NaN NaN + [25] NaN -Inf -0.84162123 NaN NaN -Inf + [31] NaN NaN NaN -Inf NaN NaN + [37] NaN -Inf 0.05837877 NaN NaN -Inf + [43] NaN NaN NaN -Inf NaN NaN + [49] NaN -Inf -1.84162123 NaN NaN -Inf + [55] NaN NaN NaN -Inf NaN NaN + [61] NaN -Inf -0.74162123 NaN NaN -Inf + [67] NaN NaN NaN -Inf NaN NaN + [73] NaN -Inf 2.15837877 NaN NaN -Inf + [79] NaN NaN NaN -Inf NaN NaN + [85] NaN -Inf -0.84162123 NaN NaN -Inf + [91] NaN NaN NaN -Inf NaN NaN + [97] NaN -Inf 0.05837877 NaN NaN -Inf +[103] NaN NaN NaN -Inf NaN NaN +[109] NaN -Inf -1.84162123 NaN NaN -Inf +[115] NaN NaN NaN -Inf NaN NaN +Warning message: +In qnorm(c(-1, 0, 0.2, 2), c(-1, 0, 0.1, 0.9, 3), rep(c(-1, 0, 1, : + NaNs produced + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# +#set.seed(1); qnorm(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 Inf NaN NaN NaN Inf NaN + [8] NaN 0.562525 Inf NaN NaN NaN Inf + [15] NaN NaN NaN Inf NaN NaN -1.337475 + [22] Inf NaN NaN NaN Inf NaN NaN + [29] NaN Inf NaN NaN -0.237475 Inf NaN + [36] NaN NaN Inf NaN NaN NaN Inf + [43] NaN NaN 2.662525 Inf NaN NaN NaN + [50] Inf NaN NaN NaN Inf NaN NaN + [57] -0.337475 Inf NaN NaN NaN Inf NaN + [64] NaN NaN Inf NaN NaN 0.562525 Inf + [71] NaN NaN NaN Inf NaN NaN NaN + [78] Inf NaN NaN -1.337475 Inf NaN NaN + [85] NaN Inf NaN NaN NaN Inf NaN + [92] NaN -0.237475 Inf NaN NaN NaN Inf + [99] NaN NaN NaN Inf NaN NaN 2.662525 +[106] Inf NaN NaN NaN Inf NaN NaN +[113] NaN Inf NaN NaN -0.337475 Inf NaN +[120] NaN +Warning message: +In qnorm(c(-1, 0, 0.2, 2), c(-1, 0, 0.1, 0.9, 3), rep(c(-1, 0, 1, : + NaNs produced + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# +#set.seed(1); qnorm(c(NA, 0, NaN, 1/0, -1/0), rep(c(1, 0, 0.1), 5), rep(c(1, 0, 0.1), 5)) + [1] NA -Inf NaN NaN NaN NA -Inf NaN NaN NaN NA -Inf NaN NaN NaN +Warning message: +In qnorm(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); qnorm(rep(c(1, 0, 0.1), 5), c(NA, 0, NaN, 1/0, -1/0), rep(c(1, 0, 0.1), 5)) + [1] NA -Inf NaN Inf -Inf NA + [7] Inf NaN Inf Inf NA -0.1281552 +[13] NaN -Inf -Inf + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# +#set.seed(1); qnorm(rep(c(1, 0, 0.1), 5), rep(c(1, 0, 0.1), 5), c(NA, 0, NaN, 1/0, -1/0)) + [1] NA -Inf NaN Inf -Inf NA Inf NaN -Inf Inf NA 0.1 NaN -Inf NaN +Warning message: +In qnorm(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); qunif(0, 10, 10, lower.tail=FALSE, log.p=FALSE) +[1] 10 + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# +#set.seed(1); qunif(0, 10, 10, lower.tail=FALSE, log.p=TRUE) +[1] 10 + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# +#set.seed(1); qunif(0, 10, 10, lower.tail=TRUE, log.p=FALSE) +[1] 10 + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# +#set.seed(1); qunif(0, 10, 10, lower.tail=TRUE, log.p=TRUE) +[1] 10 + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# +#set.seed(1); qunif(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] 6.530e-02 1.230e-04 3.200e-79 8.833e+03 7.900e+71 6.530e-02 1.230e-04 + [8] NaN 8.833e+03 7.900e+71 NaN NaN 3.200e-79 8.833e+03 +[15] 7.900e+71 6.530e-02 1.230e-04 NaN NaN 7.900e+71 6.530e-02 +[22] NaN NaN 8.833e+03 7.900e+71 NaN 1.230e-04 0.000e+00 +[29] 8.833e+03 7.900e+71 6.530e-02 NaN NaN 8.833e+03 7.900e+71 +Warning message: +In qunif(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); qunif(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] 6.530e-02 1.230e-04 3.200e-79 8.833e+03 7.900e+71 0.000e+00 + [7] -1.000e+00 NaN 1.230e-04 3.200e-79 NaN NaN +[13] 0.000e+00 -1.000e+00 6.530e-02 1.230e-04 3.200e-79 NaN +[19] NaN 0.000e+00 -1.000e+00 NaN NaN 3.200e-79 +[25] 8.833e+03 NaN 0.000e+00 -1.000e+00 6.530e-02 1.230e-04 +[31] 3.200e-79 NaN NaN 0.000e+00 -1.000e+00 +Warning message: +In qunif(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); qunif(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] 6.530e-02 1.230e-04 3.200e-79 8.833e+03 7.900e+71 0.000e+00 + [7] -1.000e+00 NaN 1.230e-04 3.200e-79 NaN NaN +[13] 0.000e+00 -1.000e+00 6.530e-02 1.230e-04 3.200e-79 NaN +[19] NaN 0.000e+00 -1.000e+00 NaN NaN 3.200e-79 +[25] 8.833e+03 NaN 0.000e+00 -1.000e+00 6.530e-02 1.230e-04 +[31] 3.200e-79 NaN NaN 0.000e+00 -1.000e+00 +Warning message: +In qunif(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); qunif(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] 6.530e-02 1.230e-04 3.200e-79 8.833e+03 7.900e+71 6.530e-02 1.230e-04 + [8] NaN 8.833e+03 7.900e+71 NaN NaN 3.200e-79 8.833e+03 +[15] 7.900e+71 6.530e-02 1.230e-04 NaN NaN 7.900e+71 6.530e-02 +[22] NaN NaN 8.833e+03 7.900e+71 NaN 1.230e-04 0.000e+00 +[29] 8.833e+03 7.900e+71 6.530e-02 NaN NaN 8.833e+03 7.900e+71 +Warning message: +In qunif(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); qunif(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.0000 0.8200 NaN NaN 0.0001 NaN NaN NaN + [10] NaN -0.2800 NaN NaN NaN NaN NaN NaN NaN + [19] NaN NaN NaN 0.1000 NaN NaN NaN 0.0000 0.8000 + [28] NaN NaN NaN -1.0000 NaN NaN NaN NaN NaN + [37] NaN NaN 0.9800 NaN NaN 0.0001 NaN NaN NaN + [46] 0.1000 NaN NaN NaN NaN 0.6000 NaN NaN NaN + [55] NaN NaN NaN 0.1000 NaN NaN NaN 0.0000 0.8200 + [64] NaN NaN 0.0001 NaN NaN NaN NaN -0.2800 NaN + [73] NaN NaN NaN NaN NaN NaN NaN NaN NaN + [82] 0.1000 NaN NaN NaN 0.0000 0.8000 NaN NaN NaN + [91] -1.0000 NaN NaN NaN NaN NaN NaN NaN 0.9800 +[100] NaN NaN 0.0001 NaN NaN NaN 0.1000 NaN NaN +[109] NaN NaN 0.6000 NaN NaN NaN NaN NaN NaN +[118] 0.1000 NaN NaN +Warning message: +In qunif(c(-1, 0, 0.2, 2), c(-1, 0, 0.1, 0.9, 3), rep(c(-1, 0, 1, : + NaNs produced + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# +#set.seed(1); qunif(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] -1.0000000 0.0000000 NaN NaN NaN -1.0000000 + [7] NaN NaN 0.9632121 NaN NaN NaN + [13] NaN NaN NaN NaN NaN NaN + [19] NaN NaN 0.2642411 0.0000000 NaN NaN + [25] NaN -1.0000000 NaN NaN NaN NaN + [31] NaN NaN 0.6689085 NaN NaN NaN + [37] NaN NaN NaN NaN -0.4310915 0.0000000 + [43] NaN NaN NaN -1.0000000 NaN NaN + [49] NaN NaN NaN NaN NaN NaN + [55] NaN NaN 0.6321206 0.1000000 NaN NaN + [61] -1.0000000 0.0000000 NaN NaN NaN -1.0000000 + [67] NaN NaN 0.9632121 NaN NaN NaN + [73] NaN NaN NaN NaN NaN NaN + [79] NaN NaN 0.2642411 0.0000000 NaN NaN + [85] NaN -1.0000000 NaN NaN NaN NaN + [91] NaN NaN 0.6689085 NaN NaN NaN + [97] NaN NaN NaN NaN -0.4310915 0.0000000 +[103] NaN NaN NaN -1.0000000 NaN NaN +[109] NaN NaN NaN NaN NaN NaN +[115] NaN NaN 0.6321206 0.1000000 NaN NaN +Warning message: +In qunif(c(-1, 0, 0.2, 2), c(-1, 0, 0.1, 0.9, 3), rep(c(-1, 0, 1, : + NaNs produced + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# +#set.seed(1); qunif(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.00 0.28 NaN NaN -1.00 NaN NaN NaN NaN -0.82 NaN + [13] NaN NaN NaN NaN NaN NaN NaN NaN NaN 0.00 NaN NaN + [25] NaN -1.00 0.20 NaN NaN NaN -1.00 NaN NaN NaN NaN NaN + [37] NaN NaN 0.92 NaN NaN 0.00 NaN NaN NaN -1.00 NaN NaN + [49] NaN NaN -0.60 NaN NaN NaN NaN NaN NaN 0.10 NaN NaN + [61] NaN 0.00 0.28 NaN NaN -1.00 NaN NaN NaN NaN -0.82 NaN + [73] NaN NaN NaN NaN NaN NaN NaN NaN NaN 0.00 NaN NaN + [85] NaN -1.00 0.20 NaN NaN NaN -1.00 NaN NaN NaN NaN NaN + [97] NaN NaN 0.92 NaN NaN 0.00 NaN NaN NaN -1.00 NaN NaN +[109] NaN NaN -0.60 NaN NaN NaN NaN NaN NaN 0.10 NaN NaN +Warning message: +In qunif(c(-1, 0, 0.2, 2), c(-1, 0, 0.1, 0.9, 3), rep(c(-1, 0, 1, : + NaNs produced + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# +#set.seed(1); qunif(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] -1.0000000 0.0000000 NaN NaN NaN 0.0001000 + [7] NaN NaN 0.9367879 NaN NaN NaN + [13] NaN NaN NaN NaN NaN NaN + [19] NaN NaN -0.2642411 0.1000000 NaN NaN + [25] NaN 0.0000000 NaN NaN NaN NaN + [31] NaN NaN 0.4310915 NaN NaN NaN + [37] NaN NaN NaN NaN -0.6689085 0.0001000 + [43] NaN NaN NaN 0.1000000 NaN NaN + [49] NaN NaN NaN NaN NaN NaN + [55] NaN NaN 0.3678794 0.1000000 NaN NaN + [61] -1.0000000 0.0000000 NaN NaN NaN 0.0001000 + [67] NaN NaN 0.9367879 NaN NaN NaN + [73] NaN NaN NaN NaN NaN NaN + [79] NaN NaN -0.2642411 0.1000000 NaN NaN + [85] NaN 0.0000000 NaN NaN NaN NaN + [91] NaN NaN 0.4310915 NaN NaN NaN + [97] NaN NaN NaN NaN -0.6689085 0.0001000 +[103] NaN NaN NaN 0.1000000 NaN NaN +[109] NaN NaN NaN NaN NaN NaN +[115] NaN NaN 0.3678794 0.1000000 NaN NaN +Warning message: +In qunif(c(-1, 0, 0.2, 2), c(-1, 0, 0.1, 0.9, 3), rep(c(-1, 0, 1, : + NaNs produced + +##com.oracle.truffle.r.test.library.stats.TestStatFunctions.testFunctions32#Output.MayIgnoreWarningContext# +#set.seed(1); qunif(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.0 NaN NaN NaN NA 1.0 NaN NaN NaN NA 0.1 NaN NaN NaN +Warning message: +In qunif(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); qunif(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.00 NaN NaN NaN NA 1.00 NaN NaN NaN NA 0.01 NaN NaN NaN +Warning message: +In qunif(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); qunif(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 NaN NaN NaN NaN NA NaN NaN NaN NaN +Warning message: +In qunif(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.TestStats.testCor# #{ as.integer(cor(c(1,2,3),c(1,2,5))*10000000) } [1] 9607689 diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_zzfile.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_zzfile.java new file mode 100644 index 0000000000000000000000000000000000000000..b3db1793f86d90d0b93a8e558cda4078154e9e1b --- /dev/null +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_zzfile.java @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2016, 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.truffle.r.test.builtins; + +import org.junit.Test; + +import com.oracle.truffle.r.test.TestBase; + +public class TestBuiltin_zzfile extends TestBase { + private static final String[] CTYPES = new String[]{"g", "b", "x"}; + + @Test + public void test1() { + assertEval(TestBase.template("{ f <- tempfile(); c <- %0zfile(f); writeLines(as.character(1:100), c); close(c); readLines(f) }", CTYPES)); + } + + @Test + public void test2() { + assertEval(TestBase.template( + "{ f <- tempfile(); c <- %0zfile(f); writeLines(as.character(1:50), c); close(c); c <- %0zfile(f, \"a\"); writeLines(as.character(51:70), c); close(c); readLines(f) }", + CTYPES)); + } + +} diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestTestBase.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestTestBase.java index 235264d8223d504e607cfffac0f69e535ecf3017..be53842774b8ccb73b1a0cdf99dc7a8322c0a420 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestTestBase.java +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestTestBase.java @@ -55,7 +55,7 @@ public class TestTestBase extends TestBase { getCode("cat('Warning message: In .Internal(foo(42)): IgnoreWarningContext diff message')", "cat('Warning message in foo(42): IgnoreWarningContext should fail')")); } - private String getCode(String fastr, String gnur) { + private static String getCode(String fastr, String gnur) { return "if (exists('.fastr.identity')) { " + fastr + " } else { " + gnur + " }"; } } diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/library/base/TestConditionHandling.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/library/base/TestConditionHandling.java index 938ca47fe03c098ecc428a49f5514d0877a01ebd..2aff030fb231737e9ef235ccda7fe76c4f3a44f8 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/library/base/TestConditionHandling.java +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/library/base/TestConditionHandling.java @@ -32,8 +32,11 @@ public class TestConditionHandling extends TestBase { public void testTryCatch() { assertEval("{ tryCatch(1, finally = print(\"Hello\")) }"); assertEval("{ e <- simpleError(\"test error\"); tryCatch(stop(e), finally = print(\"Hello\")) }"); + assertEval("{ e <- simpleError(\"test error\"); f <- function() { tryCatch(1, finally = print(\"Hello\")); stop(e)}; f() }"); assertEval(Output.IgnoreErrorContext, "{ tryCatch(stop(\"fred\"), finally = print(\"Hello\")) }"); assertEval("{ e <- simpleError(\"test error\"); tryCatch(stop(e), error = function(e) e, finally = print(\"Hello\"))}"); assertEval(Ignored.Unknown, "{ tryCatch(stop(\"fred\"), error = function(e) e, finally = print(\"Hello\"))}"); + assertEval("{ f <- function() { tryCatch(1, error = function(e) print(\"Hello\")); stop(\"fred\")}; f() }"); + assertEval("{ f <- function() { tryCatch(stop(\"fred\"), error = function(e) print(\"Hello\"))}; f() }"); } } diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/library/fastr/TestInterop.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/library/fastr/TestInterop.java index 4633fbe6cea36712abcfa82e76de810cfd1160d8..2250149cb2075b762143b4d249ff3d3c5a5ddc6c 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/library/fastr/TestInterop.java +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/library/fastr/TestInterop.java @@ -47,6 +47,14 @@ public class TestInterop extends TestBase { assertEvalFastR(".fastr.interop.export('foo', new.env())", "invisible()"); } + @Test + public void testInteropEvalFile() { + assertEvalFastR("fileConn<-file(\"testScript.R\");writeLines(c(\"x<-c(1)\",\"cat(x)\"), fileConn);close(fileConn);.fastr.interop.evalFile(\"testScript.R\",\"application/x-r\")", + "x<-c(1);cat(x)"); + assertEvalFastR("fileConn<-file(\"testScript.R\");writeLines(c(\"x<-c(1)\",\"cat(x)\"), fileConn);close(fileConn);.fastr.interop.evalFile(\"testScript.R\")", "x<-c(1);cat(x)"); + assertEvalFastR("tryCatch(.fastr.interop.evalFile(\"/a/b.R\"), error = function(e) e$message)", "cat('[1] \"Error reading file: /a/b.R\"\\n')"); + } + /** * Used for testing interop functionality. */ diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/library/stats/TestExternal_qbeta.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/library/stats/TestExternal_qbeta.java new file mode 100644 index 0000000000000000000000000000000000000000..742c7170856fede28c45fb7a453b5594720982a1 --- /dev/null +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/library/stats/TestExternal_qbeta.java @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package com.oracle.truffle.r.test.library.stats; + +import static com.oracle.truffle.r.test.library.stats.TestStatFunctions.PROBABILITIES; + +import org.junit.Test; + +import com.oracle.truffle.r.test.TestBase; + +/** + * Additional tests on the top of {@link TestStatFunctions}. + */ +public class TestExternal_qbeta extends TestBase { + private static final String[] BOOL_VALUES = new String[]{"T", "F"}; + + @Test + public void testQBeta() { + // check if in qbeta_raw with comment "p==0, q==0, p = Inf, q = Inf <==> treat as one- or + // two-point mass" + assertEval(template("qbeta(0.7, 0, 1/0, lower.tail=%0, log.p=F)", BOOL_VALUES)); + assertEval(template("qbeta(log(0.7), 0, 1/0, lower.tail=%0, log.p=T)", BOOL_VALUES)); + assertEval(template("qbeta(0.7, 1/0, 0, lower.tail=%0, log.p=F)", BOOL_VALUES)); + assertEval(template("qbeta(log(0.7), 1/0, 0, lower.tail=%0, log.p=T)", BOOL_VALUES)); + assertEval(template("qbeta(%0, 0, 0, lower.tail=%1, log.p=F)", new String[]{"0.1", "0.5", "0.7"}, BOOL_VALUES)); + assertEval(template("qbeta(log(%0), 0, 0, lower.tail=%1, log.p=T)", new String[]{"0.1", "0.5", "0.7"}, BOOL_VALUES)); + // checks swap_tail = (p_ > 0.5) where for lower.tail = log.p = TRUE is p_ = exp(p) + // exp(0.1) = 1.10.... + assertEval(template("qbeta(log(%0), 0.1, 3, lower.tail=T, log.p=T)", PROBABILITIES)); + // exp(-1) = 0.36... + assertEval(Output.MayIgnoreWarningContext, template("qbeta(log(%0), -1, 3, lower.tail=T, log.p=T)", PROBABILITIES)); + } +} 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 d15b49dd4f2a0250212fd7abd5e035e24cb85ffc..c51783a3d07446236e11bddd69ca31c5544d4f74 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 @@ -30,7 +30,9 @@ import com.oracle.truffle.r.test.TestBase; * Common tests for functions implemented using {@code StatsFunctions} infrastructure. */ public class TestStatFunctions extends TestBase { - private static final String[] FUNCTION3_1_NAMES = {"dgamma", "dbeta", "dcauchy", "dlnorm"}; + public static final String[] PROBABILITIES = new String[]{"0", "42e-80", "0.1", "0.5", "0.7", "1-42e-80", "1"}; + + private static final String[] FUNCTION3_1_NAMES = {"dgamma", "dbeta", "dcauchy", "dlnorm", "dlogis", "dunif"}; private static final String[] FUNCTION3_1_PARAMS = { "10, 10, 10, log=TRUE", "3, 3, 3, log=FALSE", @@ -61,7 +63,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", "pexp", "qexp", "qgeom"}; + private static final String[] FUNCTION2_2_NAMES = {"pchisq", "pexp", "qexp", "qgeom", "pgeom", "qt", "pt", "qpois", "ppois", "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 +82,8 @@ 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 = {"pbeta", "pcauchy", "qcauchy", "qlnorm", "plnorm"}; + private static final String[] FUNCTION3_2_NAMES = {"pbeta", "pcauchy", "qcauchy", "qlnorm", "plnorm", "qbinom", "pnorm", "qnorm", "qlogis", "pf", "pbinom", "plogis", "punif", "qunif", "qbeta", + "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)", @@ -90,16 +93,17 @@ public class TestStatFunctions extends TestBase { @Test public void testFunctions32() { // first: the "normal params" with all the combinations of log.p and lower.tail - assertEval(Output.IgnoreWhitespace, template("set.seed(1); %0(%1, %2, %3)", + assertEval(Output.MayIgnoreWarningContext, template("set.seed(1); %0(%1, %2, %3)", FUNCTION3_2_NAMES, FUNCTION3_2_PARAMS, new String[]{"lower.tail=TRUE", "lower.tail=FALSE"}, new String[]{"log.p=TRUE", "log.p=FALSE"})); // the error cases (where log.p nor lower.tail should make no difference) // first parameter wrong - assertEval(Output.IgnoreWarningContext, + assertEval(Output.MayIgnoreWarningContext, template("set.seed(1); %0(%1)", FUNCTION3_2_NAMES, new String[]{"c(NA, 0, NaN, 1/0, -1/0), rep(c(1, 0, 0.1), 5), rep(c(1, 0, 0.1), 5)"})); // second parameter wrong - assertEval(Output.IgnoreWarningContext, + assertEval(Output.MayIgnoreWarningContext, template("set.seed(1); %0(%1)", FUNCTION3_2_NAMES, new String[]{"rep(c(1, 0, 0.1), 5), c(NA, 0, NaN, 1/0, -1/0), rep(c(1, 0, 0.1), 5)"})); // third parameter wrong - assertEval(Output.IgnoreWhitespace, template("set.seed(1); %0(%1)", FUNCTION3_2_NAMES, new String[]{"rep(c(1, 0, 0.1), 5), rep(c(1, 0, 0.1), 5), c(NA, 0, NaN, 1/0, -1/0)"})); + assertEval(Output.MayIgnoreWarningContext, + template("set.seed(1); %0(%1)", FUNCTION3_2_NAMES, new String[]{"rep(c(1, 0, 0.1), 5), rep(c(1, 0, 0.1), 5), c(NA, 0, NaN, 1/0, -1/0)"})); } } diff --git a/mx.fastr/copyrights/gnu_r_ihaka.copyright.star.regex b/mx.fastr/copyrights/gnu_r_ihaka.copyright.star.regex index f501f18d94af207fdf7bdb31d6ed504d3fe2713b..6d4963665815e19001d415014c005f60e8bfa49b 100644 --- a/mx.fastr/copyrights/gnu_r_ihaka.copyright.star.regex +++ b/mx.fastr/copyrights/gnu_r_ihaka.copyright.star.regex @@ -1 +1 @@ -/\*\n \* This material is distributed under the GNU General Public License\n \* Version 2. You may review the terms of this license at\n \* http://www.gnu.org/licenses/gpl-2.0.html\n \*\n \* Copyright \(C\) 1998 Ross Ihaka\n \* Copyright \(c\) (?:[1-2][09][0-9][0-9]--)?[1-2][09][0-9][0-9], The R Core Team\n \* Copyright \(c\) (?:[1-2][09][0-9][0-9]--)?[1-2][09][0-9][0-9], The R Foundation\n \* Copyright \(c\) (?:(20[0-9][0-9]), )?(20[0-9][0-9]), Oracle and/or its affiliates\n \*\n \* All rights reserved.\n \*/\n.* +/\*\n \* This material is distributed under the GNU General Public License\n \* Version 2. You may review the terms of this license at\n \* http://www.gnu.org/licenses/gpl-2.0.html\n \*\n \* Copyright \(C\) 1998 Ross Ihaka\n \* Copyright \(c\) (?:[1-2][09][0-9][0-9]--?)?[1-2][09][0-9][0-9], The R Core Team\n \* Copyright \(c\) (?:[1-2][09][0-9][0-9]--?)?[1-2][09][0-9][0-9], The R Foundation\n \* Copyright \(c\) (?:(20[0-9][0-9]), )?(20[0-9][0-9]), Oracle and/or its affiliates\n \*\n \* All rights reserved.\n \*/\n.* diff --git a/mx.fastr/copyrights/gnu_r_ihaka_core.copyright.star.regex b/mx.fastr/copyrights/gnu_r_ihaka_core.copyright.star.regex index f6aa3d2ffea7b64fd737bf54fc193fdb726a58e0..1bc53ecfd3018063d32ee5abccbcc45d2f7d5a89 100644 --- a/mx.fastr/copyrights/gnu_r_ihaka_core.copyright.star.regex +++ b/mx.fastr/copyrights/gnu_r_ihaka_core.copyright.star.regex @@ -1 +1 @@ -/\*\n \* This material is distributed under the GNU General Public License\n \* Version 2. You may review the terms of this license at\n \* http://www.gnu.org/licenses/gpl-2.0.html\n \*\n \* Copyright \(C\) 1998 Ross Ihaka\n \* Copyright \(c\) (?:[1-2][09][0-9][0-9]--)?[1-2][09][0-9][0-9], The R Core Team\n \* Copyright \(c\) (?:(20[0-9][0-9]), )?(20[0-9][0-9]), Oracle and/or its affiliates\n \*\n \* All rights reserved.\n \*/\n.* +/\*\n \* This material is distributed under the GNU General Public License\n \* Version 2. You may review the terms of this license at\n \* http://www.gnu.org/licenses/gpl-2.0.html\n \*\n \* Copyright \(C\) 1998 Ross Ihaka\n \* Copyright \(c\) (?:[1-2][09][0-9][0-9]--?)?[1-2][09][0-9][0-9], The R Core Team\n \* Copyright \(c\) (?:(20[0-9][0-9]), )?(20[0-9][0-9]), Oracle and/or its affiliates\n \*\n \* All rights reserved.\n \*/\n.* diff --git a/mx.fastr/copyrights/gnu_r_scan.copyright.star.regex b/mx.fastr/copyrights/gnu_r_scan.copyright.star.regex index b8d748ad4e6d7a169aac923745c54b9e21dc5801..a2b6bd808f74cf4378eede05500ff8c8420bbe94 100644 --- a/mx.fastr/copyrights/gnu_r_scan.copyright.star.regex +++ b/mx.fastr/copyrights/gnu_r_scan.copyright.star.regex @@ -1 +1 @@ -/\*\n \* This material is distributed under the GNU General Public License\n \* Version 2. You may review the terms of this license at\n \* http://www.gnu.org/licenses/gpl-2.0.html\n \*\n \* Copyright \(c\) 1995, 1996, Robert Gentleman and Ross Ihaka\n \* Copyright \(c\) 1998-2013, The R Core Team\n \* Copyright \(c\) (?:(20[0-9][0-9]), )?(20[0-9][0-9]), Oracle and/or its affiliates\n \*\n \* All rights reserved.\n \*/\n.* +/\*\n \* This material is distributed under the GNU General Public License\n \* Version 2. You may review the terms of this license at\n \* http://www.gnu.org/licenses/gpl-2.0.html\n \*\n \* Copyright \(c\) 1995, 1996, Robert Gentleman and Ross Ihaka\n \* Copyright \(c\) (?:[1-2][09][0-9][0-9]--?)?[1-2][09][0-9][0-9], The R Core Team\n \* Copyright \(c\) (?:(20[0-9][0-9]), )?(20[0-9][0-9]), Oracle and/or its affiliates\n \*\n \* All rights reserved.\n \*/\n.* diff --git a/mx.fastr/copyrights/overrides b/mx.fastr/copyrights/overrides index 0467373d319614885a7468b7ad3c4ddd3c190853..e97b3e340fd5e5195744be34e14dc31c229adc27 100644 --- a/mx.fastr/copyrights/overrides +++ b/mx.fastr/copyrights/overrides @@ -43,6 +43,8 @@ com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/DPQ.java,gnu com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/Rt.java,gnu_r_ihaka_core.copyright com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/GammaFunctions.java,gnu_r_qgamma.copyright com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/QHyper.java,gnu_r_ihaka_core.copyright +com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/Qt.java,gnu_r_ihaka.copyright +com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/Pt.java,gnu_r_scan.copyright com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/RHyper.java,gnu_r_ihaka.copyright com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/MathInit.java,gnu_r.core.copyright com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/Pbeta.java,gnu_r.core.copyright @@ -50,11 +52,16 @@ com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/LBeta.java,g com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/Pbinom.java,gnu_r_ihaka.copyright com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/Pf.java,gnu_r_ihaka_core.copyright com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/Pnorm.java,gnu_r_ihaka.copyright +com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/PPois.java,gnu_r_ihaka_core.copyright +com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/QPois.java,gnu_r_ihaka_core.copyright +com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/QBeta.java,gnu_r_scan.copyright +com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/Qf.java,gnu_r_ihaka.copyright com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/Qbinom.java,gnu_r_ihaka.copyright com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/Qnorm.java,gnu_r_ihaka.copyright com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/Random2.java,gnu_r.copyright com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/RPois.java,gnu_r_ihaka_core.copyright com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/Rbinom.java,gnu_r_ihaka.copyright +com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/Unif.java,gnu_r_ihaka_core.copyright com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/Rnorm.java,gnu_r.copyright com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/Chisq.java,gnu_r_ihaka_core.copyright com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/SplineFunctions.java,gnu_r_splines.copyright @@ -68,9 +75,8 @@ com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/SNorm.java,g com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/SExp.java,gnu_r_ihaka_core.copyright com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/RGamma.java,gnu_r_ihaka_core.copyright com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/RNbinomMu.java,gnu_r_ihaka_core.copyright -com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/RLogis.java,gnu_r_ihaka_core.copyright +com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/Logis.java,gnu_r_ihaka_core.copyright com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/Rf.java,gnu_r_ihaka_core.copyright -com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/RChisq.java,gnu_r_ihaka_core.copyright com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/Exp.java,gnu_r_ihaka_core.copyright com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/Geom.java,gnu_r_ihaka_core.copyright com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/Dt.java,gnu_r.core.copyright diff --git a/mx.fastr/suite.py b/mx.fastr/suite.py index a27f13a384330cec954bb79607a2f9ddc5825583..725759b14b7099b48061e32f878c82a1c1979123 100644 --- a/mx.fastr/suite.py +++ b/mx.fastr/suite.py @@ -142,7 +142,6 @@ suite = { "sourceDirs" : ["src"], "dependencies" : [ "com.oracle.truffle.r.library", - "XZ-1.5" ], "checkstyle" : "com.oracle.truffle.r.runtime", "javaCompliance" : "1.8", @@ -217,6 +216,7 @@ suite = { "dependencies" : [ "truffle:TRUFFLE_API", "truffle:TRUFFLE_DEBUG", + "XZ-1.5", ], "checkstyle" : "com.oracle.truffle.r.runtime", "javaCompliance" : "1.8", @@ -311,6 +311,7 @@ suite = { "ANTLR-3.5", "GNUR", "GNU_ICONV", + "XZ-1.5", ], "distDependencies" : [ "truffle:TRUFFLE_API",