diff --git a/COPYING b/LICENSE.md
similarity index 100%
rename from COPYING
rename to LICENSE.md
diff --git a/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/RRuntimeASTAccessImpl.java b/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/RRuntimeASTAccessImpl.java
index 2a3078a825b3a324ae7c8204312aaed1bb3f1139..211b6656f54b23b9a40d72e90dd73cf01cbec6b4 100644
--- a/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/RRuntimeASTAccessImpl.java
+++ b/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/RRuntimeASTAccessImpl.java
@@ -22,12 +22,17 @@
  */
 package com.oracle.truffle.r.engine;
 
+import java.util.List;
+import java.util.LinkedList;
+
 import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
+import com.oracle.truffle.api.RootCallTarget;
 import com.oracle.truffle.api.frame.Frame;
 import com.oracle.truffle.api.frame.FrameInstance.FrameAccess;
 import com.oracle.truffle.api.nodes.Node;
 import com.oracle.truffle.api.nodes.RootNode;
 import com.oracle.truffle.api.source.SourceSection;
+import com.oracle.truffle.r.nodes.RASTBuilder;
 import com.oracle.truffle.r.nodes.RASTUtils;
 import com.oracle.truffle.r.nodes.RRootNode;
 import com.oracle.truffle.r.nodes.access.ConstantNode;
@@ -38,6 +43,7 @@ import com.oracle.truffle.r.nodes.builtin.RBuiltinRootNode;
 import com.oracle.truffle.r.nodes.control.IfNode;
 import com.oracle.truffle.r.nodes.control.ReplacementNode;
 import com.oracle.truffle.r.nodes.function.FunctionDefinitionNode;
+import com.oracle.truffle.r.nodes.function.FunctionExpressionNode;
 import com.oracle.truffle.r.nodes.function.GroupDispatchNode;
 import com.oracle.truffle.r.nodes.function.PromiseHelperNode;
 import com.oracle.truffle.r.nodes.function.RCallNode;
@@ -56,11 +62,13 @@ import com.oracle.truffle.r.runtime.ReturnException;
 import com.oracle.truffle.r.runtime.Utils;
 import com.oracle.truffle.r.runtime.context.Engine;
 import com.oracle.truffle.r.runtime.context.RContext;
+import com.oracle.truffle.r.runtime.data.RArgsValuesAndNames;
 import com.oracle.truffle.r.runtime.data.RDataFactory;
 import com.oracle.truffle.r.runtime.data.RFunction;
 import com.oracle.truffle.r.runtime.data.RLanguage;
 import com.oracle.truffle.r.runtime.data.RList;
 import com.oracle.truffle.r.runtime.data.RNull;
+import com.oracle.truffle.r.runtime.data.RPairList;
 import com.oracle.truffle.r.runtime.data.RPromise;
 import com.oracle.truffle.r.runtime.data.RStringVector;
 import com.oracle.truffle.r.runtime.data.RSymbol;
@@ -69,6 +77,7 @@ import com.oracle.truffle.r.runtime.data.model.RAbstractContainer;
 import com.oracle.truffle.r.runtime.env.REnvironment;
 import com.oracle.truffle.r.runtime.gnur.SEXPTYPE;
 import com.oracle.truffle.r.runtime.nodes.RBaseNode;
+import com.oracle.truffle.r.runtime.nodes.RCodeBuilder;
 import com.oracle.truffle.r.runtime.nodes.RNode;
 import com.oracle.truffle.r.runtime.nodes.RSyntaxCall;
 import com.oracle.truffle.r.runtime.nodes.RSyntaxConstant;
@@ -76,6 +85,8 @@ import com.oracle.truffle.r.runtime.nodes.RSyntaxElement;
 import com.oracle.truffle.r.runtime.nodes.RSyntaxFunction;
 import com.oracle.truffle.r.runtime.nodes.RSyntaxLookup;
 import com.oracle.truffle.r.runtime.nodes.RSyntaxNode;
+import com.oracle.truffle.r.runtime.nodes.RCodeBuilder.Argument;
+import com.sun.org.apache.bcel.internal.generic.NEW;
 
 /**
  * Implementation of {@link RRuntimeASTAccess}.
@@ -124,6 +135,20 @@ public class RRuntimeASTAccessImpl implements RRuntimeASTAccess {
 
     }
 
+    @TruffleBoundary
+    @Override
+    public RLanguage.RepType getRepType(RLanguage rl) {
+        RSyntaxElement s = RASTUtils.unwrap(rl.getRep()).asRSyntaxNode();
+
+        if (s instanceof RSyntaxCall) {
+            return RLanguage.RepType.CALL;
+        } else if (s instanceof RSyntaxFunction) {
+            return RLanguage.RepType.FUNCTION;
+        } else {
+            throw RInternalError.shouldNotReachHere("unexpected type: " + s.getClass());
+        }
+    }
+
     @TruffleBoundary
     @Override
     public int getLength(RLanguage rl) {
@@ -169,7 +194,7 @@ public class RRuntimeASTAccessImpl implements RRuntimeASTAccess {
 
                     Object list = RNull.instance;
                     for (int i = sig.getLength() - 1; i >= 0; i--) {
-                        list = RDataFactory.createPairList(defaults[i] == null ? RDataFactory.createSymbolInterned("") : getIntrinsicValue(defaults[i]), list,
+                        list = RDataFactory.createPairList(defaults[i] == null ? RSymbol.MISSING : getIntrinsicValue(defaults[i]), list,
                                         RDataFactory.createSymbolInterned(sig.getName(i)));
                     }
                     return list;
@@ -177,7 +202,9 @@ public class RRuntimeASTAccessImpl implements RRuntimeASTAccess {
                     result = ((RSyntaxFunction) s).getSyntaxBody();
                     break;
                 case 3:
-                    throw RInternalError.unimplemented("srcref of 'function'");
+                    // TODO: handle srcref properly - for now, clearly mark an erroneous access to
+                    // this piece of data
+                    return new RArgsValuesAndNames(new String[]{"DUMMY UNIMPLEMENTED SRCREF"}, ArgumentsSignature.get("dummy"));
                 default:
                     throw RInternalError.shouldNotReachHere();
             }
@@ -197,11 +224,11 @@ public class RRuntimeASTAccessImpl implements RRuntimeASTAccess {
     }
 
     @TruffleBoundary
-    public Object fromList(RList list) {
+    public Object fromList(RList list, RLanguage.RepType repType) {
         int length = list.getLength();
         if (length == 0) {
             return RNull.instance;
-        } else {
+        } else if (repType == RLanguage.RepType.CALL) {
             RStringVector formals = list.getNames();
             boolean nullFormals = formals == null;
             RNode fn = unwrapToRNode(list.getDataAtAsObject(0));
@@ -217,6 +244,23 @@ public class RRuntimeASTAccessImpl implements RRuntimeASTAccess {
             }
             RLanguage result = RDataFactory.createLanguage(RASTUtils.createCall(fn, false, ArgumentsSignature.get(sigNames), arguments).asRNode());
             return result;
+        } else if (repType == RLanguage.RepType.FUNCTION) {
+            RList argsList = (RList) list.getDataAt(1);
+            RSyntaxNode body = (RSyntaxNode) unwrapToRNode(list.getDataAt(2));
+            List<Argument<RSyntaxNode>> resArgs = new LinkedList<>();
+            RStringVector argsNames = argsList.getNames();
+            for (int i = 0; i < argsList.getLength(); i++) {
+                String argName = argsNames == null ? null : argsNames.getDataAt(i);
+                Object argVal = argsList.getDataAt(i);
+                Argument<RSyntaxNode> arg = RCodeBuilder.argument(RSyntaxNode.LAZY_DEPARSE, argName, argVal == RSymbol.MISSING ? null : (RSyntaxNode) unwrapToRNode(argVal));
+                resArgs.add(arg);
+            }
+            RootCallTarget rootCallTarget = new RASTBuilder().rootFunction(RSyntaxNode.LAZY_DEPARSE, resArgs, body, null);
+            FunctionExpressionNode fnExprNode = FunctionExpressionNode.create(RSyntaxNode.LAZY_DEPARSE, rootCallTarget);
+            RLanguage result = RDataFactory.createLanguage(fnExprNode);
+            return result;
+        } else {
+            throw RInternalError.shouldNotReachHere("unexpected type");
         }
     }
 
diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/AsFunction.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/AsFunction.java
index 6395f510f44b72af9723d2eb6a2a183025cc8604..592446c2355f3380eb738d6b7ae850b99e1ba3a8 100644
--- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/AsFunction.java
+++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/AsFunction.java
@@ -118,10 +118,15 @@ public abstract class AsFunction extends RBuiltinNode {
             }
         }
 
-        if (!(x.getDataAt(x.getLength() - 1) instanceof RLanguage)) {
+        RBaseNode body;
+        Object bodyObject = x.getDataAt(x.getLength() - 1);
+        if (bodyObject instanceof RLanguage) {
+            body = ((RLanguage) x.getDataAt(x.getLength() - 1)).getRep();
+        } else if (bodyObject instanceof RSymbol) {
+            body = ReadVariableNode.create(((RSymbol) bodyObject).getName());
+        } else {
             throw RInternalError.unimplemented();
         }
-        RBaseNode body = ((RLanguage) x.getDataAt(x.getLength() - 1)).getRep();
         if (!RBaseNode.isRSyntaxNode(body)) {
             throw RInternalError.unimplemented();
         }
diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Order.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Order.java
index b95bd9b54dd20fd94a6d05a739648ca0fa36c770..68774037e4df46e5a04d5dedeee45dcffefadaed 100644
--- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Order.java
+++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Order.java
@@ -17,6 +17,7 @@ import static com.oracle.truffle.r.runtime.RBuiltinKind.*;
 import java.text.Collator;
 
 import com.oracle.truffle.api.*;
+import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
 import com.oracle.truffle.api.dsl.*;
 import com.oracle.truffle.api.profiles.*;
 import com.oracle.truffle.r.nodes.builtin.*;
@@ -45,7 +46,7 @@ public abstract class Order extends RPrecedenceBuiltinNode {
 
     private OrderVector1Node initOrderVector1() {
         if (orderVector1Node == null) {
-            orderVector1Node = insert(OrderVector1NodeGen.create(null, null, null, null, null));
+            orderVector1Node = insert(OrderVector1NodeGen.create());
         }
         return orderVector1Node;
     }
@@ -74,7 +75,7 @@ public abstract class Order extends RPrecedenceBuiltinNode {
     private int cmp(Object v, int i, int j, boolean naLast) {
         if (cmpNode == null) {
             CompilerDirectives.transferToInterpreterAndInvalidate();
-            cmpNode = insert(CmpNodeGen.create(null, null, null, null));
+            cmpNode = insert(CmpNodeGen.create());
         }
         return cmpNode.executeInt(v, i, j, naLast);
     }
@@ -263,8 +264,7 @@ public abstract class Order extends RPrecedenceBuiltinNode {
      * Also used by {@link Rank}, where the "rho" parameter is not null. TODO handle S4 objects
      * (which involves rho)
      */
-    @NodeChildren({@NodeChild("indx"), @NodeChild("dv"), @NodeChild("naLast"), @NodeChild("decreasing"), @NodeChild("rho")})
-    abstract static class OrderVector1Node extends RNode {
+    abstract static class OrderVector1Node extends RBaseNode {
         private final ConditionProfile decProfile = ConditionProfile.createBinaryProfile();
 
         public abstract Object execute(Object v, Object dv, boolean naLast, boolean dec, Object rho);
@@ -489,7 +489,7 @@ public abstract class Order extends RPrecedenceBuiltinNode {
         }
 
         private void sort(int[] indx, RAbstractStringVector dv, int lo, int hi, boolean dec) {
-            Collator collator = Collator.getInstance();
+            Collator collator = createCollator();
             int t = 0;
             for (; SINCS[t] > hi - lo + 1; t++) {
             }
@@ -500,7 +500,7 @@ public abstract class Order extends RPrecedenceBuiltinNode {
                     while (j >= lo + h) {
                         int a = indx[j - h];
                         int b = itmp;
-                        int c = collator.compare(dv.getDataAt(a), dv.getDataAt(b));
+                        int c = compare(collator, dv.getDataAt(a), dv.getDataAt(b));
                         if (decProfile.profile(dec)) {
                             if (!(c < 0 || (c == 0 && a > b))) {
                                 break;
@@ -518,6 +518,16 @@ public abstract class Order extends RPrecedenceBuiltinNode {
             }
         }
 
+        @TruffleBoundary
+        private static int compare(Collator collator, String dataAt, String dataAt2) {
+            return collator.compare(dataAt, dataAt2);
+        }
+
+        @TruffleBoundary
+        private static Collator createCollator() {
+            return Collator.getInstance();
+        }
+
         private static boolean lt(RComplex a, RComplex b) {
             if (a.getRealPart() == b.getRealPart()) {
                 return a.getImaginaryPart() < b.getImaginaryPart();
@@ -626,8 +636,7 @@ public abstract class Order extends RPrecedenceBuiltinNode {
     /**
      * Also used by {@link Rank}. *
      */
-    @NodeChildren({@NodeChild("v"), @NodeChild("i"), @NodeChild("j"), @NodeChild("naLast")})
-    abstract static class CmpNode extends RNode {
+    abstract static class CmpNode extends RBaseNode {
 
         public abstract int executeInt(Object v, int i, int j, boolean naLast);
 
diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Rank.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Rank.java
index c6e1b11122c94acb9c72d6bd457e8f6c4e8fe7f9..6c9eacf3397b19f8c3c51268090917417dd5c5b8 100644
--- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Rank.java
+++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Rank.java
@@ -50,14 +50,14 @@ public abstract class Rank extends RBuiltinNode {
 
     Order.OrderVector1Node initOrderVector1() {
         if (orderVector1Node == null) {
-            orderVector1Node = insert(OrderVector1NodeGen.create(null, null, null, null, null));
+            orderVector1Node = insert(OrderVector1NodeGen.create());
         }
         return orderVector1Node;
     }
 
     Order.CmpNode initOrderCmp() {
         if (orderCmpNode == null) {
-            orderCmpNode = insert(CmpNodeGen.create(null, null, null, null));
+            orderCmpNode = insert(CmpNodeGen.create());
         }
         return orderCmpNode;
     }
diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Round.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Round.java
index 682d0e543294e729254d9afaf6a2b52d50577e4e..e38856072c9f08eb982bc9a9c9fe8415a7f366c4 100644
--- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Round.java
+++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Round.java
@@ -123,14 +123,14 @@ public abstract class Round extends RBuiltinNode {
     protected RComplex round(RComplex x, @SuppressWarnings("unused") int digits) {
         controlVisibility();
         check.enable(x);
-        return check.check(x) ? RComplex.NA : roundOp.op(x.getRealPart(), x.getImaginaryPart());
+        return check.check(x) ? RComplex.createNA() : roundOp.op(x.getRealPart(), x.getImaginaryPart());
     }
 
     @Specialization(guards = "digits != 0")
     protected RComplex roundDigits(RComplex x, int digits) {
         controlVisibility();
         check.enable(x);
-        return check.check(x) ? RComplex.NA : roundOp.opd(x.getRealPart(), x.getImaginaryPart(), digits);
+        return check.check(x) ? RComplex.createNA() : roundOp.opd(x.getRealPart(), x.getImaginaryPart(), digits);
     }
 
     @Specialization(guards = "digits == 0")
@@ -140,7 +140,7 @@ public abstract class Round extends RBuiltinNode {
         check.enable(x);
         for (int i = 0; i < x.getLength(); i++) {
             RComplex z = x.getDataAt(i);
-            RComplex r = check.check(z) ? RComplex.NA : round(z, digits);
+            RComplex r = check.check(z) ? RComplex.createNA() : round(z, digits);
             result[2 * i] = r.getRealPart();
             result[2 * i + 1] = r.getImaginaryPart();
             check.check(r);
@@ -157,7 +157,7 @@ public abstract class Round extends RBuiltinNode {
         check.enable(x);
         for (int i = 0; i < x.getLength(); i++) {
             RComplex z = x.getDataAt(i);
-            RComplex r = check.check(z) ? RComplex.NA : roundDigits(z, digits);
+            RComplex r = check.check(z) ? RComplex.createNA() : roundDigits(z, digits);
             result[2 * i] = r.getRealPart();
             result[2 * i + 1] = r.getImaginaryPart();
             check.check(r);
diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/TrigExpFunctions.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/TrigExpFunctions.java
index ef95649a0f0c42475aa4b66deedc23e9859a6b43..9ef494d3bbe0216f9fa259ee8b3b24c1c653cf35 100644
--- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/TrigExpFunctions.java
+++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/TrigExpFunctions.java
@@ -263,7 +263,7 @@ public class TrigExpFunctions {
 
     }
 
-    @RBuiltin(name = "sin", kind = RBuiltinKind.PRIMITIVE, parameterNames = {"x"})
+    @com.oracle.truffle.r.runtime.RBuiltin(name = "sin", kind = RBuiltinKind.PRIMITIVE, parameterNames = {"x"})
     public abstract static class Sin extends TrigExpFunctionNode {
 
         @Child private UnaryArithmeticNode sinNode = UnaryArithmeticNodeGen.create(SinArithmetic::new, RType.Double,
@@ -385,7 +385,7 @@ public class TrigExpFunctions {
         }
     }
 
-    @RBuiltin(name = "cos", kind = RBuiltinKind.PRIMITIVE, parameterNames = {"x"})
+    @com.oracle.truffle.r.runtime.RBuiltin(name = "cos", kind = RBuiltinKind.PRIMITIVE, parameterNames = {"x"})
     public abstract static class Cos extends TrigExpFunctionNode {
 
         @Child private UnaryArithmeticNode cosNode = UnaryArithmeticNodeGen.create(CosArithmetic::new, RType.Double,
@@ -508,7 +508,7 @@ public class TrigExpFunctions {
 
     }
 
-    @RBuiltin(name = "tan", kind = RBuiltinKind.PRIMITIVE, parameterNames = {"x"})
+    @com.oracle.truffle.r.runtime.RBuiltin(name = "tan", kind = RBuiltinKind.PRIMITIVE, parameterNames = {"x"})
     public abstract static class Tan extends TrigExpFunctionNode {
 
         @Child private UnaryArithmeticNode tanNode = UnaryArithmeticNodeGen.create(TanArithmetic::new, RType.Double,
diff --git a/com.oracle.truffle.r.nodes.test/src/com/oracle/truffle/r/nodes/test/BinaryVectorTest.java b/com.oracle.truffle.r.nodes.test/src/com/oracle/truffle/r/nodes/test/BinaryVectorTest.java
index 046cebd755350c7d7a0671ad003fe208f7f655b4..29e3c2774947388f12b135f874a4d0f8549872a8 100644
--- a/com.oracle.truffle.r.nodes.test/src/com/oracle/truffle/r/nodes/test/BinaryVectorTest.java
+++ b/com.oracle.truffle.r.nodes.test/src/com/oracle/truffle/r/nodes/test/BinaryVectorTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -52,8 +52,8 @@ public class BinaryVectorTest extends TestBase {
     @DataPoint public static final RAbstractVector FOUR_COMPLEX = createComplexVector(new double[]{1, 1, 2, 2, 3, 3, 4, 4}, true);
 
     @DataPoint public static final RAbstractVector NOT_COMPLETE_LOGICAL = createLogicalVector(new byte[]{1, 0, RRuntime.LOGICAL_NA, 1}, false);
-    @DataPoint public static final RAbstractVector NOT_COMPLETE_INT = createIntVector(new int[]{1, 2, RInteger.NA.getValue(), 4}, false);
-    @DataPoint public static final RAbstractVector NOT_COMPLETE_DOUBLE = createDoubleVector(new double[]{1, 2, RDouble.NA.getValue(), 4}, false);
+    @DataPoint public static final RAbstractVector NOT_COMPLETE_INT = createIntVector(new int[]{1, 2, RRuntime.INT_NA, 4}, false);
+    @DataPoint public static final RAbstractVector NOT_COMPLETE_DOUBLE = createDoubleVector(new double[]{1, 2, RRuntime.DOUBLE_NA, 4}, false);
     @DataPoint public static final RAbstractVector NOT_COMPLETE_COMPLEX = createComplexVector(new double[]{1.0d, 0.0d, RRuntime.COMPLEX_NA_REAL_PART, RRuntime.COMPLEX_NA_IMAGINARY_PART}, false);
 
     @DataPoint public static final RAbstractVector ONE = createIntVector(new int[]{1}, true);
diff --git a/com.oracle.truffle.r.nodes.test/src/com/oracle/truffle/r/nodes/test/TestUtilities.java b/com.oracle.truffle.r.nodes.test/src/com/oracle/truffle/r/nodes/test/TestUtilities.java
index e58d0c3e7397f52aa271f0477550429d4074dc68..27a386a2930d7529f37e2864601874766ceae5eb 100644
--- a/com.oracle.truffle.r.nodes.test/src/com/oracle/truffle/r/nodes/test/TestUtilities.java
+++ b/com.oracle.truffle.r.nodes.test/src/com/oracle/truffle/r/nodes/test/TestUtilities.java
@@ -112,8 +112,8 @@ public class TestUtilities {
         double[] array = new double[size << 1];
         for (int i = 0; i < size; i++) {
             boolean useNA = !complete && i % (NA_INDEX + 1) == NA_INDEX;
-            array[i << 1 - 1] = useNA ? RComplex.NA.getRealPart() : i;
-            array[i << 1] = useNA ? RComplex.NA.getRealPart() : i;
+            array[i << 1 - 1] = useNA ? RComplex.createNA().getRealPart() : i;
+            array[i << 1] = useNA ? RComplex.createNA().getRealPart() : i;
         }
         return RDataFactory.createComplexVector(array, complete || !complete && size < NA_INDEX);
     }
diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/vector/CachedExtractVectorNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/vector/CachedExtractVectorNode.java
index 3eb76bacf3cbadba96a991ee92dfc1b779a26571..01578ca7bdf62ec947fcd04bcdb3061bac602c92 100644
--- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/vector/CachedExtractVectorNode.java
+++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/vector/CachedExtractVectorNode.java
@@ -241,7 +241,7 @@ final class CachedExtractVectorNode extends CachedVectorNode {
 
     @TruffleBoundary
     private static Object materializeLanguage(RAbstractVector extractedVector) {
-        return RContext.getRRuntimeASTAccess().fromList((RList) extractedVector);
+        return RContext.getRRuntimeASTAccess().fromList((RList) extractedVector, RLanguage.RepType.CALL);
     }
 
     private Object extract(int dimensionIndex, RAbstractStringVector vector, Object pos, PositionProfile profile) {
diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/vector/CachedReplaceVectorNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/vector/CachedReplaceVectorNode.java
index 76de77faaab09c7b3e66c2edec3fea6de04b6f73..5a032028da1a75a9ce2b67b76ff0663270a618bf 100644
--- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/vector/CachedReplaceVectorNode.java
+++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/vector/CachedReplaceVectorNode.java
@@ -55,6 +55,7 @@ final class CachedReplaceVectorNode extends CachedVectorNode {
     private final RAttributeProfiles vectorNamesProfile = RAttributeProfiles.create();
     private final RAttributeProfiles positionNamesProfile = RAttributeProfiles.create();
     private final ConditionProfile rightIsShared = ConditionProfile.createBinaryProfile();
+    private final ConditionProfile valueIsNA = ConditionProfile.createBinaryProfile();
     private final BranchProfile rightIsNonTemp = BranchProfile.create();
     private final BranchProfile rightIsTemp = BranchProfile.create();
     private final BranchProfile resizeProfile = BranchProfile.create();
@@ -160,6 +161,7 @@ final class CachedReplaceVectorNode extends CachedVectorNode {
          * rid of them as much as possible in the future.
          */
         RAbstractVector vector;
+        RLanguage.RepType repType = RLanguage.RepType.UNKNOWN;
         switch (vectorType) {
             case Null:
                 vector = castType.getEmpty();
@@ -173,6 +175,7 @@ final class CachedReplaceVectorNode extends CachedVectorNode {
             case Environment:
                 return doEnvironment((REnvironment) castVector, positions, castValue);
             case Language:
+                repType = RContext.getRRuntimeASTAccess().getRepType((RLanguage) castVector);
                 vector = RContext.getRRuntimeASTAccess().asList((RLanguage) castVector);
                 break;
             case Expression:
@@ -214,7 +217,7 @@ final class CachedReplaceVectorNode extends CachedVectorNode {
                 value = copyValueOnAssignment(value);
             }
         } else if (value instanceof RAbstractVector) {
-            value = ((RAbstractVector) value).castSafe(castType);
+            value = ((RAbstractVector) value).castSafe(castType, valueIsNA);
         }
 
         vector = share(vector);
@@ -285,7 +288,7 @@ final class CachedReplaceVectorNode extends CachedVectorNode {
 
         switch (vectorType) {
             case Language:
-                return RContext.getRRuntimeASTAccess().fromList((RList) vector);
+                return RContext.getRRuntimeASTAccess().fromList((RList) vector, repType);
             default:
                 return vector;
         }
diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/ClassHierarchyNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/ClassHierarchyNode.java
index 0b836f3b20bb4957a73c846c89a60b69382932a3..e5c6129b9cb86b09e40375747d6379de40920a74 100644
--- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/ClassHierarchyNode.java
+++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/ClassHierarchyNode.java
@@ -108,21 +108,19 @@ public abstract class ClassHierarchyNode extends UnaryNode {
     }
 
     @Specialization
-    protected RStringVector getClassHrStorage(RAttributeStorage arg, //
-                    @Cached("createClassProfile()") ValueProfile argProfile) {
-        return getClassHrAttributableInternal(arg, argProfile);
-    }
-
-    @Specialization(contains = "getClassHrStorage")
     protected RStringVector getClassHrAttributable(RAttributable arg, //
+                    @Cached("createBinaryProfile()") ConditionProfile attrStoraeProfile, //
                     @Cached("createClassProfile()") ValueProfile argProfile) {
-        return getClassHrAttributableInternal(arg, argProfile);
-    }
 
-    protected RStringVector getClassHrAttributableInternal(RAttributable arg, //
-                    @Cached("createClassProfile()") ValueProfile argProfile) {
-        RAttributable profiledArg = argProfile.profile(arg);
-        RAttributes attributes = profiledArg.getAttributes();
+        RAttributes attributes;
+        RAttributable profiledArg;
+        if (attrStoraeProfile.profile(arg instanceof RAttributeStorage)) {
+            attributes = ((RAttributeStorage) arg).getAttributes();
+            profiledArg = arg;
+        } else {
+            profiledArg = argProfile.profile(arg);
+            attributes = profiledArg.getAttributes();
+        }
         if (noAttributesProfile.profile(attributes != null)) {
             if (access == null) {
                 CompilerDirectives.transferToInterpreterAndInvalidate();
@@ -130,7 +128,7 @@ public abstract class ClassHierarchyNode extends UnaryNode {
             }
             RStringVector classHierarchy = (RStringVector) access.execute(attributes);
             if (nullAttributeProfile.profile(classHierarchy != null)) {
-                if (profiledArg.isS4() && isS4Profile.profile(withS4 && classHierarchy.getLength() > 0)) {
+                if (withS4 && arg.isS4() && isS4Profile.profile(classHierarchy.getLength() > 0)) {
                     if (s4Class == null) {
                         CompilerDirectives.transferToInterpreterAndInvalidate();
                         s4Class = insert(S4ClassNodeGen.create());
@@ -140,7 +138,7 @@ public abstract class ClassHierarchyNode extends UnaryNode {
                 return classHierarchy;
             }
         }
-        return withImplicitTypes ? profiledArg.getImplicitClass() : null;
+        return withImplicitTypes ? arg.getImplicitClass() : null;
     }
 
     protected static boolean isRTypedValue(Object obj) {
diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/primitive/BinaryMapNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/primitive/BinaryMapNode.java
index 686b5fc11a2d04a462348dbec7ad7745c0ec25da..856263a563ec5d4565fe9f22958bffb91339fde5 100644
--- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/primitive/BinaryMapNode.java
+++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/primitive/BinaryMapNode.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -52,6 +52,8 @@ public final class BinaryMapNode extends RBaseNode {
     private final VectorLengthProfile rightLengthProfile = VectorLengthProfile.create();
     private final ConditionProfile dimensionsProfile;
     private final ConditionProfile maxLengthProfile;
+    private final ConditionProfile leftIsNAProfile = ConditionProfile.createBinaryProfile();
+    private final ConditionProfile rightIsNAProfile = ConditionProfile.createBinaryProfile();
     private final BranchProfile seenEmpty = BranchProfile.create();
     private final ConditionProfile shareLeft;
     private final ConditionProfile shareRight;
@@ -102,8 +104,8 @@ public final class BinaryMapNode extends RBaseNode {
         RAbstractVector left = leftClass.cast(originalLeft);
         RAbstractVector right = rightClass.cast(originalRight);
 
-        RAbstractVector leftCast = left.castSafe(argumentType);
-        RAbstractVector rightCast = right.castSafe(argumentType);
+        RAbstractVector leftCast = left.castSafe(argumentType, leftIsNAProfile);
+        RAbstractVector rightCast = right.castSafe(argumentType, rightIsNAProfile);
 
         assert leftCast != null;
         assert rightCast != null;
diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/primitive/UnaryMapNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/primitive/UnaryMapNode.java
index 993e69cfdbece040dc34ae89aa7d219f04fe2b99..1a1fb36782f43b5428c78eb3d054c4b40a4895b7 100644
--- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/primitive/UnaryMapNode.java
+++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/primitive/UnaryMapNode.java
@@ -40,6 +40,7 @@ public final class UnaryMapNode extends RBaseNode {
     // profiles
     private final Class<? extends RAbstractVector> operandClass;
     private final VectorLengthProfile operandLengthProfile = VectorLengthProfile.create();
+    private final ConditionProfile operandIsNAProfile = ConditionProfile.createBinaryProfile();
     private final BranchProfile hasAttributesProfile;
     private final RAttributeProfiles attrProfiles;
     private final ConditionProfile shareOperand;
@@ -90,7 +91,7 @@ public final class UnaryMapNode extends RBaseNode {
         assert isSupported(originalOperand);
         RAbstractVector operand = operandClass.cast(originalOperand);
 
-        RAbstractVector operandCast = operand.castSafe(getArgumentType());
+        RAbstractVector operandCast = operand.castSafe(getArgumentType(), operandIsNAProfile);
 
         scalarNode.enable(operandCast);
         if (scalarType) {
diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/CastComplexNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/CastComplexNode.java
index 9b5f31e8fb811959f8a5ad57349c9c3f6de81bfa..84c984307297872a0e6e5a713ae8f7c218f40148 100644
--- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/CastComplexNode.java
+++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/CastComplexNode.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -84,7 +84,7 @@ public abstract class CastComplexNode extends CastBaseNode {
                     @Cached("createBinaryProfile()") ConditionProfile emptyStringProfile) {
         naCheck.enable(operand);
         if (naCheck.check(operand) || emptyStringProfile.profile(operand.isEmpty())) {
-            return RComplex.NA;
+            return RComplex.createNA();
         }
         RComplex result = RRuntime.string2complexNoCheck(operand);
         if (RRuntime.isNA(result)) {
@@ -139,7 +139,7 @@ public abstract class CastComplexNode extends CastBaseNode {
             String value = operand.getDataAt(i);
             RComplex complexValue;
             if (naCheck.check(value) || emptyStringProfile.profile(value.isEmpty())) {
-                complexValue = RComplex.NA;
+                complexValue = RComplex.createNA();
                 seenNA = true;
             } else {
                 complexValue = RRuntime.string2complexNoCheck(value);
diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/ScalarUnaryArithmeticNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/ScalarUnaryArithmeticNode.java
index fca7b9393c0c36b948f660e5c5db374303711d2c..55e2cef61864b4ccbe04f82f42234cee9c52a587 100644
--- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/ScalarUnaryArithmeticNode.java
+++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/ScalarUnaryArithmeticNode.java
@@ -85,7 +85,7 @@ public class ScalarUnaryArithmeticNode extends UnaryMapNAFunctionNode {
     @Override
     public final RComplex applyComplex(RComplex operand) {
         if (operandNACheck.check(operand)) {
-            return RComplex.NA;
+            return RComplex.createNA();
         }
         return arithmetic.op(operand.getRealPart(), operand.getImaginaryPart());
     }
diff --git a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ParserGeneration.java b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ParserGeneration.java
index d5bf7d0562895eecbbcfe43e7627abefe830bf6c..292736e4ec1b0d219c5e7969ac1bcf9f5b84297a 100644
--- a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ParserGeneration.java
+++ b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ParserGeneration.java
@@ -78,6 +78,7 @@ public class ParserGeneration {
         "maintain proper operator source sections",
         "remove special handling for formulas",
         "remove source section identifiers",
-        "transform parser to a generic class via the annotation processor"
+        "transform parser to a generic class via the annotation processor",
+        "use RComplex.createNA()"
     };
 }
diff --git a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/R.g b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/R.g
index 4b6691d8728a0c4225a1148105d052a9b5bf32d5..e6b9173471c52c805e718ee7d7e1ed7bc5c9a7cf 100644
--- a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/R.g
+++ b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/R.g
@@ -368,7 +368,7 @@ simple_expr returns [T v]
     | t=NAINT                                   { $v = builder.constant(src($t), RRuntime.INT_NA); }
     | t=NAREAL                                  { $v = builder.constant(src($t), RRuntime.DOUBLE_NA); }
     | t=NACHAR                                  { $v = builder.constant(src($t), RRuntime.STRING_NA); }
-    | t=NACOMPL                                 { $v = builder.constant(src($t), RComplex.NA); }
+    | t=NACOMPL                                 { $v = builder.constant(src($t), RComplex.createNA()); }
     | num=number                                { $v = $num.v; }
     | cstr=conststring                          { $v = $cstr.v; }
     | pkg=id op=(NS_GET|NS_GET_INT) n_ comp=id {
diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RRuntimeASTAccess.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RRuntimeASTAccess.java
index 6fe5ee13d2f8fdd980213a697cd9a4e69b5d40b1..aa3f99defbd321a07160af1f11e2ecc4901201c9 100644
--- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RRuntimeASTAccess.java
+++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RRuntimeASTAccess.java
@@ -41,6 +41,11 @@ import com.oracle.truffle.r.runtime.nodes.RSyntaxNode;
  *
  */
 public interface RRuntimeASTAccess {
+    /**
+     * Retrieves a type of RLanguage object's representation.
+     */
+    RLanguage.RepType getRepType(RLanguage rl);
+
     /**
      * Computes the "length" of the language element as per the R specification.
      */
@@ -62,7 +67,7 @@ public interface RRuntimeASTAccess {
      * object whose rep is a {@code RCallNode}, with the first list element as the function and the
      * remainder as the arguments.
      */
-    Object fromList(RList list);
+    Object fromList(RList list, RLanguage.RepType repType);
 
     /**
      * Get the "names" attribute for an {@link RLanguage} object, or {@code null} if none.
diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RComplex.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RComplex.java
index f7da0929205e89dc9ede7e310b13917dc22b9b5f..79c578450dbe1c1335b62e69b04aa2298f8fdb16 100644
--- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RComplex.java
+++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RComplex.java
@@ -25,6 +25,7 @@ package com.oracle.truffle.r.runtime.data;
 import com.oracle.truffle.api.*;
 import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
 import com.oracle.truffle.api.CompilerDirectives.ValueType;
+import com.oracle.truffle.api.profiles.ConditionProfile;
 import com.oracle.truffle.r.runtime.*;
 import com.oracle.truffle.r.runtime.data.closures.*;
 import com.oracle.truffle.r.runtime.data.model.*;
@@ -32,8 +33,6 @@ import com.oracle.truffle.r.runtime.data.model.*;
 @ValueType
 public final class RComplex extends RScalarVector implements RAbstractComplexVector {
 
-    public static final RComplex NA = new RComplex(RRuntime.COMPLEX_NA_REAL_PART, RRuntime.COMPLEX_NA_IMAGINARY_PART);
-
     private final double realPart;
     private final double imaginaryPart;
 
@@ -42,12 +41,16 @@ public final class RComplex extends RScalarVector implements RAbstractComplexVec
         this.imaginaryPart = imaginaryPart;
     }
 
+    public static RComplex createNA() {
+        return RComplex.valueOf(RRuntime.COMPLEX_NA_REAL_PART, RRuntime.COMPLEX_NA_IMAGINARY_PART);
+    }
+
     public static RComplex valueOf(double real, double imaginary) {
         return new RComplex(real, imaginary);
     }
 
     @Override
-    public RAbstractVector castSafe(RType type) {
+    public RAbstractVector castSafe(RType type, ConditionProfile isNAProfile) {
         switch (type) {
             case Complex:
                 return this;
diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RComplexVector.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RComplexVector.java
index e4d4cbc5a71a029cfd6ae8dc641569121bd08a1b..f2a6ad2ec980814fe934a587c5e8536d83369e72 100644
--- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RComplexVector.java
+++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RComplexVector.java
@@ -24,6 +24,7 @@ package com.oracle.truffle.r.runtime.data;
 
 import java.util.*;
 
+import com.oracle.truffle.api.profiles.ConditionProfile;
 import com.oracle.truffle.r.runtime.*;
 import com.oracle.truffle.r.runtime.data.closures.*;
 import com.oracle.truffle.r.runtime.data.model.*;
@@ -61,7 +62,8 @@ public final class RComplexVector extends RVector implements RAbstractComplexVec
         return data.length >> 1;
     }
 
-    public RAbstractVector castSafe(RType type) {
+    @Override
+    public RAbstractVector castSafe(RType type, ConditionProfile isNAProfile) {
         switch (type) {
             case Complex:
                 return this;
diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RDouble.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RDouble.java
index 1a1029684d1d805c8d791f85cbd059d30e5dba25..d3c7c4925706fcf3e702df15ec67ab4066dc226f 100644
--- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RDouble.java
+++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RDouble.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -24,6 +24,7 @@ package com.oracle.truffle.r.runtime.data;
 
 import com.oracle.truffle.api.*;
 import com.oracle.truffle.api.CompilerDirectives.ValueType;
+import com.oracle.truffle.api.profiles.ConditionProfile;
 import com.oracle.truffle.r.runtime.*;
 import com.oracle.truffle.r.runtime.data.closures.*;
 import com.oracle.truffle.r.runtime.data.model.*;
@@ -31,24 +32,26 @@ import com.oracle.truffle.r.runtime.data.model.*;
 @ValueType
 public final class RDouble extends RScalarVector implements RAbstractDoubleVector {
 
-    public static final RDouble NA = new RDouble(RRuntime.DOUBLE_NA);
-    public static final RDouble DEFAULT = new RDouble(0.0);
-
     private final double value;
 
     private RDouble(double value) {
         this.value = value;
     }
 
-    public double getValue() {
-        return value;
+    public static RDouble createNA() {
+        return new RDouble(RRuntime.DOUBLE_NA);
     }
 
     public static RDouble valueOf(double value) {
         return new RDouble(value);
     }
 
-    public RAbstractVector castSafe(RType type) {
+    public double getValue() {
+        return value;
+    }
+
+    @Override
+    public RAbstractVector castSafe(RType type, ConditionProfile isNAProfile) {
         switch (type) {
             case Integer:
                 return this;
@@ -56,11 +59,7 @@ public final class RDouble extends RScalarVector implements RAbstractDoubleVecto
             case Double:
                 return this;
             case Complex:
-                if (Double.isNaN(value)) {
-                    return RComplex.NA;
-                } else {
-                    return RComplex.valueOf(value, 0.0);
-                }
+                return isNAProfile.profile(Double.isNaN(value)) ? RComplex.createNA() : RComplex.valueOf(value, 0.0);
             case Character:
                 return RClosures.createDoubleToStringVector(this);
             case List:
diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RDoubleSequence.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RDoubleSequence.java
index 4a7e0bbab2aa31db4c07f7c01ddee13a046417d2..4347a51af6f7c571e5566eaf08a02ac94feb46df 100644
--- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RDoubleSequence.java
+++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RDoubleSequence.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -23,6 +23,7 @@
 package com.oracle.truffle.r.runtime.data;
 
 import com.oracle.truffle.api.*;
+import com.oracle.truffle.api.profiles.ConditionProfile;
 import com.oracle.truffle.r.runtime.*;
 import com.oracle.truffle.r.runtime.data.closures.*;
 import com.oracle.truffle.r.runtime.data.model.*;
@@ -67,7 +68,8 @@ public final class RDoubleSequence extends RSequence implements RAbstractDoubleV
         return start + (getLength() - 1) * stride;
     }
 
-    public RAbstractVector castSafe(RType type) {
+    @Override
+    public RAbstractVector castSafe(RType type, ConditionProfile isNAProfile) {
         // TODO might be possible to implement some of these without closures
         switch (type) {
             case Double:
diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RDoubleVector.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RDoubleVector.java
index 0a9ed7a4f52ebcf044b46b3c59f2e2fe58987ef3..d9aba6dc606b11997eecd49d7235e61d1a314c81 100644
--- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RDoubleVector.java
+++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RDoubleVector.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -24,6 +24,7 @@ package com.oracle.truffle.r.runtime.data;
 
 import java.util.*;
 
+import com.oracle.truffle.api.profiles.ConditionProfile;
 import com.oracle.truffle.r.runtime.*;
 import com.oracle.truffle.r.runtime.data.closures.*;
 import com.oracle.truffle.r.runtime.data.model.*;
@@ -45,7 +46,8 @@ public final class RDoubleVector extends RVector implements RAbstractDoubleVecto
         this(data, complete, dims, null);
     }
 
-    public RAbstractVector castSafe(RType type) {
+    @Override
+    public RAbstractVector castSafe(RType type, ConditionProfile isNAProfile) {
         switch (type) {
             case Double:
             case Numeric:
diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RIntSequence.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RIntSequence.java
index 98ee9064394b97fd3d45343ff07d07629b4291dc..e7f44f771af29dce7516ae41181136ffcf61c0e1 100644
--- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RIntSequence.java
+++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RIntSequence.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -23,6 +23,7 @@
 package com.oracle.truffle.r.runtime.data;
 
 import com.oracle.truffle.api.*;
+import com.oracle.truffle.api.profiles.ConditionProfile;
 import com.oracle.truffle.r.runtime.*;
 import com.oracle.truffle.r.runtime.data.closures.*;
 import com.oracle.truffle.r.runtime.data.model.*;
@@ -44,7 +45,8 @@ public final class RIntSequence extends RSequence implements RAbstractIntVector
         return start + stride * index;
     }
 
-    public RAbstractVector castSafe(RType type) {
+    @Override
+    public RAbstractVector castSafe(RType type, ConditionProfile isNAProfile) {
         switch (type) {
             case Integer:
                 return this;
diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RIntVector.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RIntVector.java
index f5a1de57906b3da71b428059ea6f72e948cdee37..23755761ca30ae8467a1e49a85b222de6b958f8b 100644
--- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RIntVector.java
+++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RIntVector.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -24,6 +24,7 @@ package com.oracle.truffle.r.runtime.data;
 
 import java.util.*;
 
+import com.oracle.truffle.api.profiles.ConditionProfile;
 import com.oracle.truffle.r.runtime.*;
 import com.oracle.truffle.r.runtime.data.closures.*;
 import com.oracle.truffle.r.runtime.data.model.*;
@@ -45,7 +46,8 @@ public final class RIntVector extends RVector implements RAbstractIntVector {
         this(data, complete, dims, null);
     }
 
-    public RAbstractVector castSafe(RType type) {
+    @Override
+    public RAbstractVector castSafe(RType type, ConditionProfile isNAProfile) {
         switch (type) {
             case Double:
             case Numeric:
diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RInteger.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RInteger.java
index cf205588bc2f651c8d1d46b36f52c321e3579629..fa9d1bcf4a5aadb52e549fcf68abc6c931089fe5 100644
--- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RInteger.java
+++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RInteger.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -23,6 +23,7 @@
 package com.oracle.truffle.r.runtime.data;
 
 import com.oracle.truffle.api.CompilerDirectives.ValueType;
+import com.oracle.truffle.api.profiles.ConditionProfile;
 import com.oracle.truffle.r.runtime.*;
 import com.oracle.truffle.r.runtime.data.closures.*;
 import com.oracle.truffle.r.runtime.data.model.*;
@@ -30,15 +31,16 @@ import com.oracle.truffle.r.runtime.data.model.*;
 @ValueType
 public final class RInteger extends RScalarVector implements RAbstractIntVector {
 
-    public static final RInteger NA = new RInteger(RRuntime.INT_NA);
-    public static final RInteger DEFAULT = new RInteger(0);
-
     private final int value;
 
     private RInteger(int value) {
         this.value = value;
     }
 
+    public static RInteger createNA() {
+        return new RInteger(RRuntime.INT_NA);
+    }
+
     public static RInteger valueOf(int value) {
         return new RInteger(value);
     }
@@ -57,23 +59,16 @@ public final class RInteger extends RScalarVector implements RAbstractIntVector
         return RType.Integer;
     }
 
-    public RAbstractVector castSafe(RType type) {
+    @Override
+    public RAbstractVector castSafe(RType type, ConditionProfile isNAProfile) {
         switch (type) {
             case Integer:
                 return this;
             case Numeric:
             case Double:
-                if (isNA()) {
-                    return RDouble.NA;
-                } else {
-                    return RDouble.valueOf(value);
-                }
+                return isNAProfile.profile(isNA()) ? RDouble.createNA() : RDouble.valueOf(value);
             case Complex:
-                if (isNA()) {
-                    return RComplex.NA;
-                } else {
-                    return RComplex.valueOf(value, 0.0);
-                }
+                return isNAProfile.profile(isNA()) ? RComplex.createNA() : RComplex.valueOf(value, 0.0);
             case Character:
                 return RClosures.createIntToStringVector(this);
             case List:
diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RLanguage.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RLanguage.java
index 2cd03ee404c6aac63257ca362cd8da4c571eebf2..79cad9ceb3e338991870549d613e56ff432360f2 100644
--- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RLanguage.java
+++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RLanguage.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -45,6 +45,15 @@ import com.oracle.truffle.r.runtime.nodes.*;
 @ValueType
 public class RLanguage extends RSharingAttributeStorage implements RAbstractContainer, RAttributable, RShareable {
 
+    /*
+     * Used for RLanguage construction from separate AST components.
+     */
+    public enum RepType {
+        CALL,
+        FUNCTION,
+        UNKNOWN
+    }
+
     private RBaseNode rep;
 
     /**
diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RLogical.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RLogical.java
index 602e2a046471cd8430b23098736e86c300e2a7b6..6380d71dedf85666b2c0e7c7942e42d9c6549250 100644
--- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RLogical.java
+++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RLogical.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -23,6 +23,7 @@
 package com.oracle.truffle.r.runtime.data;
 
 import com.oracle.truffle.api.CompilerDirectives.ValueType;
+import com.oracle.truffle.api.profiles.ConditionProfile;
 import com.oracle.truffle.r.runtime.*;
 import com.oracle.truffle.r.runtime.data.closures.*;
 import com.oracle.truffle.r.runtime.data.model.*;
@@ -53,29 +54,18 @@ public final class RLogical extends RScalarVector implements RAbstractLogicalVec
         return value;
     }
 
-    public RAbstractVector castSafe(RType type) {
+    @Override
+    public RAbstractVector castSafe(RType type, ConditionProfile isNAProfile) {
         switch (type) {
             case Logical:
                 return this;
             case Integer:
-                if (isNA()) {
-                    return RInteger.NA;
-                } else {
-                    return RInteger.valueOf(value);
-                }
+                return isNAProfile.profile(isNA()) ? RInteger.createNA() : RInteger.valueOf(value);
             case Numeric:
             case Double:
-                if (isNA()) {
-                    return RDouble.NA;
-                } else {
-                    return RDouble.valueOf(value);
-                }
+                return isNAProfile.profile(isNA()) ? RDouble.createNA() : RDouble.valueOf(value);
             case Complex:
-                if (isNA()) {
-                    return RComplex.NA;
-                } else {
-                    return RComplex.valueOf(value, 0.0);
-                }
+                return isNAProfile.profile(isNA()) ? RComplex.createNA() : RComplex.valueOf(value, 0.0);
             case Character:
                 return RClosures.createLogicalToStringVector(this);
             case List:
diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RLogicalVector.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RLogicalVector.java
index d8db0f769549cb1a3c795ed81bd491cb8e8d2fa7..caefc46ef628b2bfff9c75cef3093e1382ecceec 100644
--- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RLogicalVector.java
+++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RLogicalVector.java
@@ -24,6 +24,7 @@ package com.oracle.truffle.r.runtime.data;
 
 import java.util.*;
 
+import com.oracle.truffle.api.profiles.ConditionProfile;
 import com.oracle.truffle.r.runtime.*;
 import com.oracle.truffle.r.runtime.data.closures.*;
 import com.oracle.truffle.r.runtime.data.model.*;
@@ -45,7 +46,8 @@ public final class RLogicalVector extends RVector implements RAbstractLogicalVec
         this(data, complete, dims, null);
     }
 
-    public RAbstractVector castSafe(RType type) {
+    @Override
+    public RAbstractVector castSafe(RType type, ConditionProfile isNAProfile) {
         switch (type) {
             case Logical:
                 return this;
diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RRaw.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RRaw.java
index b65ea90dabfc91a4aea2f020bec828abf9faade5..9fc3e34884da80ac65df424740c4073cd5eb051f 100644
--- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RRaw.java
+++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RRaw.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -24,6 +24,7 @@ package com.oracle.truffle.r.runtime.data;
 
 import com.oracle.truffle.api.*;
 import com.oracle.truffle.api.CompilerDirectives.ValueType;
+import com.oracle.truffle.api.profiles.ConditionProfile;
 import com.oracle.truffle.r.runtime.*;
 import com.oracle.truffle.r.runtime.data.closures.*;
 import com.oracle.truffle.r.runtime.data.model.*;
@@ -42,7 +43,8 @@ public final class RRaw extends RScalarVector implements RAbstractRawVector {
         return false;
     }
 
-    public RAbstractVector castSafe(RType type) {
+    @Override
+    public RAbstractVector castSafe(RType type, ConditionProfile isNAProfile) {
         switch (type) {
             case Raw:
                 return this;
diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RRawVector.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RRawVector.java
index b86f8f8b471af83956ab40db897b29ee9de53080..2a386218b7b1c43d7ae7e1a17796ceeacc2b6701 100644
--- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RRawVector.java
+++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RRawVector.java
@@ -24,6 +24,7 @@ package com.oracle.truffle.r.runtime.data;
 
 import java.util.*;
 
+import com.oracle.truffle.api.profiles.ConditionProfile;
 import com.oracle.truffle.r.runtime.*;
 import com.oracle.truffle.r.runtime.data.closures.*;
 import com.oracle.truffle.r.runtime.data.model.*;
@@ -45,7 +46,8 @@ public final class RRawVector extends RVector implements RAbstractRawVector {
         this(data, dims, null);
     }
 
-    public RAbstractVector castSafe(RType type) {
+    @Override
+    public RAbstractVector castSafe(RType type, ConditionProfile isNAProfile) {
         switch (type) {
             case Raw:
                 return this;
diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RString.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RString.java
index 5a98fbb268bb7d0a2835daa0f65a2e0e32ef7e02..989b68a0213518b01ab81efbfc2d4ed10bc699d9 100644
--- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RString.java
+++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RString.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -23,6 +23,7 @@
 package com.oracle.truffle.r.runtime.data;
 
 import com.oracle.truffle.api.CompilerDirectives.*;
+import com.oracle.truffle.api.profiles.ConditionProfile;
 import com.oracle.truffle.r.runtime.*;
 import com.oracle.truffle.r.runtime.data.closures.*;
 import com.oracle.truffle.r.runtime.data.model.*;
@@ -44,7 +45,8 @@ public final class RString extends RScalarVector implements RAbstractStringVecto
         return value;
     }
 
-    public RAbstractVector castSafe(RType type) {
+    @Override
+    public RAbstractVector castSafe(RType type, ConditionProfile isNAProfile) {
         switch (type) {
             case Character:
                 return this;
diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RStringVector.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RStringVector.java
index 3cf7ca321bc2823cd3238880574af8e8bbb0a808..d46969be5303394c4a0d28ab9f23a1c785eb6d55 100644
--- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RStringVector.java
+++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RStringVector.java
@@ -24,6 +24,7 @@ package com.oracle.truffle.r.runtime.data;
 
 import java.util.*;
 
+import com.oracle.truffle.api.profiles.ConditionProfile;
 import com.oracle.truffle.r.runtime.*;
 import com.oracle.truffle.r.runtime.data.closures.*;
 import com.oracle.truffle.r.runtime.data.model.*;
@@ -45,7 +46,8 @@ public final class RStringVector extends RVector implements RAbstractStringVecto
         this(data, complete, dims, null);
     }
 
-    public RAbstractVector castSafe(RType type) {
+    @Override
+    public RAbstractVector castSafe(RType type, ConditionProfile isNAProfile) {
         switch (type) {
             case Character:
                 return this;
diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/closures/RDoubleToComplexVectorClosure.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/closures/RDoubleToComplexVectorClosure.java
index 4755d1d9b09307353bb5037480d421d27921958d..0d73289850cc328891d18d488d296cac7ac0d7c9 100644
--- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/closures/RDoubleToComplexVectorClosure.java
+++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/closures/RDoubleToComplexVectorClosure.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -38,7 +38,7 @@ public class RDoubleToComplexVectorClosure extends RToComplexVectorClosure imple
         double real = castVector.getDataAt(index);
         double imaginary = 0.0;
         if (Double.isNaN(real)) {
-            return RComplex.NA;
+            return RComplex.createNA();
         }
         return RDataFactory.createComplex(real, imaginary);
     }
diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/closures/RFactorToComplexVectorClosure.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/closures/RFactorToComplexVectorClosure.java
index e9cb389817c9f62a5f9ac3e04ae1a130dbeb2df5..e7c330e7d8fe0965c1595cc0fbc32a8386307514 100644
--- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/closures/RFactorToComplexVectorClosure.java
+++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/closures/RFactorToComplexVectorClosure.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -22,6 +22,7 @@
  */
 package com.oracle.truffle.r.runtime.data.closures;
 
+import com.oracle.truffle.api.profiles.ConditionProfile;
 import com.oracle.truffle.r.runtime.*;
 import com.oracle.truffle.r.runtime.data.*;
 import com.oracle.truffle.r.runtime.data.model.*;
@@ -42,7 +43,7 @@ public class RFactorToComplexVectorClosure extends RToComplexVectorClosure imple
     }
 
     @Override
-    public final RAbstractVector castSafe(RType type) {
+    public final RAbstractVector castSafe(RType type, ConditionProfile isNAProfile) {
         switch (type) {
             case Character:
                 return new RComplexToStringVectorClosure(this);
diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/closures/RFactorToDoubleVectorClosure.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/closures/RFactorToDoubleVectorClosure.java
index 2463ee79d9264aa278aa9867af953f4259458144..b507eb608e814da8c36569b0c7e91e12e6862e23 100644
--- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/closures/RFactorToDoubleVectorClosure.java
+++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/closures/RFactorToDoubleVectorClosure.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -22,6 +22,7 @@
  */
 package com.oracle.truffle.r.runtime.data.closures;
 
+import com.oracle.truffle.api.profiles.ConditionProfile;
 import com.oracle.truffle.r.runtime.*;
 import com.oracle.truffle.r.runtime.data.*;
 import com.oracle.truffle.r.runtime.data.model.*;
@@ -42,7 +43,7 @@ public class RFactorToDoubleVectorClosure extends RToDoubleVectorClosure impleme
     }
 
     @Override
-    public final RAbstractVector castSafe(RType type) {
+    public final RAbstractVector castSafe(RType type, ConditionProfile isNAProfile) {
         switch (type) {
             case Double:
                 return this;
diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/closures/RFactorToIntVectorClosure.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/closures/RFactorToIntVectorClosure.java
index b805d9dade4b38c663eb954ebe89dec44d954dc0..d025d7c71e9f3881dd699dc4b83d9a8e9b19b210 100644
--- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/closures/RFactorToIntVectorClosure.java
+++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/closures/RFactorToIntVectorClosure.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -22,6 +22,7 @@
  */
 package com.oracle.truffle.r.runtime.data.closures;
 
+import com.oracle.truffle.api.profiles.ConditionProfile;
 import com.oracle.truffle.r.runtime.*;
 import com.oracle.truffle.r.runtime.data.*;
 import com.oracle.truffle.r.runtime.data.model.*;
@@ -42,7 +43,7 @@ public class RFactorToIntVectorClosure extends RToIntVectorClosure implements RA
     }
 
     @Override
-    public final RAbstractVector castSafe(RType type) {
+    public final RAbstractVector castSafe(RType type, ConditionProfile isNAProfile) {
         switch (type) {
             case Integer:
                 return this;
diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/closures/RFactorToStringVectorClosure.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/closures/RFactorToStringVectorClosure.java
index 3286b9bb9dd60e9d21ddfe47ff06b9202b121607..e60dcb91b0ed8f52b192664f5e51fdc53e094ba3 100644
--- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/closures/RFactorToStringVectorClosure.java
+++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/closures/RFactorToStringVectorClosure.java
@@ -22,6 +22,7 @@
  */
 package com.oracle.truffle.r.runtime.data.closures;
 
+import com.oracle.truffle.api.profiles.ConditionProfile;
 import com.oracle.truffle.r.runtime.*;
 import com.oracle.truffle.r.runtime.data.*;
 import com.oracle.truffle.r.runtime.data.model.*;
@@ -44,7 +45,7 @@ public class RFactorToStringVectorClosure extends RToStringVectorClosure impleme
     }
 
     @Override
-    public final RAbstractVector castSafe(RType type) {
+    public final RAbstractVector castSafe(RType type, ConditionProfile isNAProfile) {
         switch (type) {
             case Character:
                 return this;
diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/model/RAbstractComplexVector.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/model/RAbstractComplexVector.java
index 1abd29300cf169ffd4acbdeb4c69d62178689b49..b07d480201e40820164572ac7ff21c168c8f94d3 100644
--- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/model/RAbstractComplexVector.java
+++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/model/RAbstractComplexVector.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -46,7 +46,7 @@ public interface RAbstractComplexVector extends RAbstractVector {
     }
 
     default void setNA(Object store, int index) {
-        setDataAt(store, index, RComplex.NA);
+        setDataAt(store, index, RComplex.createNA());
     }
 
     default boolean checkCompleteness() {
@@ -65,5 +65,4 @@ public interface RAbstractComplexVector extends RAbstractVector {
     default Class<?> getElementClass() {
         return RComplex.class;
     }
-
 }
diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/model/RAbstractVector.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/model/RAbstractVector.java
index c942a2c9dcdbbf8aca8bc193e9b78c67c4c844f1..b8f70f9e72bb3308f8db04de28472f7f8f7172f8 100644
--- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/model/RAbstractVector.java
+++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/model/RAbstractVector.java
@@ -23,6 +23,7 @@
 package com.oracle.truffle.r.runtime.data.model;
 
 import com.oracle.truffle.api.interop.*;
+import com.oracle.truffle.api.profiles.ConditionProfile;
 import com.oracle.truffle.r.runtime.*;
 import com.oracle.truffle.r.runtime.context.*;
 import com.oracle.truffle.r.runtime.data.*;
@@ -66,7 +67,7 @@ public interface RAbstractVector extends RAbstractContainer, TruffleObject {
      *
      * @see RType#getPrecedence()
      */
-    default RAbstractVector castSafe(RType type) {
+    default RAbstractVector castSafe(RType type, ConditionProfile isNAProfile) {
         if (type == getRType()) {
             return this;
         } else {
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 74b740ab4170482a58378640e5c39261dada5324..9220e2268c5b496293f71410c2838ebb0c5c9eef 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
@@ -1725,6 +1725,10 @@ Error in acos() : 0 arguments passed to 'acos' which requires 1
 #argv <- list(structure(numeric(0), .Dim = c(0L, 0L)));acos(argv[[1]]);
 <0 x 0 matrix>
 
+##com.oracle.truffle.r.test.builtins.TestBuiltin_acos.testacos5
+#argv <- list(c(0.3+3i,-3+2i));acos(argv[[1]]);
+[1] 1.476169-1.822701i 2.535455-1.968638i
+
 ##com.oracle.truffle.r.test.builtins.TestBuiltin_acosh.testacosh1
 #argv <- list(FALSE);acosh(argv[[1]]);
 [1] NaN
@@ -1781,6 +1785,10 @@ numeric(0)
 [193] 2.78894472 2.81909548 2.84924623 2.87939698 2.90954774 2.93969849
 [199] 2.96984925 3.00000000
 
+##com.oracle.truffle.r.test.builtins.TestBuiltin_acosh.testacosh6
+#argv <- list(c(0.34345+233i,-0.34345+0.3334i));acosh(argv[[1]]);
+[1] 6.144191+1.569322i 0.345486+1.900672i
+
 ##com.oracle.truffle.r.test.builtins.TestBuiltin_adist.testadist1
 #argv <- list(list(c(107L, 105L, 116L, 116L, 101L, 110L)), list(c(115L, 105L, 116L, 116L, 105L, 110L, 103L)), structure(c(1, 1, 1), .Names = c('insertions', 'deletions', 'substitutions')), FALSE, TRUE, FALSE, FALSE, FALSE); .Internal(adist(argv[[1]], argv[[2]], argv[[3]], argv[[4]], argv[[5]], argv[[6]], argv[[7]], argv[[8]]))
      [,1]
@@ -5836,6 +5844,10 @@ Error in asin() : 0 arguments passed to 'asin' which requires 1
 #{ asin(0.4) }
 [1] 0.4115168
 
+##com.oracle.truffle.r.test.builtins.TestBuiltin_asin.testTrigExp
+#{ asin(2+0i) }
+[1] 1.570796-1.316958i
+
 ##com.oracle.truffle.r.test.builtins.TestBuiltin_asin.testTrigExp
 #{ asin(c(0.3,0.6,0.9)) }
 [1] 0.3046927 0.6435011 1.1197695
@@ -5862,6 +5874,10 @@ numeric(0)
 #argv <- list(structure(numeric(0), .Dim = c(0L, 0L)));asin(argv[[1]]);
 <0 x 0 matrix>
 
+##com.oracle.truffle.r.test.builtins.TestBuiltin_asin.testasin5
+#argv <- list(c(0.34345+233i,-0.34345+0.3334i));asin(argv[[1]]);
+[1]  0.0014740+6.1441913i -0.3298752+0.3454864i
+
 ##com.oracle.truffle.r.test.builtins.TestBuiltin_asinh.testasinh1
 #argv <- list(structure(numeric(0), .Dim = c(0L, 0L)));asinh(argv[[1]]);
 <0 x 0 matrix>
@@ -5912,6 +5928,10 @@ numeric(0)
 [1]  1.316958+1.570796i  1.316958+1.570739i -1.316958-1.570796i
 [4] -1.317016-1.570796i
 
+##com.oracle.truffle.r.test.builtins.TestBuiltin_asinh.testasinh5
+#argv <- list(c(0.34345+233i,-0.34345+0.3334i));asinh(argv[[1]]);
+[1]  6.1441821+1.5693223i -0.3542312+0.3189009i
+
 ##com.oracle.truffle.r.test.builtins.TestBuiltin_asinteger.testAsInteger
 #{ as.integer("") }
 [1] NA
@@ -14070,6 +14090,162 @@ numeric(0)
 [190]  7.462312  7.688703  7.922084  8.162667  8.410671  8.666322  8.929851
 [197]  9.201499  9.481513  9.770146 10.067662
 
+##com.oracle.truffle.r.test.builtins.TestBuiltin_cosh.testcosh5
+#argv <- list(c(0-3i, 0-2.96984924623116i, 0-2.93969849246231i, 0-2.90954773869347i, 0-2.87939698492462i, 0-2.84924623115578i, 0-2.81909547738693i, 0-2.78894472361809i, 0-2.75879396984925i, 0-2.7286432160804i, 0-2.69849246231156i, 0-2.66834170854271i, 0-2.63819095477387i, 0-2.60804020100502i, 0-2.57788944723618i, 0-2.54773869346734i, 0-2.51758793969849i, 0-2.48743718592965i, 0-2.4572864321608i, 0-2.42713567839196i, 0-2.39698492462312i, 0-2.36683417085427i, 0-2.33668341708543i, 0-2.30653266331658i, 0-2.27638190954774i, 0-2.24623115577889i, 0-2.21608040201005i, 0-2.18592964824121i, 0-2.15577889447236i, 0-2.12562814070352i, 0-2.09547738693467i, 0-2.06532663316583i, 0-2.03517587939699i, 0-2.00502512562814i, 0-1.9748743718593i, 0-1.94472361809045i, 0-1.91457286432161i, 0-1.88442211055276i, 0-1.85427135678392i, 0-1.82412060301508i, 0-1.79396984924623i, 0-1.76381909547739i, 0-1.73366834170854i, 0-1.7035175879397i, 0-1.67336683417085i, 0-1.64321608040201i, 0-1.61306532663317i, 0-1.58291457286432i, 0-1.55276381909548i, 0-1.52261306532663i, 0-1.49246231155779i, 0-1.46231155778894i, 0-1.4321608040201i, 0-1.40201005025126i, 0-1.37185929648241i, 0-1.34170854271357i, 0-1.31155778894472i, 0-1.28140703517588i, 0-1.25125628140704i, 0-1.22110552763819i, 0-1.19095477386935i, 0-1.1608040201005i, 0-1.13065326633166i, 0-1.10050251256281i, 0-1.07035175879397i, 0-1.04020100502513i, 0-1.01005025125628i, 0-0.979899497487437i, 0-0.949748743718593i, 0-0.919597989949749i, 0-0.889447236180905i, 0-0.859296482412061i, 0-0.829145728643216i, 0-0.798994974874372i, 0-0.768844221105528i, 0-0.738693467336684i, 0-0.70854271356784i, 0-0.678391959798995i, 0-0.648241206030151i, 0-0.618090452261307i, 0-0.587939698492463i, 0-0.557788944723618i, 0-0.527638190954774i, 0-0.49748743718593i, 0-0.467336683417086i, 0-0.437185929648241i, 0-0.407035175879397i, 0-0.376884422110553i, 0-0.346733668341709i, 0-0.316582914572864i, 0-0.28643216080402i, 0-0.256281407035176i, 0-0.226130653266332i, 0-0.195979899497488i, 0-0.165829145728643i, 0-0.135678391959799i, 0-0.105527638190955i, 0-0.0753768844221105i, 0-0.0452261306532664i, 0-0.0150753768844223i, 0+0.0150753768844218i, 0+0.0452261306532664i, 0+0.0753768844221105i, 0+0.105527638190955i, 0+0.135678391959799i, 0+0.165829145728643i, 0+0.195979899497488i, 0+0.226130653266332i, 0+0.256281407035176i, 0+0.28643216080402i, 0+0.316582914572864i, 0+0.346733668341709i, 0+0.376884422110553i, 0+0.407035175879397i, 0+0.437185929648241i, 0+0.467336683417085i, 0+0.49748743718593i, 0+0.527638190954774i, 0+0.557788944723618i, 0+0.587939698492462i, 0+0.618090452261306i, 0+0.648241206030151i, 0+0.678391959798995i, 0+0.708542713567839i, 0+0.738693467336683i, 0+0.768844221105527i, 0+0.798994974874372i, 0+0.829145728643216i, 0+0.85929648241206i, 0+0.889447236180904i, 0+0.919597989949748i, 0+0.949748743718593i, 0+0.979899497487437i, 0+1.01005025125628i, 0+1.04020100502513i, 0+1.07035175879397i, 0+1.10050251256281i, 0+1.13065326633166i, 0+1.1608040201005i, 0+1.19095477386935i, 0+1.22110552763819i, 0+1.25125628140704i, 0+1.28140703517588i, 0+1.31155778894472i, 0+1.34170854271357i, 0+1.37185929648241i, 0+1.40201005025126i, 0+1.4321608040201i, 0+1.46231155778894i, 0+1.49246231155779i, 0+1.52261306532663i, 0+1.55276381909548i, 0+1.58291457286432i, 0+1.61306532663317i, 0+1.64321608040201i, 0+1.67336683417085i, 0+1.7035175879397i, 0+1.73366834170854i, 0+1.76381909547739i, 0+1.79396984924623i, 0+1.82412060301507i, 0+1.85427135678392i, 0+1.88442211055276i, 0+1.91457286432161i, 0+1.94472361809045i, 0+1.9748743718593i, 0+2.00502512562814i, 0+2.03517587939698i, 0+2.06532663316583i, 0+2.09547738693467i, 0+2.12562814070352i, 0+2.15577889447236i, 0+2.18592964824121i, 0+2.21608040201005i, 0+2.24623115577889i, 0+2.27638190954774i, 0+2.30653266331658i, 0+2.33668341708543i, 0+2.36683417085427i, 0+2.39698492462312i, 0+2.42713567839196i, 0+2.4572864321608i, 0+2.48743718592965i, 0+2.51758793969849i, 0+2.54773869346734i, 0+2.57788944723618i, 0+2.60804020100502i, 0+2.63819095477387i, 0+2.66834170854271i, 0+2.69849246231156i, 0+2.7286432160804i, 0+2.75879396984925i, 0+2.78894472361809i, 0+2.81909547738693i, 0+2.84924623115578i, 0+2.87939698492462i, 0+2.90954773869347i, 0+2.93969849246231i, 0+2.96984924623116i, 0+3i));cosh(argv[[1]]);
+  [1] -0.98999250+0i -0.98528832+0i -0.97968851+0i -0.97319816+0i -0.96582319+0i
+  [6] -0.95757027+0i -0.94844693+0i -0.93846145+0i -0.92762291+0i -0.91594116+0i
+ [11] -0.90342682+0i -0.89009127+0i -0.87594663+0i -0.86100575+0i -0.84528221+0i
+ [16] -0.82879032+0i -0.81154506+0i -0.79356210+0i -0.77485780+0i -0.75544915+0i
+ [21] -0.73535379+0i -0.71459001+0i -0.69317666+0i -0.67113321+0i -0.64847970+0i
+ [26] -0.62523673+0i -0.60142542+0i -0.57706741+0i -0.55218485+0i -0.52680035+0i
+ [31] -0.50093699+0i -0.47461828+0i -0.44786815+0i -0.42071090+0i -0.39317122+0i
+ [36] -0.36527415+0i -0.33704505+0i -0.30850958+0i -0.27969367+0i -0.25062352+0i
+ [41] -0.22132555+0i -0.19182640+0i -0.16215288+0i -0.13233196+0i -0.10239075+0i
+ [46] -0.07235647+0i -0.04225641+0i -0.01211795+0i  0.01803153+0i  0.04816462+0i
+ [51]  0.07825393+0i  0.10827210+0i  0.13819186+0i  0.16798600+0i  0.19762744+0i
+ [56]  0.22708923+0i  0.25634461+0i  0.28536696+0i  0.31412992+0i  0.34260734+0i
+ [61]  0.37077332+0i  0.39860227+0i  0.42606889+0i  0.45314822+0i  0.47981564+0i
+ [66]  0.50604690+0i  0.53181817+0i  0.55710601+0i  0.58188745+0i  0.60613995+0i
+ [71]  0.62984147+0i  0.65297046+0i  0.67550591+0i  0.69742732+0i  0.71871477+0i
+ [76]  0.73934891+0i  0.75931098+0i  0.77858284+0i  0.79714696+0i  0.81498649+0i
+ [81]  0.83208519+0i  0.84842752+0i  0.86399864+0i  0.87878438+0i  0.89277130+0i
+ [86]  0.90594670+0i  0.91829860+0i  0.92981576+0i  0.94048772+0i  0.95030477+0i
+ [91]  0.95925801+0i  0.96733927+0i  0.97454123+0i  0.98085733+0i  0.98628183+0i
+ [96]  0.99080980+0i  0.99443712+0i  0.99716051+0i  0.99897747+0i  0.99988637+0i
+[101]  0.99988637+0i  0.99897747+0i  0.99716051+0i  0.99443712+0i  0.99080980+0i
+[106]  0.98628183+0i  0.98085733+0i  0.97454123+0i  0.96733927+0i  0.95925801+0i
+[111]  0.95030477+0i  0.94048772+0i  0.92981576+0i  0.91829860+0i  0.90594670+0i
+[116]  0.89277130+0i  0.87878438+0i  0.86399864+0i  0.84842752+0i  0.83208519+0i
+[121]  0.81498649+0i  0.79714696+0i  0.77858284+0i  0.75931098+0i  0.73934891+0i
+[126]  0.71871477+0i  0.69742732+0i  0.67550591+0i  0.65297046+0i  0.62984147+0i
+[131]  0.60613995+0i  0.58188745+0i  0.55710601+0i  0.53181817+0i  0.50604690+0i
+[136]  0.47981564+0i  0.45314822+0i  0.42606889+0i  0.39860227+0i  0.37077332+0i
+[141]  0.34260734+0i  0.31412992+0i  0.28536696+0i  0.25634461+0i  0.22708923+0i
+[146]  0.19762744+0i  0.16798600+0i  0.13819186+0i  0.10827210+0i  0.07825393+0i
+[151]  0.04816462+0i  0.01803153+0i -0.01211795+0i -0.04225641+0i -0.07235647+0i
+[156] -0.10239075+0i -0.13233196+0i -0.16215288+0i -0.19182640+0i -0.22132555+0i
+[161] -0.25062352+0i -0.27969367+0i -0.30850958+0i -0.33704505+0i -0.36527415+0i
+[166] -0.39317122+0i -0.42071090+0i -0.44786815+0i -0.47461828+0i -0.50093699+0i
+[171] -0.52680035+0i -0.55218485+0i -0.57706741+0i -0.60142542+0i -0.62523673+0i
+[176] -0.64847970+0i -0.67113321+0i -0.69317666+0i -0.71459001+0i -0.73535379+0i
+[181] -0.75544915+0i -0.77485780+0i -0.79356210+0i -0.81154506+0i -0.82879032+0i
+[186] -0.84528221+0i -0.86100575+0i -0.87594663+0i -0.89009127+0i -0.90342682+0i
+[191] -0.91594116+0i -0.92762291+0i -0.93846145+0i -0.94844693+0i -0.95757027+0i
+[196] -0.96582319+0i -0.97319816+0i -0.97968851+0i -0.98528832+0i -0.98999250+0i
+
+##com.oracle.truffle.r.test.builtins.TestBuiltin_cospi.testTrigExp
+#{ cospi() }
+Error in cospi() : 0 arguments passed to 'cospi' which requires 1
+
+##com.oracle.truffle.r.test.builtins.TestBuiltin_cospi.testTrigExp
+#{ cospi(1.2) }
+[1] -0.809017
+
+##com.oracle.truffle.r.test.builtins.TestBuiltin_cospi.testTrigExp
+#{ cospi(c(0,0.5,-0.5,1,-1,1.5,-1.5)) }
+[1]  1  0  0 -1 -1  0  0
+
+##com.oracle.truffle.r.test.builtins.TestBuiltin_cospi.testTrigExp
+#{ cospi(c(0.3,0.6,0.9)) }
+[1]  0.5877853 -0.3090170 -0.9510565
+
+##com.oracle.truffle.r.test.builtins.TestBuiltin_cospi.testcos1
+#argv <- list(c(-6.28318530717959, -6.1261056745001, -5.96902604182061, -5.81194640914112, -5.65486677646163, -5.49778714378214, -5.34070751110265, -5.18362787842316, -5.02654824574367, -4.86946861306418, -4.71238898038469, -4.5553093477052, -4.39822971502571, -4.24115008234622, -4.08407044966673, -3.92699081698724, -3.76991118430775, -3.61283155162826, -3.45575191894877, -3.29867228626928, -3.14159265358979, -2.9845130209103, -2.82743338823081, -2.67035375555132, -2.51327412287183, -2.35619449019234, -2.19911485751286, -2.04203522483337, -1.88495559215388, -1.72787595947439, -1.5707963267949, -1.41371669411541, -1.25663706143592, -1.09955742875643, -0.942477796076938, -0.785398163397448, -0.628318530717959, -0.471238898038469, -0.314159265358979, -0.15707963267949, 0, 0.15707963267949, 0.314159265358979, 0.471238898038469, 0.628318530717959, 0.785398163397448, 0.942477796076938, 1.09955742875643, 1.25663706143592, 1.41371669411541, 1.5707963267949, 1.72787595947439, 1.88495559215388, 2.04203522483337, 2.19911485751286, 2.35619449019234, 2.51327412287183, 2.67035375555133, 2.82743338823081, 2.9845130209103, 3.14159265358979, 3.29867228626928, 3.45575191894877, 3.61283155162826, 3.76991118430775, 3.92699081698724, 4.08407044966673, 4.24115008234622, 4.39822971502571, 4.5553093477052, 4.71238898038469, 4.86946861306418, 5.02654824574367, 5.18362787842316, 5.34070751110265, 5.49778714378214, 5.65486677646163, 5.81194640914112, 5.96902604182061, 6.1261056745001, 6.28318530717959, 6.44026493985908, 6.59734457253857, 6.75442420521805, 6.91150383789754, 7.06858347057704, 7.22566310325652, 7.38274273593601, 7.5398223686155, 7.69690200129499, 7.85398163397448, 8.01106126665397, 8.16814089933346, 8.32522053201295, 8.48230016469244, 8.63937979737193, 8.79645943005142, 8.95353906273091, 9.1106186954104, 9.26769832808989, 9.42477796076938));cospi(argv[[1]]);
+  [1]  0.629681725  0.922544680  0.995269354  0.830502131  0.467559887
+  [6] -0.006951837 -0.479804709 -0.838166232 -0.996523921 -0.917090348
+ [11] -0.618820010 -0.172886392  0.314301502  0.726490544  0.965323885
+ [16]  0.973810939  0.749926519  0.347094089 -0.138562184 -0.591154649
+ [21] -0.902685362 -0.998816638 -0.856609563 -0.509997692 -0.041689801
+ [26]  0.436566140  0.810648352  0.991293066  0.935394708  0.656291786
+ [31]  0.220584041 -0.267759628 -0.692210300 -0.951485247 -0.983716094
+ [36] -0.781211892 -0.392294341  0.090232771  0.551228473  0.880689637
+ [41]  1.000000000  0.880689637  0.551228473  0.090232771 -0.392294341
+ [46] -0.781211892 -0.983716094 -0.951485247 -0.692210300 -0.267759628
+ [51]  0.220584041  0.656291786  0.935394708  0.991293066  0.810648352
+ [56]  0.436566140 -0.041689801 -0.509997692 -0.856609563 -0.998816638
+ [61] -0.902685362 -0.591154649 -0.138562184  0.347094089  0.749926519
+ [66]  0.973810939  0.965323885  0.726490544  0.314301502 -0.172886392
+ [71] -0.618820010 -0.917090348 -0.996523921 -0.838166232 -0.479804709
+ [76] -0.006951837  0.467559887  0.830502131  0.995269354  0.922544680
+ [81]  0.629681725  0.186563660 -0.301072362 -0.716866278 -0.961601042
+ [86] -0.976877867 -0.759051386 -0.360099512  0.124779569  0.579883659
+ [91]  0.896615489  0.999396280  0.863700405  0.521907712  0.055577022
+ [96] -0.424015498 -0.802429131 -0.989366542 -0.940220591 -0.666718519
+[101] -0.234123590
+
+##com.oracle.truffle.r.test.builtins.TestBuiltin_cospi.testcos2
+#argv <- list(c(0.0156298141969641, 0.0312596283939283, 0.0468894425908924, 0.0625192567878566, 0.0781490709848207, 0.0937788851817849, 0.109408699378749, 0.125038513575713, 0.140668327772677, 0.156298141969641, 0.171927956166606, 0.18755777036357, 0.203187584560534, 0.218817398757498, 0.234447212954462, 0.250077027151426, 0.26570684134839, 0.281336655545355, 0.296966469742319, 0.312596283939283, 0.328226098136247, 0.343855912333211, 0.359485726530175, 0.375115540727139, 0.390745354924104, 0.406375169121068, 0.422004983318032, 0.437634797514996, 0.45326461171196, 0.468894425908924, 0.484524240105888, 0.500154054302853, 0.515783868499817, 0.531413682696781, 0.547043496893745, 0.562673311090709, 0.578303125287673, 0.593932939484637, 0.609562753681602, 0.625192567878566, 0.64082238207553, 0.656452196272494, 0.672082010469458, 0.687711824666422, 0.703341638863387, 0.718971453060351, 0.734601267257315, 0.750231081454279, 0.765860895651243, 0.781490709848207, 0.797120524045171, 0.812750338242136, 0.8283801524391, 0.844009966636064, 0.859639780833028, 0.875269595029992, 0.890899409226956, 0.90652922342392, 0.922159037620885, 0.937788851817849, 0.953418666014813, 0.969048480211777, 0.984678294408741, 1.00030810860571, 1.01593792280267, 1.03156773699963, 1.0471975511966, 1.06282736539356, 1.07845717959053, 1.09408699378749, 1.10971680798445, 1.12534662218142, 1.14097643637838, 1.15660625057535, 1.17223606477231, 1.18786587896927, 1.20349569316624, 1.2191255073632, 1.23475532156017, 1.25038513575713, 1.2660149499541, 1.28164476415106, 1.29727457834802, 1.31290439254499, 1.32853420674195, 1.34416402093892, 1.35979383513588, 1.37542364933284, 1.39105346352981, 1.40668327772677, 1.42231309192374, 1.4379429061207, 1.45357272031767, 1.46920253451463, 1.48483234871159, 1.50046216290856, 1.51609197710552, 1.53172179130249, 1.54735160549945, 1.56298141969641));cospi(argv[[1]]);
+  [1]  0.9987947140  0.9951817613  0.9891698514  0.9807734762  0.9700128760
+  [6]  0.9569139898  0.9415083935  0.9238332234  0.9039310867  0.8818499591
+ [11]  0.8576430686  0.8313687676  0.8030903924  0.7728761100  0.7407987539
+ [16]  0.7069356492  0.6713684251  0.6341828191  0.5954684696  0.5553187006
+ [21]  0.5138302958  0.4711032661  0.4272406080  0.3823480556  0.3365338257
+ [26]  0.2899083568  0.2425840429  0.1946749627  0.1462966044  0.0975655877
+ [31]  0.0485993821 -0.0004839758 -0.0495661671 -0.0985288756 -0.1472540731
+ [36] -0.1956243040 -0.2435229685 -0.2908346033 -0.3374451604 -0.3832422815
+ [41] -0.4281155696 -0.4719568542 -0.5146604529 -0.5561234254 -0.5962458224
+ [46] -0.6349309258 -0.6720854825 -0.7076199287 -0.7414486062 -0.7734899683
+ [51] -0.8036667771 -0.8319062893 -0.8581404315 -0.8823059643 -0.9043446350
+ [56] -0.9242033178 -0.9418341420 -0.9571946071 -0.9702476856 -0.9809619122
+ [61] -0.9893114594 -0.9952762001 -0.9988417558 -0.9999995315 -0.9987467363
+ [66] -0.9950863902 -0.9890273166 -0.9805841214 -0.9697771575 -0.9566324759
+ [71] -0.9411817629 -0.9234622633 -0.9035166915 -0.8813931276 -0.8571449021
+ [76] -0.8308304670 -0.8025132553 -0.7722615275 -0.7401482077 -0.7062507073
+ [81] -0.6706507387 -0.6334341181 -0.5946905590 -0.5545134555 -0.5129996573
+ [86] -0.4702492365 -0.4263652461 -0.3814534714 -0.3356221758 -0.2889818387
+ [91] -0.2416448900 -0.1937254389 -0.1453389987 -0.0966022084 -0.0476325515
+ [96]  0.0014519271  0.0505329057  0.0994920711  0.1482114037  0.1965734621
+
+##com.oracle.truffle.r.test.builtins.TestBuiltin_cospi.testcos3
+#argv <- list(c(0.560475646552213, 0.23017748948328, -1.55870831414912, -0.070508391424576, -0.129287735160946, -1.71506498688328, -0.460916205989202, 1.26506123460653, 0.686852851893526, 0.445661970099958, -1.22408179743946, -0.359813827057364, -0.400771450594052, -0.11068271594512, 0.555841134754075, -1.78691313680308, -0.497850478229239, 1.96661715662964, -0.701355901563686, 0.472791407727934, 1.06782370598685, 0.217974914658295, 1.02600444830724, 0.72889122929114, 0.625039267849257, 1.68669331074241, -0.837787044494525, -0.153373117836515, 1.13813693701195, -1.25381492106993, -0.426464221476814, 0.295071482992271, -0.895125661045022, -0.878133487533042, -0.821581081637487, -0.688640254100091, -0.553917653537589, 0.0619117105767217, 0.305962663739917, 0.380471001012383, 0.694706978920513, 0.207917278019599, 1.26539635156826, -2.16895596533851, -1.20796199830499, 1.12310858320335, 0.402884835299076, 0.466655353623219, -0.779965118336318, 0.0833690664718293, -0.253318513994755, 0.028546755348703, 0.0428704572913161, -1.36860228401446, 0.225770985659268, -1.51647060442954, 1.54875280423022, -0.584613749636069, -0.123854243844614, -0.215941568743973, -0.379639482759882, 0.502323453109302, 0.33320738366942, 1.01857538310709, 1.07179122647558, -0.303528641404258, -0.448209778629426, -0.0530042267305041, -0.922267467879738, -2.05008468562714, 0.491031166056535, 2.30916887564081, -1.00573852446226, 0.709200762582393, 0.688008616467358, -1.0255713696967, 0.284773007051009, 1.22071771225454, -0.18130347974915, 0.138891362439045, -0.00576418589988693, -0.38528040112633, 0.370660031792409, -0.644376548518833, 0.220486561818751, -0.331781963915697, -1.09683901314935, -0.435181490833803, 0.325931585531227, -1.14880761845109, -0.993503855962119, -0.54839695950807, -0.238731735111441, 0.627906076039371, -1.36065244853001, 0.600259587147127, -2.18733299301658, -1.53261062618519, 0.235700359100477));cospi(argv[[1]]);
+ [1] -0.188848925  0.749742206  0.183393709  0.975567108  0.918641004
+ [6]  0.625401978  0.122477069 -0.672870215 -0.553878645  0.169880057
+[11] -0.762276209  0.426308434  0.306711124  0.940152075 -0.174531651
+[16]  0.784174183  0.006752870  0.994505625 -0.591226071  0.085374260
+[21] -0.977385393  0.774552909 -0.996664788 -0.658694992 -0.382797403
+[26]  0.553461267 -0.872936280  0.886145666 -0.907303620 -0.698581577
+[31]  0.228970020  0.600240625 -0.946213160 -0.927601897 -0.846979012
+[36] -0.558545164 -0.168578454  0.981144164  0.572528298  0.366748366
+[41] -0.574251858  0.794148360 -0.672091022  0.862407015 -0.794062971
+[46] -0.926137137  0.300385018  0.104563809 -0.770443387  0.965896765
+[51]  0.699696603  0.995981239  0.990944146 -0.401173959  0.758830694
+[56]  0.051720843  0.152563332 -0.262702422  0.925251013  0.778577512
+[61]  0.369177380 -0.007299278  0.500342632 -0.998297755 -0.974673758
+[66]  0.578780919  0.161986865  0.986167935 -0.970330104  0.987646687
+[71]  0.028172695  0.564241012 -0.999837498 -0.610921141 -0.556898100
+[76] -0.996774893  0.625799037 -0.769074048  0.842126640  0.906304503
+[81]  0.999836042  0.352650668  0.395244027 -0.438179423  0.769537990
+[86]  0.504214854 -0.954078275  0.202228939  0.520000941 -0.892700907
+[91] -0.999791759 -0.151458405  0.731690324 -0.391102116 -0.423923750
+[96] -0.309792494  0.831760988  0.102270182  0.738148515
+
+##com.oracle.truffle.r.test.builtins.TestBuiltin_cospi.testcos4
+#argv <- list(c(-1.88495559215388, 0.628318530717959, -2.51327412287183, 5.02654824574367, 0.942477796076938, -2.51327412287183, 1.5707963267949, 2.19911485751286, 1.88495559215388, -0.942477796076938, 4.71238898038469, 1.25663706143592, -1.88495559215388, -6.91150383789755, 3.45575191894877, 0, 0, 2.82743338823081, 2.51327412287183, 1.88495559215388, 2.82743338823081, 2.51327412287183, 0.314159265358979, -6.28318530717959, 1.88495559215388, -0.314159265358979, -0.628318530717959, -4.71238898038469, -1.5707963267949, 1.25663706143592));cospi(argv[[1]]);
+ [1]  0.9353947 -0.3922943 -0.0416898 -0.9965239 -0.9837161 -0.0416898
+ [7]  0.2205840  0.8106484  0.9353947 -0.9837161 -0.6188200 -0.6922103
+[13]  0.9353947 -0.9616010 -0.1385622  1.0000000  1.0000000 -0.8566096
+[19] -0.0416898  0.9353947 -0.8566096 -0.0416898  0.5512285  0.6296817
+[25]  0.9353947  0.5512285 -0.3922943 -0.6188200  0.2205840 -0.6922103
+
+##com.oracle.truffle.r.test.builtins.TestBuiltin_cospi.testcos5
+#argv <- list(structure(c(-0.416146836547142, -0.989992496600445, -0.653643620863612, 0.283662185463226, 0.960170286650366, -0.416146836547142, 0.283662185463226, -0.839071529076452, -0.275163338051597, 0.64691932232864, 0.283662185463226, -0.759687912858821, 0.914742357804531, -0.918282786212119, 0.776685982021631), .Dim = c(5L, 3L)));cospi(argv[[1]]);
+           [,1]       [,2]       [,3]
+[1,]  0.2603961  0.2603961  0.6285172
+[2,] -0.9995058  0.6285172 -0.7282971
+[3,] -0.4641597 -0.8748977 -0.9643435
+[4,]  0.6285172  0.6490578 -0.9672274
+[5,] -0.9921816 -0.4453460 -0.7638352
+
+##com.oracle.truffle.r.test.builtins.TestBuiltin_cospi.testcos6
+#argv <- list(c(-0.560475646552213-0.710406563699301i, -0.23017748948328+0.25688370915653i, 1.55870831414912-0.24669187846237i, 0.070508391424576-0.347542599397733i, 0.129287735160946-0.951618567265016i, 1.71506498688328-0.04502772480892i, 0.460916205989202-0.784904469457076i, -1.26506123460653-1.66794193658814i, -0.686852851893526-0.380226520287762i, -0.445661970099958+0.918996609060766i, 1.22408179743946-0.57534696260839i, 0.359813827057364+0.607964322225033i, 0.40077145059405-1.61788270828916i, 0.11068271594512-0.055561965524539i, -0.555841134754075+0.519407203943462i, 1.78691313680308+0.30115336216671i, 0.497850478229239+0.105676194148943i, -1.96661715662964-0.64070600830538i, 0.701355901563686-0.849704346033582i, -0.47279140772793-1.02412879060491i, -1.06782370598685+0.11764659710013i, -0.217974914658295-0.947474614184802i, -1.02600444830724-0.49055744370067i, -0.72889122929114-0.256092192198247i, -0.62503926784926+1.84386200523221i, -1.68669331074241-0.65194990169546i, 0.837787044494525+0.235386572284857i, 0.153373117836515+0.077960849563711i, -1.13813693701195-0.96185663413013i, 1.25381492106993-0.0713080861236i, 0.42646422147681+1.44455085842335i, -0.295071482992271+0.451504053079215i, 0.895125661045022+0.04123292199294i, 0.878133487533042-0.422496832339625i, 0.82158108163749-2.05324722154052i, 0.68864025410009+1.13133721341418i, 0.55391765353759-1.46064007092482i, -0.061911710576722+0.739947510877334i, -0.30596266373992+1.90910356921748i, -0.38047100101238-1.4438931609718i, -0.694706978920513+0.701784335374711i, -0.207917278019599-0.262197489402468i, -1.26539635156826-1.57214415914549i, 2.16895596533851-1.51466765378175i, 1.20796199830499-1.60153617357459i, -1.12310858320335-0.5309065221703i, -0.40288483529908-1.4617555849959i, -0.466655353623219+0.687916772975828i, 0.77996511833632+2.10010894052567i, -0.08336906647183-1.28703047603518i, 0.253318513994755+0.787738847475178i, -0.028546755348703+0.76904224100091i, -0.042870457291316+0.332202578950118i, 1.36860228401446-1.00837660827701i, -0.225770985659268-0.119452606630659i, 1.51647060442954-0.28039533517025i, -1.54875280423022+0.56298953322048i, 0.584613749636069-0.372438756103829i, 0.123854243844614+0.976973386685621i, 0.215941568743973-0.374580857767014i, 0.37963948275988+1.05271146557933i, -0.5023234531093-1.04917700666607i, -0.33320738366942-1.26015524475811i, -1.01857538310709+3.2410399349424i, -1.07179122647558-0.41685758816043i, 0.303528641404258+0.298227591540715i, 0.448209778629426+0.636569674033849i, 0.053004226730504-0.483780625708744i, 0.922267467879738+0.516862044313609i, 2.05008468562714+0.36896452738509i, -0.491031166056535-0.215380507641693i, -2.30916887564081+0.06529303352532i, 1.00573852446226-0.03406725373846i, -0.70920076258239+2.12845189901618i, -0.688008616467358-0.741336096272828i, 1.0255713696967-1.09599626707466i, -0.284773007051009+0.037788399171079i, -1.22071771225454+0.31048074944314i, 0.18130347974915+0.436523478910183i, -0.138891362439045-0.458365332711106i, 0.00576418589989-1.06332613397119i, 0.38528040112633+1.26318517608949i, -0.370660031792409-0.349650387953555i, 0.644376548518833-0.865512862653374i, -0.220486561818751-0.236279568941097i, 0.331781963915697-0.197175894348552i, 1.09683901314935+1.10992028971364i, 0.435181490833803+0.084737292197196i, -0.325931585531227+0.754053785184521i, 1.14880761845109-0.49929201717226i, 0.993503855962119+0.214445309581601i, 0.54839695950807-0.324685911490835i, 0.238731735111441+0.094583528173571i, -0.627906076039371-0.895363357977542i, 1.36065244853001-1.31080153332797i, -0.60025958714713+1.99721338474797i, 2.18733299301658+0.60070882367242i, 1.53261062618519-1.25127136162494i, -0.235700359100477-0.611165916680421i, -1.02642090030678-1.18548008459731i));cospi(argv[[1]]);
+Error in cospi(argv[[1]]) : unimplemented complex function
+
+##com.oracle.truffle.r.test.builtins.TestBuiltin_cospi.testcos7
+#argv <- list(Inf);cospi(argv[[1]]);
+[1] NaN
+Warning message:
+In cospi(argv[[1]]) : NaNs produced
+
 ##com.oracle.truffle.r.test.builtins.TestBuiltin_crossprod.testCrossprod
 #{ crossprod(1:3, matrix(1:6, ncol=2)) }
      [,1] [,2]
@@ -18061,6 +18237,15 @@ Error in expm1() : 0 arguments passed to 'expm1' which requires 1
 #{ expm1(c(1,2,3)) }
 [1]  1.718282  6.389056 19.085537
 
+##com.oracle.truffle.r.test.builtins.TestBuiltin_expm1.testTrigExp
+#{ round( expm1(1+2i), digits=5 ) }
+Error in expm1(1 + (0+2i)) : unimplemented complex function
+
+##com.oracle.truffle.r.test.builtins.TestBuiltin_expm1.testTrigExp
+#{ round( expm1(c(1+1i,-2-3i)), digits=5 ) }
+Error in expm1(c(1 + (0+1i), -2 - (0+3i))) :
+  unimplemented complex function
+
 ##com.oracle.truffle.r.test.builtins.TestBuiltin_expm1.testexpm11
 #argv <- list(-0.518798300715899);expm1(argv[[1]]);
 [1] -0.4047646
@@ -41732,6 +41917,10 @@ attr(,"class")
 #{ sin() }
 Error in sin() : 0 arguments passed to 'sin' which requires 1
 
+##com.oracle.truffle.r.test.builtins.TestBuiltin_sin.testTrigExp
+#{ sin(1+1i) }
+[1] 1.298458+0.634964i
+
 ##com.oracle.truffle.r.test.builtins.TestBuiltin_sin.testTrigExp
 #{ sin(1.2) }
 [1] 0.9320391
@@ -41915,6 +42104,43 @@ In sin(argv[[1]]) : NaNs produced
 [191]   7.62339494   7.85871560   8.10118091   8.35101131   8.60843391
 [196]   8.87368276   9.14699900   9.42863112   9.71883515  10.01787493
 
+##com.oracle.truffle.r.test.builtins.TestBuiltin_sinh.testsinh3
+#argv <- list(c(-0.560475646552213-0.710406563699301i, -0.23017748948328+0.25688370915653i, 1.55870831414912-0.24669187846237i, 0.070508391424576-0.347542599397733i, 0.129287735160946-0.951618567265016i, 1.71506498688328-0.04502772480892i, 0.460916205989202-0.784904469457076i, -1.26506123460653-1.66794193658814i, -0.686852851893526-0.380226520287762i, -0.445661970099958+0.918996609060766i, 1.22408179743946-0.57534696260839i, 0.359813827057364+0.607964322225033i, 0.40077145059405-1.61788270828916i, 0.11068271594512-0.055561965524539i, -0.555841134754075+0.519407203943462i, 1.78691313680308+0.30115336216671i, 0.497850478229239+0.105676194148943i, -1.96661715662964-0.64070600830538i, 0.701355901563686-0.849704346033582i, -0.47279140772793-1.02412879060491i, -1.06782370598685+0.11764659710013i, -0.217974914658295-0.947474614184802i, -1.02600444830724-0.49055744370067i, -0.72889122929114-0.256092192198247i, -0.62503926784926+1.84386200523221i, -1.68669331074241-0.65194990169546i, 0.837787044494525+0.235386572284857i, 0.153373117836515+0.077960849563711i, -1.13813693701195-0.96185663413013i, 1.25381492106993-0.0713080861236i, 0.42646422147681+1.44455085842335i, -0.295071482992271+0.451504053079215i, 0.895125661045022+0.04123292199294i, 0.878133487533042-0.422496832339625i, 0.82158108163749-2.05324722154052i, 0.68864025410009+1.13133721341418i, 0.55391765353759-1.46064007092482i, -0.061911710576722+0.739947510877334i, -0.30596266373992+1.90910356921748i, -0.38047100101238-1.4438931609718i, -0.694706978920513+0.701784335374711i, -0.207917278019599-0.262197489402468i, -1.26539635156826-1.57214415914549i, 2.16895596533851-1.51466765378175i, 1.20796199830499-1.60153617357459i, -1.12310858320335-0.5309065221703i, -0.40288483529908-1.4617555849959i, -0.466655353623219+0.687916772975828i, 0.77996511833632+2.10010894052567i, -0.08336906647183-1.28703047603518i, 0.253318513994755+0.787738847475178i, -0.028546755348703+0.76904224100091i, -0.042870457291316+0.332202578950118i, 1.36860228401446-1.00837660827701i, -0.225770985659268-0.119452606630659i, 1.51647060442954-0.28039533517025i, -1.54875280423022+0.56298953322048i, 0.584613749636069-0.372438756103829i, 0.123854243844614+0.976973386685621i, 0.215941568743973-0.374580857767014i, 0.37963948275988+1.05271146557933i, -0.5023234531093-1.04917700666607i, -0.33320738366942-1.26015524475811i, -1.01857538310709+3.2410399349424i, -1.07179122647558-0.41685758816043i, 0.303528641404258+0.298227591540715i, 0.448209778629426+0.636569674033849i, 0.053004226730504-0.483780625708744i, 0.922267467879738+0.516862044313609i, 2.05008468562714+0.36896452738509i, -0.491031166056535-0.215380507641693i, -2.30916887564081+0.06529303352532i, 1.00573852446226-0.03406725373846i, -0.70920076258239+2.12845189901618i, -0.688008616467358-0.741336096272828i, 1.0255713696967-1.09599626707466i, -0.284773007051009+0.037788399171079i, -1.22071771225454+0.31048074944314i, 0.18130347974915+0.436523478910183i, -0.138891362439045-0.458365332711106i, 0.00576418589989-1.06332613397119i, 0.38528040112633+1.26318517608949i, -0.370660031792409-0.349650387953555i, 0.644376548518833-0.865512862653374i, -0.220486561818751-0.236279568941097i, 0.331781963915697-0.197175894348552i, 1.09683901314935+1.10992028971364i, 0.435181490833803+0.084737292197196i, -0.325931585531227+0.754053785184521i, 1.14880761845109-0.49929201717226i, 0.993503855962119+0.214445309581601i, 0.54839695950807-0.324685911490835i, 0.238731735111441+0.094583528173571i, -0.627906076039371-0.895363357977542i, 1.36065244853001-1.31080153332797i, -0.60025958714713+1.99721338474797i, 2.18733299301658+0.60070882367242i, 1.53261062618519-1.25127136162494i, -0.235700359100477-0.611165916680421i, -1.02642090030678-1.18548008459731i));sinh(argv[[1]]);
+  [1] -0.4474924-0.7572813i -0.2245956+0.2608280i  2.2023780-0.6059862i
+  [4]  0.0663478-0.3414353i  0.0752434-0.8211715i  2.6858173-0.1291181i
+  [7]  0.3377466-0.7831692i  0.1581511-1.9037473i -0.6891432-0.4621707i
+ [10] -0.2793851+0.8752574i  1.3033980-1.0052915i  0.3017538+0.6085737i
+ [13] -0.0193730-1.0801910i  0.1107377-0.0558739i -0.5077671+0.5750387i
+ [16]  2.7711644+0.9104020i  0.5157792+0.1188237i -2.8084765-2.1777619i
+ [19]  0.5019450-0.9435123i -0.2550369-0.9515307i -1.2737768+0.1908992i
+ [22] -0.1282497-0.8313094i -1.0723595-0.7416176i -0.7692361-0.3236219i
+ [25]  0.1797556+1.1572523i -2.0732875-1.6948365i  0.9133882+0.3199663i
+ [28]  0.1535074+0.0787997i -0.8009497-1.4113979i  1.6050456-0.1349822i
+ [31]  0.0553388+1.0836294i -0.2693725+0.4554521i  1.0186770+0.0588680i
+ [34]  0.9078935-0.5785572i -0.4255265-1.2020367i  0.3166939+1.1281799i
+ [37]  0.0640563-1.1503604i -0.0457513+0.6755418i  0.1031380+0.9878168i
+ [40] -0.0493237-1.0646259i -0.5742583+0.8077330i -0.2022612-0.2648264i
+ [43]  0.0021986-1.9133107i  0.2422041-4.4247418i -0.0468379-1.8218703i
+ [46] -1.1853537-0.8606508i -0.0450396-1.0758342i -0.3737524+0.7053262i
+ [49] -0.4349994+1.1392853i -0.0233681-0.9633461i  0.1806209+0.7316225i
+ [52] -0.0205158+0.6957307i -0.0405390+0.3264257i  0.9799233-1.7698975i
+ [55] -0.2260714-0.1222188i  2.0836345-0.6607894i -1.8998186+1.3124389i
+ [58]  0.5760865-0.4278630i  0.0694779+0.8351727i  0.2025339-0.3744464i
+ [61]  0.1925527+0.9321309i -0.2609601-0.9787192i -0.1037464-1.0054852i
+ [64]  1.1981198-0.1553963i -1.1787142-0.6605768i  0.2946060+0.3074658i
+ [67]  0.3726127+0.6551560i  0.0469436-0.4657828i  0.9203934+0.7196380i
+ [70]  3.5628420+1.4240769i -0.4991960-0.2400061i -4.9727369+0.3316291i
+ [73]  1.1833886-0.0527889i  0.4075698+1.0709758i -0.5484450-0.8415011i
+ [76]  0.5554723-1.3995704i -0.2884316+0.0393217i -1.4733192+0.5628587i
+ [79]  0.1652037+0.4297593i -0.1249554-0.4467576i  0.0028012-0.8739912i
+ [82]  0.1195639+1.0246755i -0.3562612-0.3663726i  0.4472305-0.9250544i
+ [85] -0.2161015-0.2398003i  0.3313553-0.2067823i  0.5916638+1.4906567i
+ [88]  0.4474369+0.0927775i -0.2418067+0.7212853i  1.2455141-0.8310708i
+ [91]  1.1385124+0.3267583i  0.5461895-0.3681950i  0.2399287+0.0971466i
+ [94] -0.4188998-0.9394078i  0.4681657-2.0077889i  0.2634544+1.0794615i
+ [97]  3.6293844+2.5502013i  0.6932968-2.3004637i -0.1948261-0.5898359i
+[100] -0.4571813-1.4592171i
+
 ##com.oracle.truffle.r.test.builtins.TestBuiltin_sink.testsink1
 #argv <- list(structure(2L, class = c('terminal', 'connection')), FALSE, TRUE, FALSE); .Internal(sink(argv[[1]], argv[[2]], argv[[3]], argv[[4]]))
 
@@ -41927,6 +42153,112 @@ no sink to remove
 #argv <- list(FALSE); .Internal(sink.number(argv[[1]]))
 [1] 2
 
+##com.oracle.truffle.r.test.builtins.TestBuiltin_sinpi.testTrigExp
+#{ sinpi() }
+Error in sinpi() : 0 arguments passed to 'sinpi' which requires 1
+
+##com.oracle.truffle.r.test.builtins.TestBuiltin_sinpi.testTrigExp
+#{ sinpi(1.2) }
+[1] -0.5877853
+
+##com.oracle.truffle.r.test.builtins.TestBuiltin_sinpi.testTrigExp
+#{ sinpi(c(0,0.5,-0.5,1,-1,1.5,-1.5)) }
+[1]  0  1 -1  0  0 -1  1
+
+##com.oracle.truffle.r.test.builtins.TestBuiltin_sinpi.testTrigExp
+#{ sinpi(c(0.3,0.6,0.9)) }
+[1] 0.8090170 0.9510565 0.3090170
+
+##com.oracle.truffle.r.test.builtins.TestBuiltin_sinpi.testsin1
+#argv <- list(c(-6.28318530717959, -6.1261056745001, -5.96902604182061, -5.81194640914112, -5.65486677646163, -5.49778714378214, -5.34070751110265, -5.18362787842316, -5.02654824574367, -4.86946861306418, -4.71238898038469, -4.5553093477052, -4.39822971502571, -4.24115008234622, -4.08407044966673, -3.92699081698724, -3.76991118430775, -3.61283155162826, -3.45575191894877, -3.29867228626928, -3.14159265358979, -2.9845130209103, -2.82743338823081, -2.67035375555132, -2.51327412287183, -2.35619449019234, -2.19911485751286, -2.04203522483337, -1.88495559215388, -1.72787595947439, -1.5707963267949, -1.41371669411541, -1.25663706143592, -1.09955742875643, -0.942477796076938, -0.785398163397448, -0.628318530717959, -0.471238898038469, -0.314159265358979, -0.15707963267949, 0, 0.15707963267949, 0.314159265358979, 0.471238898038469, 0.628318530717959, 0.785398163397448, 0.942477796076938, 1.09955742875643, 1.25663706143592, 1.41371669411541, 1.5707963267949, 1.72787595947439, 1.88495559215388, 2.04203522483337, 2.19911485751286, 2.35619449019234, 2.51327412287183, 2.67035375555133, 2.82743338823081, 2.9845130209103, 3.14159265358979, 3.29867228626928, 3.45575191894877, 3.61283155162826, 3.76991118430775, 3.92699081698724, 4.08407044966673, 4.24115008234622, 4.39822971502571, 4.5553093477052, 4.71238898038469, 4.86946861306418, 5.02654824574367, 5.18362787842316, 5.34070751110265, 5.49778714378214, 5.65486677646163, 5.81194640914112, 5.96902604182061, 6.1261056745001, 6.28318530717959, 6.44026493985908, 6.59734457253857, 6.75442420521805, 6.91150383789754, 7.06858347057704, 7.22566310325652, 7.38274273593601, 7.5398223686155, 7.69690200129499, 7.85398163397448, 8.01106126665397, 8.16814089933346, 8.32522053201295, 8.48230016469244, 8.63937979737193, 8.79645943005142, 8.95353906273091, 9.1106186954104, 9.26769832808989, 9.42477796076938));sinpi(argv[[1]]);
+  [1] -0.77685322 -0.38589029  0.09715407  0.55701545  0.88396140  0.99997584
+  [7]  0.87737531  0.54541486  0.08330711 -0.39867944 -0.78553281 -0.98494177
+ [13] -0.94932321 -0.68717646 -0.26105516  0.22735931  0.66152114  0.93783031
+ [19]  0.99035374  0.80655823  0.43030122 -0.04863459 -0.51596517 -0.86017577
+ [25] -0.99913060 -0.89967217 -0.58553330 -0.13167406  0.35360535  0.75450718
+ [31]  0.97536797  0.96348575  0.72169585  0.30769437 -0.17972937 -0.62426595
+ [37] -0.91983974 -0.99592070 -0.83435434 -0.47369374  0.00000000  0.47369374
+ [43]  0.83435434  0.99592070  0.91983974  0.62426595  0.17972937 -0.30769437
+ [49] -0.72169585 -0.96348575 -0.97536797 -0.75450718 -0.35360535  0.13167406
+ [55]  0.58553330  0.89967217  0.99913060  0.86017577  0.51596517  0.04863459
+ [61] -0.43030122 -0.80655823 -0.99035374 -0.93783031 -0.66152114 -0.22735931
+ [67]  0.26105516  0.68717646  0.94932321  0.98494177  0.78553281  0.39867944
+ [73] -0.08330711 -0.54541486 -0.87737531 -0.99997584 -0.88396140 -0.55701545
+ [79] -0.09715407  0.38589029  0.77685322  0.98244287  0.95360130  0.69721069
+ [85]  0.27445115 -0.21379811 -0.65103072 -0.93291390 -0.99218449 -0.81469930
+ [91] -0.44280997  0.03474300  0.50400557  0.85300196  0.99845440  0.90565493
+ [97]  0.59674743  0.14544361 -0.34056606 -0.74530961 -0.97220684
+
+##com.oracle.truffle.r.test.builtins.TestBuiltin_sinpi.testsin2
+#argv <- list(c(0.0156298141969641, 0.0312596283939283, 0.0468894425908924, 0.0625192567878566, 0.0781490709848207, 0.0937788851817849, 0.109408699378749, 0.125038513575713, 0.140668327772677, 0.156298141969641, 0.171927956166606, 0.18755777036357, 0.203187584560534, 0.218817398757498, 0.234447212954462, 0.250077027151426, 0.26570684134839, 0.281336655545355, 0.296966469742319, 0.312596283939283, 0.328226098136247, 0.343855912333211, 0.359485726530175, 0.375115540727139, 0.390745354924104, 0.406375169121068, 0.422004983318032, 0.437634797514996, 0.45326461171196, 0.468894425908924, 0.484524240105888, 0.500154054302853, 0.515783868499817, 0.531413682696781, 0.547043496893745, 0.562673311090709, 0.578303125287673, 0.593932939484637, 0.609562753681602, 0.625192567878566, 0.64082238207553, 0.656452196272494, 0.672082010469458, 0.687711824666422, 0.703341638863387, 0.718971453060351, 0.734601267257315, 0.750231081454279, 0.765860895651243, 0.781490709848207, 0.797120524045171, 0.812750338242136, 0.8283801524391, 0.844009966636064, 0.859639780833028, 0.875269595029992, 0.890899409226956, 0.90652922342392, 0.922159037620885, 0.937788851817849, 0.953418666014813, 0.969048480211777, 0.984678294408741, 1.00030810860571, 1.01593792280267, 1.03156773699963, 1.0471975511966, 1.06282736539356, 1.07845717959053, 1.09408699378749, 1.10971680798445, 1.12534662218142, 1.14097643637838, 1.15660625057535, 1.17223606477231, 1.18786587896927, 1.20349569316624, 1.2191255073632, 1.23475532156017, 1.25038513575713, 1.2660149499541, 1.28164476415106, 1.29727457834802, 1.31290439254499, 1.32853420674195, 1.34416402093892, 1.35979383513588, 1.37542364933284, 1.39105346352981, 1.40668327772677, 1.42231309192374, 1.4379429061207, 1.45357272031767, 1.46920253451463, 1.48483234871159, 1.50046216290856, 1.51609197710552, 1.53172179130249, 1.54735160549945, 1.56298141969641));sinpi(argv[[1]]);
+  [1]  0.0490827803  0.0980472431  0.1467753560  0.1951496562  0.2430535342
+  [6]  0.2903715141  0.3369895325  0.3827952134  0.4276781389  0.4715301154
+ [11]  0.5142454346  0.5557211281  0.5958572158  0.6345569467  0.6717270325
+ [16]  0.7072778718  0.7411237668  0.7731831297  0.8033786789  0.8316376259
+ [21]  0.8578918505  0.8820780650  0.9041379667  0.9240183788  0.9416713780
+ [26]  0.9570544105  0.9701303944  0.9808678091  0.9892407713  0.9952290973
+ [31]  0.9988183519  0.9999998829  0.9987708421  0.9951341923  0.9890986998
+ [36]  0.9806789136  0.9698951303  0.9567733449  0.9413451884  0.9236478515
+ [41]  0.9037239950  0.8816216466  0.8573940857  0.8310997147  0.8028019179
+ [46]  0.7725689092  0.7404735675  0.7065932610  0.6710096605  0.6338085428
+ [51]  0.5950795840  0.5549161430  0.5134150367  0.4706763064  0.4268029770
+ [56]  0.3819008083  0.3360780401  0.2894451316  0.2421144948  0.1942002236
+ [61]  0.1458178187  0.0970839094  0.0481159724 -0.0009679516 -0.0500495423
+ [66] -0.0990104849 -0.1477327557 -0.1960989060 -0.2439923458 -0.2912976244
+ [71] -0.3379007092 -0.3836892599 -0.4285529000 -0.4723834825 -0.5150753506
+ [76] -0.5565255925 -0.5966342893 -0.6353047561 -0.6724437751 -0.7079618199
+ [81] -0.7417732718 -0.7737966257 -0.8039546872 -0.8321747579 -0.8583888114
+ [86] -0.8825336569 -0.9045510914 -0.9243880403 -0.9419966853 -0.9573345794
+ [91] -0.9703647495 -0.9810557855 -0.9893819159 -0.9953230698 -0.9988649258
+ [96] -0.9999989460 -0.9987223966 -0.9950383549 -0.9889557016 -0.9804890994
+
+##com.oracle.truffle.r.test.builtins.TestBuiltin_sinpi.testsin3
+#argv <- list(c(0.560475646552213, 0.23017748948328, -1.55870831414912, -0.070508391424576, -0.129287735160946, -1.71506498688328, -0.460916205989202, 1.26506123460653, 0.686852851893526, 0.445661970099958, -1.22408179743946, -0.359813827057364, -0.400771450594052, -0.11068271594512, 0.555841134754075, -1.78691313680308, -0.497850478229239, 1.96661715662964, -0.701355901563686, 0.472791407727934, 1.06782370598685, 0.217974914658295, 1.02600444830724, 0.72889122929114, 0.625039267849257, 1.68669331074241, -0.837787044494525, -0.153373117836515, 1.13813693701195, -1.25381492106993, -0.426464221476814, 0.295071482992271, -0.895125661045022, -0.878133487533042, -0.821581081637487, -0.688640254100091, -0.553917653537589, 0.0619117105767217, 0.305962663739917, 0.380471001012383, 0.694706978920513, 0.207917278019599, 1.26539635156826, -2.16895596533851, -1.20796199830499, 1.12310858320335, 0.402884835299076, 0.466655353623219, -0.779965118336318, 0.0833690664718293, -0.253318513994755, 0.028546755348703, 0.0428704572913161, -1.36860228401446, 0.225770985659268, -1.51647060442954, 1.54875280423022, -0.584613749636069, -0.123854243844614, -0.215941568743973, -0.379639482759882, 0.502323453109302, 0.33320738366942, 1.01857538310709, 1.07179122647558, -0.303528641404258, -0.448209778629426, -0.0530042267305041, -0.922267467879738, -2.05008468562714, 0.491031166056535, 2.30916887564081, -1.00573852446226, 0.709200762582393, 0.688008616467358, -1.0255713696967, 0.284773007051009, 1.22071771225454, -0.18130347974915, 0.138891362439045, -0.00576418589988693, -0.38528040112633, 0.370660031792409, -0.644376548518833, 0.220486561818751, -0.331781963915697, -1.09683901314935, -0.435181490833803, 0.325931585531227, -1.14880761845109, -0.993503855962119, -0.54839695950807, -0.238731735111441, 0.627906076039371, -1.36065244853001, 0.600259587147127, -2.18733299301658, -1.53261062618519, 0.235700359100477));sinpi(argv[[1]]);
+ [1]  0.98200615  0.66173002  0.98303955 -0.21970166 -0.39509329  0.78030274
+ [7] -0.99247134 -0.73976055  0.83259741  0.98546475  0.64725187 -0.90457787
+[13] -0.95180265 -0.34075516  0.98465156  0.62054077 -0.99997720 -0.10468315
+[19] -0.80650588  0.99634895 -0.21146582  0.63250912 -0.08160454  0.75241007
+[25]  0.92383232 -0.83287492 -0.48783425 -0.46340680 -0.42047609  0.71553042
+[31] -0.97343347  0.79981947 -0.32354390 -0.37357024 -0.53162633 -0.82947411
+[37] -0.98568824  0.19327734  0.81988496  0.93032018  0.81867869  0.60772394
+[43] -0.74046854 -0.50621551  0.60783550 -0.37718696  0.95381803  0.99451818
+[49] -0.63750842  0.25892748 -0.71444011  0.08956211  0.13427472  0.91600189
+[55]  0.65128794  0.99866158 -0.98829370 -0.96487690 -0.37935546 -0.62754845
+[61] -0.92935895  0.99997336  0.86582749 -0.05832317 -0.22363154 -0.81548308
+[67] -0.98679291 -0.16574922 -0.24178397 -0.15669723  0.99960307  0.82561013
+[73]  0.01802713  0.79169146  0.83058082  0.08024845  0.77998434 -0.63915969
+[79] -0.53927982  0.42262530 -0.01810773 -0.93575505  0.91857616 -0.89888753
+[85]  0.63860103 -0.86357824  0.29955741 -0.97933827  0.85416569  0.45064963
+[91] -0.02040682 -0.98846363 -0.68163720  0.92034729  0.90569788  0.95080419
+[97] -0.55513391  0.99475666  0.67463825
+
+##com.oracle.truffle.r.test.builtins.TestBuiltin_sinpi.testsin4
+#argv <- list(c(-1.88495559215388, 0.628318530717959, -2.51327412287183, 5.02654824574367, 0.942477796076938, -2.51327412287183, 1.5707963267949, 2.19911485751286, 1.88495559215388, -0.942477796076938, 4.71238898038469, 1.25663706143592, -1.88495559215388, -6.91150383789755, 3.45575191894877, 0, 0, 2.82743338823081, 2.51327412287183, 1.88495559215388, 2.82743338823081, 2.51327412287183, 0.314159265358979, -6.28318530717959, 1.88495559215388, -0.314159265358979, -0.628318530717959, -4.71238898038469, -1.5707963267949, 1.25663706143592));sinpi(argv[[1]]);
+ [1]  0.35360535  0.91983974 -0.99913060 -0.08330711  0.17972937 -0.99913060
+ [7] -0.97536797  0.58553330 -0.35360535 -0.17972937  0.78553281 -0.72169585
+[13]  0.35360535 -0.27445115 -0.99035374  0.00000000  0.00000000  0.51596517
+[19]  0.99913060 -0.35360535  0.51596517  0.99913060  0.83435434 -0.77685322
+[25] -0.35360535 -0.83435434 -0.91983974 -0.78553281  0.97536797 -0.72169585
+
+##com.oracle.truffle.r.test.builtins.TestBuiltin_sinpi.testsin5
+#argv <- list(structure(c(-0.416146836547142, -0.989992496600445, -0.653643620863612, 0.283662185463226, 0.960170286650366, -0.416146836547142, 0.283662185463226, -0.839071529076452, -0.275163338051597, 0.64691932232864, 0.283662185463226, -0.759687912858821, 0.914742357804531, -0.918282786212119, 0.776685982021631), .Dim = c(5L, 3L)));sinpi(argv[[1]]);
+            [,1]       [,2]       [,3]
+[1,] -0.96550186 -0.9655019  0.7777957
+[2,] -0.03143432  0.7777957 -0.6852615
+[3,] -0.88575154 -0.4843077  0.2646537
+[4,]  0.77779571 -0.7607391 -0.2539115
+[5,]  0.12480246  0.8953586  0.6454113
+
+##com.oracle.truffle.r.test.builtins.TestBuiltin_sinpi.testsin6
+#argv <- list(c(-0.560475646552213-0.710406563699301i, -0.23017748948328+0.25688370915653i, 1.55870831414912-0.24669187846237i, 0.070508391424576-0.347542599397733i, 0.129287735160946-0.951618567265016i, 1.71506498688328-0.04502772480892i, 0.460916205989202-0.784904469457076i, -1.26506123460653-1.66794193658814i, -0.686852851893526-0.380226520287762i, -0.445661970099958+0.918996609060766i, 1.22408179743946-0.57534696260839i, 0.359813827057364+0.607964322225033i, 0.40077145059405-1.61788270828916i, 0.11068271594512-0.055561965524539i, -0.555841134754075+0.519407203943462i, 1.78691313680308+0.30115336216671i, 0.497850478229239+0.105676194148943i, -1.96661715662964-0.64070600830538i, 0.701355901563686-0.849704346033582i, -0.47279140772793-1.02412879060491i, -1.06782370598685+0.11764659710013i, -0.217974914658295-0.947474614184802i, -1.02600444830724-0.49055744370067i, -0.72889122929114-0.256092192198247i, -0.62503926784926+1.84386200523221i, -1.68669331074241-0.65194990169546i, 0.837787044494525+0.235386572284857i, 0.153373117836515+0.077960849563711i, -1.13813693701195-0.96185663413013i, 1.25381492106993-0.0713080861236i, 0.42646422147681+1.44455085842335i, -0.295071482992271+0.451504053079215i, 0.895125661045022+0.04123292199294i, 0.878133487533042-0.422496832339625i, 0.82158108163749-2.05324722154052i, 0.68864025410009+1.13133721341418i, 0.55391765353759-1.46064007092482i, -0.061911710576722+0.739947510877334i, -0.30596266373992+1.90910356921748i, -0.38047100101238-1.4438931609718i, -0.694706978920513+0.701784335374711i, -0.207917278019599-0.262197489402468i, -1.26539635156826-1.57214415914549i, 2.16895596533851-1.51466765378175i, 1.20796199830499-1.60153617357459i, -1.12310858320335-0.5309065221703i, -0.40288483529908-1.4617555849959i, -0.466655353623219+0.687916772975828i, 0.77996511833632+2.10010894052567i, -0.08336906647183-1.28703047603518i, 0.253318513994755+0.787738847475178i, -0.028546755348703+0.76904224100091i, -0.042870457291316+0.332202578950118i, 1.36860228401446-1.00837660827701i, -0.225770985659268-0.119452606630659i, 1.51647060442954-0.28039533517025i, -1.54875280423022+0.56298953322048i, 0.584613749636069-0.372438756103829i, 0.123854243844614+0.976973386685621i, 0.215941568743973-0.374580857767014i, 0.37963948275988+1.05271146557933i, -0.5023234531093-1.04917700666607i, -0.33320738366942-1.26015524475811i, -1.01857538310709+3.2410399349424i, -1.07179122647558-0.41685758816043i, 0.303528641404258+0.298227591540715i, 0.448209778629426+0.636569674033849i, 0.053004226730504-0.483780625708744i, 0.922267467879738+0.516862044313609i, 2.05008468562714+0.36896452738509i, -0.491031166056535-0.215380507641693i, -2.30916887564081+0.06529303352532i, 1.00573852446226-0.03406725373846i, -0.70920076258239+2.12845189901618i, -0.688008616467358-0.741336096272828i, 1.0255713696967-1.09599626707466i, -0.284773007051009+0.037788399171079i, -1.22071771225454+0.31048074944314i, 0.18130347974915+0.436523478910183i, -0.138891362439045-0.458365332711106i, 0.00576418589989-1.06332613397119i, 0.38528040112633+1.26318517608949i, -0.370660031792409-0.349650387953555i, 0.644376548518833-0.865512862653374i, -0.220486561818751-0.236279568941097i, 0.331781963915697-0.197175894348552i, 1.09683901314935+1.10992028971364i, 0.435181490833803+0.084737292197196i, -0.325931585531227+0.754053785184521i, 1.14880761845109-0.49929201717226i, 0.993503855962119+0.214445309581601i, 0.54839695950807-0.324685911490835i, 0.238731735111441+0.094583528173571i, -0.627906076039371-0.895363357977542i, 1.36065244853001-1.31080153332797i, -0.60025958714713+1.99721338474797i, 2.18733299301658+0.60070882367242i, 1.53261062618519-1.25127136162494i, -0.235700359100477-0.611165916680421i, -1.02642090030678-1.18548008459731i));sinpi(argv[[1]]);
+Error in sinpi(argv[[1]]) : unimplemented complex function
+
+##com.oracle.truffle.r.test.builtins.TestBuiltin_sinpi.testsin7
+#argv <- list(Inf);sinpi(argv[[1]]);
+[1] NaN
+Warning message:
+In sinpi(argv[[1]]) : NaNs produced
+
 ##com.oracle.truffle.r.test.builtins.TestBuiltin_solve.testsolve1
 #argv <- structure(list(a = structure(c(1, 0.5, 0, 0, 0, 0.5,     1, 0.5, 0, 0, 0, 0.5, 1, 0.5, 0, 0, 0, 0.5, 1, 0.5, 0, 0,     0, 0.5, 1), .Dim = c(5L, 5L))), .Names = 'a');do.call('solve', argv)
            [,1]       [,2] [,3]       [,4]       [,5]
@@ -45735,6 +46067,158 @@ In tan(argv[[1]]) : NaNs produced
 [25]  0.49725003  0.58648566  0.50589219  0.11174983 -0.03915662  0.24208894
 [31] -0.03106293  0.09997035  0.36755692  0.33451157  0.08984066 -0.12782379
 
+##com.oracle.truffle.r.test.builtins.TestBuiltin_tanh.testtanh4
+#argv <- list(c(-0.560475646552213-0.710406563699301i, -0.23017748948328+0.25688370915653i, 1.55870831414912-0.24669187846237i, 0.070508391424576-0.347542599397733i, 0.129287735160946-0.951618567265016i, 1.71506498688328-0.04502772480892i, 0.460916205989202-0.784904469457076i, -1.26506123460653-1.66794193658814i, -0.686852851893526-0.380226520287762i, -0.445661970099958+0.918996609060766i, 1.22408179743946-0.57534696260839i, 0.359813827057364+0.607964322225033i, 0.40077145059405-1.61788270828916i, 0.11068271594512-0.055561965524539i, -0.555841134754075+0.519407203943462i, 1.78691313680308+0.30115336216671i, 0.497850478229239+0.105676194148943i, -1.96661715662964-0.64070600830538i, 0.701355901563686-0.849704346033582i, -0.47279140772793-1.02412879060491i, -1.06782370598685+0.11764659710013i, -0.217974914658295-0.947474614184802i, -1.02600444830724-0.49055744370067i, -0.72889122929114-0.256092192198247i, -0.62503926784926+1.84386200523221i, -1.68669331074241-0.65194990169546i, 0.837787044494525+0.235386572284857i, 0.153373117836515+0.077960849563711i, -1.13813693701195-0.96185663413013i, 1.25381492106993-0.0713080861236i, 0.42646422147681+1.44455085842335i, -0.295071482992271+0.451504053079215i, 0.895125661045022+0.04123292199294i, 0.878133487533042-0.422496832339625i, 0.82158108163749-2.05324722154052i, 0.68864025410009+1.13133721341418i, 0.55391765353759-1.46064007092482i, -0.061911710576722+0.739947510877334i, -0.30596266373992+1.90910356921748i, -0.38047100101238-1.4438931609718i, -0.694706978920513+0.701784335374711i, -0.207917278019599-0.262197489402468i, -1.26539635156826-1.57214415914549i, 2.16895596533851-1.51466765378175i, 1.20796199830499-1.60153617357459i, -1.12310858320335-0.5309065221703i, -0.40288483529908-1.4617555849959i, -0.466655353623219+0.687916772975828i, 0.77996511833632+2.10010894052567i, -0.08336906647183-1.28703047603518i, 0.253318513994755+0.787738847475178i, -0.028546755348703+0.76904224100091i, -0.042870457291316+0.332202578950118i, 1.36860228401446-1.00837660827701i, -0.225770985659268-0.119452606630659i, 1.51647060442954-0.28039533517025i, -1.54875280423022+0.56298953322048i, 0.584613749636069-0.372438756103829i, 0.123854243844614+0.976973386685621i, 0.215941568743973-0.374580857767014i, 0.37963948275988+1.05271146557933i, -0.5023234531093-1.04917700666607i, -0.33320738366942-1.26015524475811i, -1.01857538310709+3.2410399349424i, -1.07179122647558-0.41685758816043i, 0.303528641404258+0.298227591540715i, 0.448209778629426+0.636569674033849i, 0.053004226730504-0.483780625708744i, 0.922267467879738+0.516862044313609i, 2.05008468562714+0.36896452738509i, -0.491031166056535-0.215380507641693i, -2.30916887564081+0.06529303352532i, 1.00573852446226-0.03406725373846i, -0.70920076258239+2.12845189901618i, -0.688008616467358-0.741336096272828i, 1.0255713696967-1.09599626707466i, -0.284773007051009+0.037788399171079i, -1.22071771225454+0.31048074944314i, 0.18130347974915+0.436523478910183i, -0.138891362439045-0.458365332711106i, 0.00576418589989-1.06332613397119i, 0.38528040112633+1.26318517608949i, -0.370660031792409-0.349650387953555i, 0.644376548518833-0.865512862653374i, -0.220486561818751-0.236279568941097i, 0.331781963915697-0.197175894348552i, 1.09683901314935+1.10992028971364i, 0.435181490833803+0.084737292197196i, -0.325931585531227+0.754053785184521i, 1.14880761845109-0.49929201717226i, 0.993503855962119+0.214445309581601i, 0.54839695950807-0.324685911490835i, 0.238731735111441+0.094583528173571i, -0.627906076039371-0.895363357977542i, 1.36065244853001-1.31080153332797i, -0.60025958714713+1.99721338474797i, 2.18733299301658+0.60070882367242i, 1.53261062618519-1.25127136162494i, -0.235700359100477-0.611165916680421i, -1.02642090030678-1.18548008459731i));tanh(argv[[1]]);
+  [1] -0.7425158-0.5355457i -0.2409547+0.2483702i  0.9241602-0.0388304i
+  [4]  0.0795770-0.3602170i  0.3696862-1.3364822i  0.9374969-0.0054663i
+  [7]  0.7262706-0.6864223i -1.1689483+0.0361817i -0.6540480-0.2438883i
+ [10] -0.8740881+0.8313312i  0.9207159-0.1464479i  0.4842275+0.5796214i
+ [13]  2.5934516+0.2739606i  0.1105698-0.0549413i -0.6184095+0.3932521i
+ [16]  0.9543474+0.0303543i  0.4644974+0.0833863i -0.9881948-0.0371033i
+ [19]  0.9419714-0.4890693i -1.0695525-0.8691667i -0.7927689+0.0442974i
+ [22] -0.5782396-1.2183528i -0.8482805-0.1841978i -0.6478522-0.1562632i
+ [25] -1.5493740-0.5023022i -0.9799581-0.0648708i  0.7050075+0.1240718i
+ [28]  0.1530888+0.0762992i -1.0530983-0.2050695i  0.8505528-0.0198275i
+ [31]  2.2968217+0.5975852i -0.3475117+0.4365828i  0.7145115+0.0202114i
+ [34]  0.7705579-0.2051771i  1.1780131+0.3890291i  1.2623594+0.5237715i
+ [37]  1.9180186-0.3107690i -0.1130136+0.9066133i -1.5741787-1.5144869i
+ [40] -2.4912001-0.7477482i -0.8190619+0.4292196i -0.2190725-0.2563248i
+ [43] -1.1729578+0.0005066i  1.0263001-0.0030043i  1.1955899+0.0132228i
+ [46] -0.8873771-0.1658215i -2.4458589-0.5907083i -0.6467833+0.5903525i
+ [49]  1.1403637-0.4370981i -0.9813076-3.1490567i  0.4692629+0.8877523i
+ [52] -0.0552282+0.9662863i -0.0479329+0.3442792i  1.0500579-0.1232018i
+ [55] -0.2250500-0.1140272i  0.9204438-0.0472760i -0.9587429+0.0783299i
+ [58]  0.5817268-0.2711281i  0.3809015+1.4117228i  0.2438094-0.3727600i
+ [61]  1.0523631+1.0852739i -1.1313236-0.8267259i -1.7179811-1.3949940i
+ [64] -0.7723935+0.0404901i -0.8419919-0.1482137i  0.3197488+0.2784453i
+ [67]  0.5929015+0.5549577i  0.0675217-0.5235469i  0.8215623+0.2289243i
+ [70]  0.9755385+0.0217556i -0.4721344-0.1717731i -0.9806161+0.0025207i
+ [73]  0.7643628-0.0141785i -1.1132595-0.5142254i -0.8447513-0.4540504i
+ [76]  1.1345191-0.2412521i -0.2776827+0.0348951i -0.8636156+0.0881328i
+ [79]  0.2168603+0.4483956i -0.1708115-0.4817833i  0.0244046-1.7981721i
+ [82]  1.7146144+1.1654205i -0.3951069-0.3135500i  0.9352432-0.5507671i
+ [85] -0.2289361-0.2288164i  0.3315407-0.1785692i  1.1252528+0.2024350i
+ [88]  0.4120990+0.0706016i -0.5449420+0.7780491i  0.8846782-0.1510171i
+ [91]  0.7737138+0.0899197i  0.5406186-0.2457366i  0.2362893+0.0896146i
+ [94] -0.9602986-0.5810371i  1.1185541-0.0734458i -1.3093074-0.6528741i
+ [97]  0.9906765+0.0232708i  1.0760563-0.0600018i -0.3362039-0.6461392i
+[100] -1.1817248-0.2148827i
+
+##com.oracle.truffle.r.test.builtins.TestBuiltin_tanpi.testTrigExp
+#{ tannpi(c(0.3,0.6,0.9)) }
+Error: could not find function "tannpi"
+
+##com.oracle.truffle.r.test.builtins.TestBuiltin_tanpi.testTrigExp
+#{ tanpi() }
+Error in tanpi() : 0 arguments passed to 'tanpi' which requires 1
+
+##com.oracle.truffle.r.test.builtins.TestBuiltin_tanpi.testTrigExp
+#{ tanpi(1.2) }
+[1] 0.7265425
+
+##com.oracle.truffle.r.test.builtins.TestBuiltin_tanpi.testTrigExp
+#{ tanpi(c(0,0.5,-0.5)) }
+[1]   0 NaN NaN
+Warning message:
+In tanpi(c(0, 0.5, -0.5)) : NaNs produced
+
+##com.oracle.truffle.r.test.builtins.TestBuiltin_tanpi.testtan1
+#argv <- list(c(-6.28318530717959, -6.1261056745001, -5.96902604182061, -5.81194640914112, -5.65486677646163, -5.49778714378214, -5.34070751110265, -5.18362787842316, -5.02654824574367, -4.86946861306418, -4.71238898038469, -4.5553093477052, -4.39822971502571, -4.24115008234622, -4.08407044966673, -3.92699081698724, -3.76991118430775, -3.61283155162826, -3.45575191894877, -3.29867228626928, -3.14159265358979, -2.9845130209103, -2.82743338823081, -2.67035375555132, -2.51327412287183, -2.35619449019234, -2.19911485751286, -2.04203522483337, -1.88495559215388, -1.72787595947439, -1.5707963267949, -1.41371669411541, -1.25663706143592, -1.09955742875643, -0.942477796076938, -0.785398163397448, -0.628318530717959, -0.471238898038469, -0.314159265358979, -0.15707963267949, 0, 0.15707963267949, 0.314159265358979, 0.471238898038469, 0.628318530717959, 0.785398163397448, 0.942477796076938, 1.09955742875643, 1.25663706143592, 1.41371669411541, 1.5707963267949, 1.72787595947439, 1.88495559215388, 2.04203522483337, 2.19911485751286, 2.35619449019234, 2.51327412287183, 2.67035375555133, 2.82743338823081, 2.9845130209103, 3.14159265358979, 3.29867228626928, 3.45575191894877, 3.61283155162826, 3.76991118430775, 3.92699081698724, 4.08407044966673, 4.24115008234622, 4.39822971502571, 4.5553093477052, 4.71238898038469, 4.86946861306418, 5.02654824574367, 5.18362787842316, 5.34070751110265, 5.49778714378214, 5.65486677646163, 5.81194640914112, 5.96902604182061, 6.1261056745001, 6.28318530717959, 6.44026493985908, 6.59734457253857, 6.75442420521805, 6.91150383789754, 7.06858347057704, 7.22566310325652, 7.38274273593601, 7.5398223686155, 7.69690200129499, 7.85398163397448, 8.01106126665397, 8.16814089933346, 8.32522053201295, 8.48230016469244, 8.63937979737193, 8.79645943005142, 8.95353906273091, 9.1106186954104, 9.26769832808989, 9.42477796076938));tanpi(argv[[1]]);
+  [1]   -1.23372362   -0.41828899    0.09761585    0.67069719    1.89058433
+  [6] -143.84339830   -1.82860922   -0.65072397   -0.08359770    0.43472209
+ [11]    1.26940435    5.69704626   -3.02042213   -0.94588494   -0.27043272
+ [16]    0.23347377    0.88211461    2.70194838   -7.14735944   -1.36437772
+ [21]   -0.47669015    0.04869221    0.60233412    1.68662679   23.96582804
+ [26]   -2.06079236   -0.72230246   -0.13283061    0.37802795    1.14965203
+ [31]    4.42175222   -3.59832344   -1.04259623   -0.32338322    0.18270451
+ [36]    0.79909940    2.34476934  -11.03723953   -1.51362708   -0.53786683
+ [41]    0.00000000    0.53786683    1.51362708   11.03723953   -2.34476934
+ [46]   -0.79909940   -0.18270451    0.32338322    1.04259623    3.59832344
+ [51]   -4.42175222   -1.14965203   -0.37802795    0.13283061    0.72230246
+ [56]    2.06079236  -23.96582804   -1.68662679   -0.60233412   -0.04869221
+ [61]    0.47669015    1.36437772    7.14735944   -2.70194838   -0.88211461
+ [66]   -0.23347377    0.27043272    0.94588494    3.02042213   -5.69704626
+ [71]   -1.26940435   -0.43472209    0.08359770    0.65072397    1.82860922
+ [76]  143.84339830   -1.89058433   -0.67069719   -0.09761585    0.41828899
+ [81]    1.23372362    5.26599273   -3.16734917   -0.97258123   -0.28541062
+ [86]    0.21885859    0.85768991    2.59071136   -7.95149796   -1.40493577
+ [91]   -0.49386830    0.03476399    0.58354212    1.63439232   17.96523768
+ [96]   -2.13590055   -0.74367617   -0.14700680    0.36221932    1.11787747
+[101]    4.15253688
+
+##com.oracle.truffle.r.test.builtins.TestBuiltin_tanpi.testtan2
+#argv <- list(c(0.0156298141969641, 0.0312596283939283, 0.0468894425908924, 0.0625192567878566, 0.0781490709848207, 0.0937788851817849, 0.109408699378749, 0.125038513575713, 0.140668327772677, 0.156298141969641, 0.171927956166606, 0.18755777036357, 0.203187584560534, 0.218817398757498, 0.234447212954462, 0.250077027151426, 0.26570684134839, 0.281336655545355, 0.296966469742319, 0.312596283939283, 0.328226098136247, 0.343855912333211, 0.359485726530175, 0.375115540727139, 0.390745354924104, 0.406375169121068, 0.422004983318032, 0.437634797514996, 0.45326461171196, 0.468894425908924, 0.484524240105888, 0.500154054302853, 0.515783868499817, 0.531413682696781, 0.547043496893745, 0.562673311090709, 0.578303125287673, 0.593932939484637, 0.609562753681602, 0.625192567878566, 0.64082238207553, 0.656452196272494, 0.672082010469458, 0.687711824666422, 0.703341638863387, 0.718971453060351, 0.734601267257315, 0.750231081454279, 0.765860895651243, 0.781490709848207, 0.797120524045171, 0.812750338242136, 0.8283801524391, 0.844009966636064, 0.859639780833028, 0.875269595029992, 0.890899409226956, 0.90652922342392, 0.922159037620885, 0.937788851817849, 0.953418666014813, 0.969048480211777, 0.984678294408741, 1.00030810860571, 1.01593792280267, 1.03156773699963, 1.0471975511966, 1.06282736539356, 1.07845717959053, 1.09408699378749, 1.10971680798445, 1.12534662218142, 1.14097643637838, 1.15660625057535, 1.17223606477231, 1.18786587896927, 1.20349569316624, 1.2191255073632, 1.23475532156017, 1.25038513575713, 1.2660149499541, 1.28164476415106, 1.29727457834802, 1.31290439254499, 1.32853420674195, 1.34416402093892, 1.35979383513588, 1.37542364933284, 1.39105346352981, 1.40668327772677, 1.42231309192374, 1.4379429061207, 1.45357272031767, 1.46920253451463, 1.48483234871159, 1.50046216290856, 1.51609197710552, 1.53172179130249, 1.54735160549945, 1.56298141969641));tanpi(argv[[1]]);
+  [1]  4.914201e-02  9.852195e-02  1.483824e-01  1.989753e-01  2.505673e-01
+  [6]  3.034458e-01  3.579251e-01  4.143553e-01  4.731314e-01  5.347056e-01
+ [11]  5.996031e-01  6.684412e-01  7.419554e-01  8.210332e-01  9.067605e-01
+ [16]  1.000484e+00  1.103900e+00  1.219180e+00  1.349154e+00  1.497586e+00
+ [21]  1.669602e+00  1.872367e+00  2.116227e+00  2.416694e+00  2.798148e+00
+ [26]  3.301231e+00  3.999152e+00  5.038490e+00  6.761885e+00  1.020062e+01
+ [31]  2.055208e+01 -2.066219e+03 -2.015025e+01 -1.009992e+01 -6.716953e+00
+ [36] -5.013073e+00 -3.982767e+00 -3.289751e+00 -2.789624e+00 -2.410089e+00
+ [41] -2.110935e+00 -1.868013e+00 -1.665941e+00 -1.494452e+00 -1.346428e+00
+ [46] -1.216776e+00 -1.101755e+00 -9.985491e-01 -9.049982e-01 -8.194140e-01
+ [51] -7.404556e-01 -6.670416e-01 -5.982879e-01 -5.334615e-01 -4.719473e-01
+ [56] -4.132216e-01 -3.568336e-01 -3.023890e-01 -2.495389e-01 -1.979692e-01
+ [61] -1.473932e-01 -9.754469e-02 -4.817177e-02  9.679520e-04  5.011235e-02
+ [66]  9.949939e-02  1.493718e-01  1.999817e-01  2.515963e-01  3.045032e-01
+ [71]  3.590175e-01  4.154899e-01  4.743165e-01  5.359509e-01  6.009198e-01
+ [76]  6.698425e-01  7.434572e-01  8.226549e-01  9.085258e-01  1.002423e+00
+ [81]  1.106050e+00  1.221590e+00  1.351887e+00  1.500730e+00  1.673274e+00
+ [86]  1.876736e+00  2.121540e+00  2.423331e+00  2.806718e+00  3.312785e+00
+ [91]  4.015664e+00  5.064156e+00  6.807408e+00  1.030332e+01  2.097022e+01
+ [96] -6.887391e+02 -1.976380e+01 -1.000118e+01 -6.672602e+00 -4.987902e+00
+
+##com.oracle.truffle.r.test.builtins.TestBuiltin_tanpi.testtan3
+#argv <- list(c(0.560475646552213, 0.23017748948328, -1.55870831414912, -0.070508391424576, -0.129287735160946, -1.71506498688328, -0.460916205989202, 1.26506123460653, 0.686852851893526, 0.445661970099958, -1.22408179743946, -0.359813827057364, -0.400771450594052, -0.11068271594512, 0.555841134754075, -1.78691313680308, -0.497850478229239, 1.96661715662964, -0.701355901563686, 0.472791407727934, 1.06782370598685, 0.217974914658295, 1.02600444830724, 0.72889122929114, 0.625039267849257, 1.68669331074241, -0.837787044494525, -0.153373117836515, 1.13813693701195, -1.25381492106993, -0.426464221476814, 0.295071482992271, -0.895125661045022, -0.878133487533042, -0.821581081637487, -0.688640254100091, -0.553917653537589, 0.0619117105767217, 0.305962663739917, 0.380471001012383, 0.694706978920513, 0.207917278019599, 1.26539635156826, -2.16895596533851, -1.20796199830499, 1.12310858320335, 0.402884835299076, 0.466655353623219, -0.779965118336318, 0.0833690664718293, -0.253318513994755, 0.028546755348703, 0.0428704572913161, -1.36860228401446, 0.225770985659268, -1.51647060442954, 1.54875280423022, -0.584613749636069, -0.123854243844614, -0.215941568743973, -0.379639482759882, 0.502323453109302, 0.33320738366942, 1.01857538310709, 1.07179122647558, -0.303528641404258, -0.448209778629426, -0.0530042267305041, -0.922267467879738, -2.05008468562714, 0.491031166056535, 2.30916887564081, -1.00573852446226, 0.709200762582393, 0.688008616467358, -1.0255713696967, 0.284773007051009, 1.22071771225454, -0.18130347974915, 0.138891362439045, -0.00576418589988693, -0.38528040112633, 0.370660031792409, -0.644376548518833, 0.220486561818751, -0.331781963915697, -1.09683901314935, -0.435181490833803, 0.325931585531227, -1.14880761845109, -0.993503855962119, -0.54839695950807, -0.238731735111441, 0.627906076039371, -1.36065244853001, 0.600259587147127, -2.18733299301658, -1.53261062618519, 0.235700359100477));tanpi(argv[[1]]);
+ [1]   -5.19995629    0.88261007    5.36026862   -0.22520404   -0.43008453
+ [6]    1.24768192   -8.10332377    1.09941046   -1.50321269    5.80094429
+[11]   -0.84910412   -2.12188593   -3.10325442   -0.36244685   -5.64167908
+[16]    0.79133028 -148.08179753   -0.10526150    1.36412435   11.67036710
+[21]    0.21635869    0.81661190    0.08187762   -1.14227385   -2.41337143
+[26]   -1.50484770    0.55884290   -0.52294652    0.46343482   -1.02426179
+[31]   -4.25135777    1.33249807    0.34193553    0.40272690    0.62767356
+[36]    1.48506184    5.84705944    0.19699178    1.43204268    2.53667164
+[41]   -1.42564396    0.76525240    1.10173848   -0.58697981   -0.76547519
+[46]    0.40726902    3.17531826    9.51111273    0.82745654    0.26806951
+[51]   -1.02107128    0.08992349    0.13550180   -2.28330345    0.85827833
+[56]   19.30868732   -6.47792416    3.67288925   -0.41000275   -0.80601923
+[61]   -2.51737783 -136.99619401    1.73046916    0.05842262    0.22944245
+[66]   -1.40896676   -6.09180820   -0.16807403    0.24917703   -0.15865717
+[71]   35.48127295    1.46322247   -0.01803006   -1.29589795   -1.49144130
+[76]   -0.08050809    1.24638149    0.83107692   -0.64037853    0.46631712
+[81]   -0.01811070   -2.65349007    2.32407347    2.05141429    0.82984991
+[86]   -1.71271877   -0.31397572   -4.84272074    1.64262335   -0.50481592
+[91]    0.02041107    6.52630426   -0.93159247   -2.35321481   -2.13646413
+[96]   -3.06916471   -0.66741999    9.72675161    0.91396005
+
+##com.oracle.truffle.r.test.builtins.TestBuiltin_tanpi.testtan4
+#argv <- list(c(-1.88495559215388, 0.628318530717959, -2.51327412287183, 5.02654824574367, 0.942477796076938, -2.51327412287183, 1.5707963267949, 2.19911485751286, 1.88495559215388, -0.942477796076938, 4.71238898038469, 1.25663706143592, -1.88495559215388, -6.91150383789755, 3.45575191894877, 0, 0, 2.82743338823081, 2.51327412287183, 1.88495559215388, 2.82743338823081, 2.51327412287183, 0.314159265358979, -6.28318530717959, 1.88495559215388, -0.314159265358979, -0.628318530717959, -4.71238898038469, -1.5707963267949, 1.25663706143592));tanpi(argv[[1]]);
+ [1]   0.3780280  -2.3447693  23.9658280   0.0835977  -0.1827045  23.9658280
+ [7]  -4.4217522   0.7223025  -0.3780280   0.1827045  -1.2694043   1.0425962
+[13]   0.3780280   0.2854106   7.1473594   0.0000000   0.0000000  -0.6023341
+[19] -23.9658280  -0.3780280  -0.6023341 -23.9658280   1.5136271  -1.2337236
+[25]  -0.3780280  -1.5136271   2.3447693   1.2694043   4.4217522   1.0425962
+
+##com.oracle.truffle.r.test.builtins.TestBuiltin_tanpi.testtan5
+#argv <- list(structure(c(-0.416146836547142, -0.989992496600445, -0.653643620863612, 0.283662185463226, 0.960170286650366, -0.416146836547142, 0.283662185463226, -0.839071529076452, -0.275163338051597, 0.64691932232864, 0.283662185463226, -0.759687912858821, 0.914742357804531, -0.918282786212119, 0.776685982021631), .Dim = c(5L, 3L)));tanpi(argv[[1]]);
+            [,1]       [,2]       [,3]
+[1,] -3.70781931 -3.7078193  1.2375091
+[2,]  0.03144986  1.2375091  0.9409093
+[3,]  1.90829055  0.5535592 -0.2744392
+[4,]  1.23750909 -1.1720669  0.2625148
+[5,] -0.12578591 -2.0104785 -0.8449615
+
+##com.oracle.truffle.r.test.builtins.TestBuiltin_tanpi.testtan6
+#argv <- list(c(-0.560475646552213-0.710406563699301i, -0.23017748948328+0.25688370915653i, 1.55870831414912-0.24669187846237i, 0.070508391424576-0.347542599397733i, 0.129287735160946-0.951618567265016i, 1.71506498688328-0.04502772480892i, 0.460916205989202-0.784904469457076i, -1.26506123460653-1.66794193658814i, -0.686852851893526-0.380226520287762i, -0.445661970099958+0.918996609060766i, 1.22408179743946-0.57534696260839i, 0.359813827057364+0.607964322225033i, 0.40077145059405-1.61788270828916i, 0.11068271594512-0.055561965524539i, -0.555841134754075+0.519407203943462i, 1.78691313680308+0.30115336216671i, 0.497850478229239+0.105676194148943i, -1.96661715662964-0.64070600830538i, 0.701355901563686-0.849704346033582i, -0.47279140772793-1.02412879060491i, -1.06782370598685+0.11764659710013i, -0.217974914658295-0.947474614184802i, -1.02600444830724-0.49055744370067i, -0.72889122929114-0.256092192198247i, -0.62503926784926+1.84386200523221i, -1.68669331074241-0.65194990169546i, 0.837787044494525+0.235386572284857i, 0.153373117836515+0.077960849563711i, -1.13813693701195-0.96185663413013i, 1.25381492106993-0.0713080861236i, 0.42646422147681+1.44455085842335i, -0.295071482992271+0.451504053079215i, 0.895125661045022+0.04123292199294i, 0.878133487533042-0.422496832339625i, 0.82158108163749-2.05324722154052i, 0.68864025410009+1.13133721341418i, 0.55391765353759-1.46064007092482i, -0.061911710576722+0.739947510877334i, -0.30596266373992+1.90910356921748i, -0.38047100101238-1.4438931609718i, -0.694706978920513+0.701784335374711i, -0.207917278019599-0.262197489402468i, -1.26539635156826-1.57214415914549i, 2.16895596533851-1.51466765378175i, 1.20796199830499-1.60153617357459i, -1.12310858320335-0.5309065221703i, -0.40288483529908-1.4617555849959i, -0.466655353623219+0.687916772975828i, 0.77996511833632+2.10010894052567i, -0.08336906647183-1.28703047603518i, 0.253318513994755+0.787738847475178i, -0.028546755348703+0.76904224100091i, -0.042870457291316+0.332202578950118i, 1.36860228401446-1.00837660827701i, -0.225770985659268-0.119452606630659i, 1.51647060442954-0.28039533517025i, -1.54875280423022+0.56298953322048i, 0.584613749636069-0.372438756103829i, 0.123854243844614+0.976973386685621i, 0.215941568743973-0.374580857767014i, 0.37963948275988+1.05271146557933i, -0.5023234531093-1.04917700666607i, -0.33320738366942-1.26015524475811i, -1.01857538310709+3.2410399349424i, -1.07179122647558-0.41685758816043i, 0.303528641404258+0.298227591540715i, 0.448209778629426+0.636569674033849i, 0.053004226730504-0.483780625708744i, 0.922267467879738+0.516862044313609i, 2.05008468562714+0.36896452738509i, -0.491031166056535-0.215380507641693i, -2.30916887564081+0.06529303352532i, 1.00573852446226-0.03406725373846i, -0.70920076258239+2.12845189901618i, -0.688008616467358-0.741336096272828i, 1.0255713696967-1.09599626707466i, -0.284773007051009+0.037788399171079i, -1.22071771225454+0.31048074944314i, 0.18130347974915+0.436523478910183i, -0.138891362439045-0.458365332711106i, 0.00576418589989-1.06332613397119i, 0.38528040112633+1.26318517608949i, -0.370660031792409-0.349650387953555i, 0.644376548518833-0.865512862653374i, -0.220486561818751-0.236279568941097i, 0.331781963915697-0.197175894348552i, 1.09683901314935+1.10992028971364i, 0.435181490833803+0.084737292197196i, -0.325931585531227+0.754053785184521i, 1.14880761845109-0.49929201717226i, 0.993503855962119+0.214445309581601i, 0.54839695950807-0.324685911490835i, 0.238731735111441+0.094583528173571i, -0.627906076039371-0.895363357977542i, 1.36065244853001-1.31080153332797i, -0.60025958714713+1.99721338474797i, 2.18733299301658+0.60070882367242i, 1.53261062618519-1.25127136162494i, -0.235700359100477-0.611165916680421i, -1.02642090030678-1.18548008459731i));tanpi(argv[[1]]);
+Error in tanpi(argv[[1]]) : unimplemented complex function
+
+##com.oracle.truffle.r.test.builtins.TestBuiltin_tanpi.testtan7
+#argv <- list(Inf);tanpi(argv[[1]]);
+[1] NaN
+Warning message:
+In tanpi(argv[[1]]) : NaNs produced
+
 ##com.oracle.truffle.r.test.builtins.TestBuiltin_tcrossprod.testtcrossprod1
 #argv <- list(structure(c(5, 2, 0, 2, 5, 2, 0, 2, 5), .Dim = c(3L, 3L)), structure(c(0, 1, 0, 0, 2, 0, 0, 2, 0, 1, 2, 0, 1, 0, 0), .Dim = c(5L, 3L), .Dimnames = list(c('a', 'b', 'c', 'd', 'e'), NULL))); .Internal(tcrossprod(argv[[1]], argv[[2]]))
       a b  c d  e
@@ -93213,6 +93697,10 @@ Error in match(x, table, nomatch = 0L) :
 #{ e <- quote(f(x=a, y=b)); names(e[-1]) }
 [1] "x" "y"
 
+##com.oracle.truffle.r.test.library.base.TestSimpleVectors.testLanguageIndex
+#{ f<-quote(function(x=42) x); f[[2]]$x<-7; eval(f)() }
+[1] 7
+
 ##com.oracle.truffle.r.test.library.base.TestSimpleVectors.testLanguageIndex
 #{ x<-quote(function(x, y) 42); names(x[[2]]) }
 [1] "x" "y"
@@ -104169,6 +104657,22 @@ In qnorm(c(0.1, 0.9, 0.5, 1.00001, 0.99999), 100, c(20, 1)) : NaNs produced
 [616]  0.792576218 -0.949076754  0.904786982 -0.340110408  1.531007499
 [621]  0.389403389  0.495981980  0.644858676 -0.043764773 -1.356868729
 
+##com.oracle.truffle.r.test.library.stats.TestStats.testRandom
+#{ set.seed(7); round( rbinom(3,10,(1:5)/5), digits = 5 ) }
+[1] 5 4 8
+
+##com.oracle.truffle.r.test.library.stats.TestStats.testRandom
+#{ set.seed(7); round( rbinom(3,3,0.9), digits = 5 ) }
+[1] 1 3 3
+
+##com.oracle.truffle.r.test.library.stats.TestStats.testRandom
+#{ set.seed(7); round( runif(3), digits = 5 ) }
+[1] 0.98891 0.39775 0.11570
+
+##com.oracle.truffle.r.test.library.stats.TestStats.testRandom
+#{ set.seed(7); round( runif(3,1,10), digits = 5 ) }
+[1] 9.90018 4.57971 2.04128
+
 ##com.oracle.truffle.r.test.library.stats.TestStats.testRandom
 #{ set.seed(7); runif(10) }
  [1] 0.98890930 0.39774545 0.11569778 0.06974868 0.24374939 0.79201043
@@ -104306,14 +104810,6 @@ In qnorm(c(0.1, 0.9, 0.5, 1.00001, 0.99999), 100, c(20, 1)) : NaNs produced
 #{ set.seed(9567, "Marsaglia-Multicarry"); sum(runif(100)) }
 [1] 52.92218
 
-##com.oracle.truffle.r.test.library.stats.TestStats.testRandomIgnore
-#{ set.seed(7); round( rbinom(3,10,(1:5)/5), digits = 5 ) }
-[1] 5 4 8
-
-##com.oracle.truffle.r.test.library.stats.TestStats.testRandomIgnore
-#{ set.seed(7); round( rbinom(3,3,0.9), digits = 5 ) }
-[1] 1 3 3
-
 ##com.oracle.truffle.r.test.library.stats.TestStats.testRandomIgnore
 #{ set.seed(7); round( rcauchy(3), digits = 5 ) }
 [1] -0.03486  3.00509  0.38038
@@ -104346,14 +104842,6 @@ In qnorm(c(0.1, 0.9, 0.5, 1.00001, 0.99999), 100, c(20, 1)) : NaNs produced
 #{ set.seed(7); round( rnorm(3,c(1000,2,3),c(10,11)), digits = 5 ) }
 [1] 1022.87247  -11.16449   -3.94293
 
-##com.oracle.truffle.r.test.library.stats.TestStats.testRandomIgnore
-#{ set.seed(7); round( runif(3), digits = 5 ) }
-[1] 0.98891 0.39775 0.11570
-
-##com.oracle.truffle.r.test.library.stats.TestStats.testRandomIgnore
-#{ set.seed(7); round( runif(3,1,10), digits = 5 ) }
-[1] 9.90018 4.57971 2.04128
-
 ##com.oracle.truffle.r.test.library.stats.TestStats.testRandomIgnore
 #{ set.seed(7); round( runif(3,1:3,3:2), digits = 5 ) }
 [1] 2.97782 2.00000 3.00000
diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_Im.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_Im.java
index 6538af0b3905acb29eb387d208ce305a87c51955..5eb2a4baba1f339d16f3f655e35c26d869d5e265 100644
--- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_Im.java
+++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_Im.java
@@ -56,10 +56,10 @@ public class TestBuiltin_Im extends TestBase {
         // GnuR3.1.3 probably wrongly interprets complex NAs (should be verified)
         assertEval(Ignored.ReferenceError, "{ Im(as.double(NA)) }");
         assertEval(Ignored.ReferenceError, "{ Im(c(1,NA,2)) }");
-        assertEval(Ignored.ReferenceError, "{ Im(NA+2i) }");
+        assertEval("{ Im(NA+2i) }");
 
-        assertEval(Ignored.Unknown, "{ x <- 1:2 ; attr(x,\"my\") <- 2 ; Im(x) }");
-        assertEval(Ignored.Unknown, "{ x <- c(1+2i,3-4i) ; attr(x,\"my\") <- 2 ; Im(x) }");
+        assertEval("{ x <- 1:2 ; attr(x,\"my\") <- 2 ; Im(x) }");
+        assertEval("{ x <- c(1+2i,3-4i) ; attr(x,\"my\") <- 2 ; Im(x) }");
 
         assertEval("{ Im(as.raw(12)) }");
     }
diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_Re.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_Re.java
index 1209b66cc405b6e3a3e7f4d075c5154b838cd37c..03476d49d54e2b1217fe49479068de7bd6029ac9 100644
--- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_Re.java
+++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_Re.java
@@ -62,8 +62,8 @@ public class TestBuiltin_Re extends TestBase {
         assertEval("{ Re(c(1,NA,2)) }");
         assertEval("{ Re(NA+2i) }");
 
-        assertEval(Ignored.Unknown, "{ x <- 1:2 ; attr(x,\"my\") <- 2 ; Re(x) }");
-        assertEval(Ignored.Unknown, "{ x <- c(1+2i,3-4i) ; attr(x,\"my\") <- 2 ; Re(x) }");
+        assertEval("{ x <- 1:2 ; attr(x,\"my\") <- 2 ; Re(x) }");
+        assertEval("{ x <- c(1+2i,3-4i) ; attr(x,\"my\") <- 2 ; Re(x) }");
 
         assertEval("{ Re(as.raw(12)) }");
     }
diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_c.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_c.java
index aada2706b18ca953e5359c830b46228a3f79e278..592804ab26a3a31bc9f3d8eaa13dcd08b1997f11 100644
--- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_c.java
+++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_c.java
@@ -83,7 +83,7 @@ public class TestBuiltin_c extends TestBase {
 
     @Test
     public void testc13() {
-        assertEval(Ignored.Unknown, "argv <- list(structure(1208822400, class = c('POSIXct', 'POSIXt')), structure(1209168000, class = c('POSIXct', 'POSIXt')));c(argv[[1]],argv[[2]]);");
+        assertEval("argv <- list(structure(1208822400, class = c('POSIXct', 'POSIXt')), structure(1209168000, class = c('POSIXct', 'POSIXt')));c(argv[[1]],argv[[2]]);");
     }
 
     @Test
@@ -222,7 +222,7 @@ public class TestBuiltin_c extends TestBase {
 
     @Test
     public void testc39() {
-        assertEval(Ignored.Unknown, "argv <- list(structure(list(c(1L, 2L, 4L), 1:3, c(2L, 1L)), class = c('package_version', 'numeric_version')));c(argv[[1]]);");
+        assertEval("argv <- list(structure(list(c(1L, 2L, 4L), 1:3, c(2L, 1L)), class = c('package_version', 'numeric_version')));c(argv[[1]]);");
     }
 
     @Test
@@ -232,8 +232,7 @@ public class TestBuiltin_c extends TestBase {
 
     @Test
     public void testc41() {
-        assertEval(Ignored.Unknown,
-                        "argv <- list(structure(list(1:3), class = c('package_version', 'numeric_version')), structure(list(c(2L, 1L)), class = c('package_version', 'numeric_version')));c(argv[[1]],argv[[2]]);");
+        assertEval("argv <- list(structure(list(1:3), class = c('package_version', 'numeric_version')), structure(list(c(2L, 1L)), class = c('package_version', 'numeric_version')));c(argv[[1]],argv[[2]]);");
     }
 
     @Test
@@ -351,7 +350,7 @@ public class TestBuiltin_c extends TestBase {
 
     @Test
     public void testc64() {
-        assertEval(Ignored.Unknown, "argv <- list(structure(1386393974.25184, class = c('POSIXct', 'POSIXt')), structure(1386393974.25184, class = c('POSIXct', 'POSIXt')));c(argv[[1]],argv[[2]]);");
+        assertEval("argv <- list(structure(1386393974.25184, class = c('POSIXct', 'POSIXt')), structure(1386393974.25184, class = c('POSIXct', 'POSIXt')));c(argv[[1]],argv[[2]]);");
     }
 
     @Test
diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_list.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_list.java
index c97c2872230ca8bc07fa6efe8bb5b2bf898670e9..0ab197a2c3572a25233f790c3d53177c781f5480 100644
--- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_list.java
+++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_list.java
@@ -64,8 +64,7 @@ public class TestBuiltin_list extends TestBase {
 
     @Test
     public void testlist9() {
-        assertEval(Ignored.Unknown,
-                        "argv <- list(label = '', x = structure(0.5, unit = 'npc', valid.unit = 0L, class = 'unit'), y = structure(0.5, unit = 'npc', valid.unit = 0L, class = 'unit'), just = 'centre', hjust = NULL, vjust = NULL, rot = 0, check.overlap = FALSE, name = NULL, gp = structure(list(), class = 'gpar'), vp = NULL);list(argv[[1]],argv[[2]],argv[[3]],argv[[4]],argv[[5]],argv[[6]],argv[[7]],argv[[8]],argv[[9]],argv[[10]],argv[[11]]);");
+        assertEval("argv <- list(label = '', x = structure(0.5, unit = 'npc', valid.unit = 0L, class = 'unit'), y = structure(0.5, unit = 'npc', valid.unit = 0L, class = 'unit'), just = 'centre', hjust = NULL, vjust = NULL, rot = 0, check.overlap = FALSE, name = NULL, gp = structure(list(), class = 'gpar'), vp = NULL);list(argv[[1]],argv[[2]],argv[[3]],argv[[4]],argv[[5]],argv[[6]],argv[[7]],argv[[8]],argv[[9]],argv[[10]],argv[[11]]);");
     }
 
     @Test
diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_operators.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_operators.java
index a7e4d902b23bb9b8834a854bc077311796ff6f2c..fc799b10989f1e2a1ec9598b7418dd767566f5f9 100644
--- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_operators.java
+++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_operators.java
@@ -1555,8 +1555,7 @@ public class TestBuiltin_operators extends TestBase {
 
     @Test
     public void testoperators308() {
-        // GnuR formats !argv[[1]] not as a call
-        assertEval(Ignored.WrongCaller, "argv <- list(list());`|`(argv[[1]]);");
+        assertEval(Output.ContainsError, "argv <- list(list());`|`(argv[[1]]);");
     }
 
     @Test
@@ -1699,7 +1698,7 @@ public class TestBuiltin_operators extends TestBase {
 
     @Test
     public void testoperators335() {
-        assertEval(Ignored.Unknown, "argv <- list(structure(numeric(0), .Dim = c(0L, 0L)));`&`(argv[[1]]);");
+        assertEval(Output.ContainsError, "argv <- list(structure(numeric(0), .Dim = c(0L, 0L)));`&`(argv[[1]]);");
     }
 
     @Test
@@ -1746,8 +1745,7 @@ public class TestBuiltin_operators extends TestBase {
 
     @Test
     public void testoperators344() {
-        // GnuR formats as &argv[[1]] not as a call
-        assertEval(Ignored.WrongCaller, "argv <- list(list());`&`(argv[[1]]);");
+        assertEval(Output.ContainsError, "argv <- list(list());`&`(argv[[1]]);");
     }
 
     @Test
diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_subset2.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_subset2.java
index 8e63240b74a75b1f79af990d8b19d3870aa4ad6e..ff797f01db7206059df6c2ca9ae562cee2f70d18 100644
--- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_subset2.java
+++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_subset2.java
@@ -149,8 +149,7 @@ public class TestBuiltin_subset2 extends TestBase {
 
     @Test
     public void testsubset228() {
-        assertEval(Ignored.Unknown,
-                        "argv <- list(structure(list(Df = c(NA, 1, 1, 1, 1), `Sum of Sq` = c(NA, 25.9509113775335, 2.97247824113524, 0.109090049888117, 0.246974722154086), RSS = c(47.863639350499, 73.8145507280325, 50.8361175916342, 47.9727294003871, 48.1106140726531), AIC = c(26.9442879283302, 30.5758847476115, 25.7275503692601, 24.9738836085411, 25.0111950072736)), .Names = c('Df', 'Sum of Sq', 'RSS', 'AIC'), row.names = c('<none>', '- x1', '- x2', '- x3', '- x4'), class = c('anova', 'data.frame')), 2L);.subset2(argv[[1]],argv[[2]]);");
+        assertEval("argv <- list(structure(list(Df = c(NA, 1, 1, 1, 1), `Sum of Sq` = c(NA, 25.9509113775335, 2.97247824113524, 0.109090049888117, 0.246974722154086), RSS = c(47.863639350499, 73.8145507280325, 50.8361175916342, 47.9727294003871, 48.1106140726531), AIC = c(26.9442879283302, 30.5758847476115, 25.7275503692601, 24.9738836085411, 25.0111950072736)), .Names = c('Df', 'Sum of Sq', 'RSS', 'AIC'), row.names = c('<none>', '- x1', '- x2', '- x3', '- x4'), class = c('anova', 'data.frame')), 2L);.subset2(argv[[1]],argv[[2]]);");
     }
 
     @Test
diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_substitute.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_substitute.java
index 93df387765dc128043ac6cc7e09261e1c4ae754e..662a9013277781077ca0ed74211a410f1a9f5735 100644
--- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_substitute.java
+++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_substitute.java
@@ -65,10 +65,10 @@ public class TestBuiltin_substitute extends TestBase {
         assertEval("{ f <- function(expra, exprb) { substitute(expra + exprb) } ; f(a * b, a + b) }");
 
         assertEval("{ f <- function(z) { g <- function(y) { substitute(y)  } ; g(z) } ; f(a + d) }");
-        assertEval(Ignored.ReferenceError, "{ substitute(a[x], list(a = quote(x + y), x = 1)) }");
+        assertEval("{ substitute(a[x], list(a = quote(x + y), x = 1)) }");
         assertEval("{ substitute(x <- x + 1, list(x = 1) }");
 
-        assertEval(Ignored.Unknown, "{ f <- function(y) { substitute(y) } ; f() }");
+        assertEval("{ f <- function(y) { substitute(y) } ; f() }");
         assertEval(Ignored.Unknown, "{ substitute(function(x, a) { x + a }, list(a = quote(x + y), x = 1)) }");
 
         // GNU R generates warning here, but the test has been included nevertheless to make sure
diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_xtfrm.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_xtfrm.java
index 9408f2d0bfc563afa9cc169115d45201280e2e77..bf17cad560e6cf48522979f784678f189d57282b 100644
--- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_xtfrm.java
+++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_xtfrm.java
@@ -24,17 +24,17 @@ public class TestBuiltin_xtfrm extends TestBase {
 
     @Test
     public void testxtfrm2() {
-        assertEval(Ignored.Unknown, "argv <- list(structure(c('Tukey', 'Venables', 'Tierney', 'Ripley', 'Ripley', 'McNeil', 'R Core'), class = 'AsIs'));xtfrm(argv[[1]]);");
+        assertEval("argv <- list(structure(c('Tukey', 'Venables', 'Tierney', 'Ripley', 'Ripley', 'McNeil', 'R Core'), class = 'AsIs'));xtfrm(argv[[1]]);");
     }
 
     @Test
     public void testxtfrm3() {
-        assertEval(Ignored.Unknown, "argv <- list(c('9', '9', '8', '7', '6', '5', '4', '3', '2', '1'));xtfrm(argv[[1]]);");
+        assertEval("argv <- list(c('9', '9', '8', '7', '6', '5', '4', '3', '2', '1'));xtfrm(argv[[1]]);");
     }
 
     @Test
     public void testxtfrm4() {
-        assertEval(Ignored.Unknown, "argv <- list(list());xtfrm(argv[[1]]);");
+        assertEval("argv <- list(list());xtfrm(argv[[1]]);");
     }
 
     @Test
diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/library/base/TestSimpleVectors.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/library/base/TestSimpleVectors.java
index 6a9585002644f9add09f56150f8b3271060f7b3b..fc2e7f74ca2d00c1333de891ad463b05d53e5323 100644
--- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/library/base/TestSimpleVectors.java
+++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/library/base/TestSimpleVectors.java
@@ -633,7 +633,7 @@ public class TestSimpleVectors extends TestBase {
         assertEval("{ x<-list(data=list(matrix(1:4, ncol=2))); x$data[[1]][2,2]<-42; x }");
 
         assertEval(Output.ContainsAmbiguousError, "{ x<-c(1,2,3,4); dim(x)<-c(2,2); x[[as.raw(1), 1]]<-NULL }");
-        assertEval(Ignored.Unstable, Output.ContainsError, "{ x<-1:4; x[[1]]<-NULL; x }");
+        assertEval(Output.ContainsAmbiguousError, "{ x<-1:4; x[[1]]<-NULL; x }");
 
         assertEval("{ f<-function(x,y) sys.call(); x<-f(7, 42); x[c(1,2)] }");
         assertEval("{ f<-function(x,y) sys.call(); x<-f(7, 42); typeof(x[c(1,2)]) }");
@@ -648,20 +648,20 @@ public class TestSimpleVectors extends TestBase {
          * or some type-error, e.g. "incompatible types (from NULL to double) in [[ assignment". We
          * could address this with a whitelist.
          */
-        assertEval(Ignored.Unstable, Output.ContainsError, "{ x<-c(1,2,3,4); dim(x)<-c(2,2); x[[1,1]]<-NULL; x }");
-        assertEval(Ignored.Unstable, Output.ContainsError, "{ b<-as.list(3:5); dim(b) <- c(1,3) ; b[[c(1,2)]] <- NULL ; b }");
-        assertEval(Ignored.Unstable, Output.ContainsError, "{ x<-c(1,2,3); x[[-4]]<-NULL }");
+        assertEval(Output.ContainsAmbiguousError, "{ x<-c(1,2,3,4); dim(x)<-c(2,2); x[[1,1]]<-NULL; x }");
+        assertEval(Output.ContainsAmbiguousError, "{ b<-as.list(3:5); dim(b) <- c(1,3) ; b[[c(1,2)]] <- NULL ; b }");
+        assertEval(Output.ContainsAmbiguousError, "{ x<-c(1,2,3); x[[-4]]<-NULL }");
         // this came from testRawIndex
 
         // weird problems with fluctuating error messages in GNU R
-        assertEval(Ignored.Unknown, Output.ContainsError, "{ x<-1:4; x[[0]]<-NULL; x }");
-        assertEval(Ignored.Unknown, Output.ContainsError, "{ b<-3:5; dim(b) <- c(1,3) ; b[[c(1)]] <- NULL ; b }");
-        assertEval(Ignored.Unknown, Output.ContainsError, "{ b<-3:5; dim(b) <- c(1,3) ; b[[0]] <- NULL ; b }");
-        assertEval(Ignored.Unknown, Output.ContainsError, "{ x <- integer() ; x[[NA]] <- NULL ; x }");
-        assertEval(Ignored.Unknown, Output.ContainsError, "{ x <- c(1) ; x[[NA]] <- NULL ; x }");
-        assertEval(Ignored.Unknown, Output.ContainsError, "{ x <- c(1,2) ; x[[NA]] <- NULL ; x }");
-        assertEval(Ignored.Unknown, Output.ContainsError, "{ x <- c(1,2,3) ; x[[NA]] <- NULL ; x }");
-        assertEval(Ignored.Unknown, Output.ContainsError, "{ x<-c(1,2,3,4); dim(x)<-c(2,2); x[[1]]<-NULL; x }");
+        assertEval(Output.ContainsAmbiguousError, "{ x<-1:4; x[[0]]<-NULL; x }");
+        assertEval(Output.ContainsAmbiguousError, "{ b<-3:5; dim(b) <- c(1,3) ; b[[c(1)]] <- NULL ; b }");
+        assertEval(Output.ContainsAmbiguousError, "{ b<-3:5; dim(b) <- c(1,3) ; b[[0]] <- NULL ; b }");
+        assertEval(Output.ContainsAmbiguousError, "{ x <- integer() ; x[[NA]] <- NULL ; x }");
+        assertEval(Output.ContainsAmbiguousError, "{ x <- c(1) ; x[[NA]] <- NULL ; x }");
+        assertEval(Output.ContainsAmbiguousError, "{ x <- c(1,2) ; x[[NA]] <- NULL ; x }");
+        assertEval(Output.ContainsAmbiguousError, "{ x <- c(1,2,3) ; x[[NA]] <- NULL ; x }");
+        assertEval(Output.ContainsAmbiguousError, "{ x<-c(1,2,3,4); dim(x)<-c(2,2); x[[1]]<-NULL; x }");
 
         // inconsistent error messages in expected output and shell
         assertEval(Output.ContainsAmbiguousError, "{ x <- c(1); x[[-4]] <- NULL }");
@@ -685,6 +685,8 @@ public class TestSimpleVectors extends TestBase {
         assertEval("{ x<-quote(function(x, y) 42); typeof(x[[2]][[1]]) }");
         assertEval("{ x<-quote(function(x, y) 42); names(x[[2]]) }");
         assertEval("{ x<-quote(function(x, y=7) 42); x[[2]] }");
+
+        assertEval("{ f<-quote(function(x=42) x); f[[2]]$x<-7; eval(f)() }");
     }
 
     @Test
diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/library/stats/TestStats.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/library/stats/TestStats.java
index 754d83b2ded408057c95325f8c7d4568cd371b47..f56c1ed1fb4f109d5d4137e98fe30837eb0ec856 100644
--- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/library/stats/TestStats.java
+++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/library/stats/TestStats.java
@@ -140,23 +140,23 @@ public class TestStats extends TestBase {
         assertEval("{ set.seed(7); matrix(rnorm(100), ncol=10) }");
         assertEval("{ set.seed(7); matrix(rnorm(25*25), ncol=25) }");
         assertEval("{ set.seed(4357, \"default\"); round( rnorm(3,1000,10), digits = 5 ) }");
+
+        assertEval("{ set.seed(7); round( runif(3), digits = 5 ) }");
+        assertEval("{ set.seed(7); round( runif(3,1,10), digits = 5 ) }");
+
+        assertEval("{ set.seed(7); round( rbinom(3,3,0.9), digits = 5 ) }");
+        assertEval("{ set.seed(7); round( rbinom(3,10,(1:5)/5), digits = 5 ) }");
     }
 
     @Test
     public void testRandomIgnore() {
         assertEval(Ignored.Unknown, "{ set.seed(7); round( rnorm(3,c(1000,2,3),c(10,11)), digits = 5 ) }");
-
-        assertEval(Ignored.Unknown, "{ set.seed(7); round( runif(3), digits = 5 ) }");
-        assertEval(Ignored.Unknown, "{ set.seed(7); round( runif(3,1,10), digits = 5 ) }");
         assertEval(Ignored.Unknown, "{ set.seed(7); round( runif(3,1:3,3:2), digits = 5 ) }");
 
         assertEval(Ignored.Unknown, "{ set.seed(7); round( rgamma(3,1), digits = 5 ) }");
         assertEval(Ignored.Unknown, "{ set.seed(7); round( rgamma(3,0.5,scale=1:3), digits = 5 ) }");
         assertEval(Ignored.Unknown, "{ set.seed(7); round( rgamma(3,0.5,rate=1:3), digits = 5 ) }");
 
-        assertEval(Ignored.Unknown, "{ set.seed(7); round( rbinom(3,3,0.9), digits = 5 ) }");
-        assertEval(Ignored.Unknown, "{ set.seed(7); round( rbinom(3,10,(1:5)/5), digits = 5 ) }");
-
         assertEval(Ignored.Unknown, "{ set.seed(7); round( rlnorm(3), digits = 5 ) }");
         assertEval(Ignored.Unknown, "{ set.seed(7); round( rlnorm(3,sdlog=c(10,3,0.5)), digits = 5 ) }");