Added: 
incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/copySign.java
URL: 
http://svn.apache.org/viewvc/incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/copySign.java?rev=668816&view=auto
==============================================================================
--- 
incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/copySign.java
 (added)
+++ 
incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/copySign.java
 Tue Jun 17 13:22:17 2008
@@ -0,0 +1,69 @@
+package org.apache.pig.piggybank.evaluation.math;
+
+import java.io.IOException;
+
+import org.apache.pig.EvalFunc;
+import org.apache.pig.data.DataAtom;
+import org.apache.pig.data.Tuple;
+import org.apache.pig.impl.logicalLayer.schema.AtomSchema;
+import org.apache.pig.impl.logicalLayer.schema.Schema;
+/**
+ * math.copySign implements a binding to the Java function
+* [EMAIL PROTECTED] java.lang.Math#copySign(double,double) 
Math.copySign(double,double)}. 
+* Given a tuple with two data atom Returns the first floating-point argument 
+* with the sign of the second floating-point argument.
+* 
+* <dl>
+* <dt><b>Parameters:</b></dt>
+* <dd><code>value</code> - <code>Tuple containing two DataAtom 
[double]</code>.</dd>
+* 
+* <dt><b>Return Value:</b></dt>
+* <dd><code>DataAtom [double]</code> </dd>
+* 
+* <dt><b>Return Schema:</b></dt>
+* <dd>copySign_inputSchema</dd>
+* 
+* <dt><b>Example:</b></dt>
+* <dd><code>
+* register math.jar;<br/>
+* A = load 'mydata' using PigStorage() as ( float1 );<br/>
+* B = foreach A generate float1, math.copySign(float1);
+* </code></dd>
+* </dl>
+* 
+* @see Math#copySign(double,double)
+* @see
+* @author ajay garg
+*
+*/
+public class copySign extends EvalFunc<DataAtom>{
+       /**
+        * java level API
+        * @param input expects a tuple containing two numeric DataAtom value
+        * @param output returns a single numeric DataAtom value, which is 
+        * first floating-point argument with the sign of the second 
+        * floating-point argument.
+        */
+       @Override
+       public void exec(Tuple input, DataAtom output) throws IOException {
+               output.setValue(cpySign(input));
+       }
+       
+       protected double cpySign(Tuple input) throws IOException{
+               try{
+                       double first =  input.getAtomField(0).numval();
+                       double second = input.getAtomField(1).numval();
+                       return Math.copySign(first, second);
+               }
+               catch(RuntimeException e){
+                       throw new IOException("invalid input "+e.getMessage());
+               }
+               
+       }
+       
+       @Override
+       public Schema outputSchema(Schema input) {
+               return new AtomSchema("copySign_"+input.toString()); 
+       }
+
+}

Added: 
incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/getExponent.java
URL: 
http://svn.apache.org/viewvc/incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/getExponent.java?rev=668816&view=auto
==============================================================================
--- 
incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/getExponent.java
 (added)
+++ 
incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/getExponent.java
 Tue Jun 17 13:22:17 2008
@@ -0,0 +1,75 @@
+package org.apache.pig.piggybank.evaluation.math;
+
+import java.io.IOException;
+
+import org.apache.pig.EvalFunc;
+import org.apache.pig.data.DataAtom;
+import org.apache.pig.data.Datum;
+import org.apache.pig.data.Tuple;
+import org.apache.pig.impl.logicalLayer.schema.AtomSchema;
+import org.apache.pig.impl.logicalLayer.schema.Schema;
+/**
+ * math.getExponent implements a binding to the Java function
+* [EMAIL PROTECTED] java.lang.Math#getExponent(double) 
Math.getExponent(double)}. 
+* Given a single data atom it returns the unbiased exponent used in 
+* the representation of a double
+* 
+* <dl>
+* <dt><b>Parameters:</b></dt>
+* <dd><code>value</code> - <code>DataAtom [double]</code>.</dd>
+* 
+* <dt><b>Return Value:</b></dt>
+* <dd><code>DataAtom [double]</code> </dd>
+* 
+* <dt><b>Return Schema:</b></dt>
+* <dd>getExponent_inputSchema</dd>
+* 
+* <dt><b>Example:</b></dt>
+* <dd><code>
+* register math.jar;<br/>
+* A = load 'mydata' using PigStorage() as ( float1 );<br/>
+* B = foreach A generate float1, math.getExponent(float1);
+* </code></dd>
+* </dl>
+* 
+* @see Math#getExponent(double)
+* @see
+* @author ajay garg
+*
+*/
+public class getExponent extends EvalFunc<DataAtom>{
+       /**
+        * java level API
+        * @param input expects a single numeric DataAtom value
+        * @param output returns a single numeric DataAtom value, unbiased 
+        * exponent used in the representation of a double
+        */
+       @Override
+       public void exec(Tuple input, DataAtom output) throws IOException {
+               output.setValue(getExp(input));
+       }
+       
+       protected double getExp(Tuple input) throws IOException{
+               Datum temp = input.getField(0);
+               double retVal;
+               if(!(temp instanceof DataAtom)){
+                       throw new IOException("invalid input format. ");
+               } 
+               else{
+                       try{
+                               retVal=((DataAtom)temp).numval();
+                       }
+                       catch(RuntimeException e){
+                               throw new IOException((DataAtom)temp+" is not a 
valid number");
+                       }
+               }
+               return Math.getExponent(retVal);
+               
+       }
+       
+       @Override
+       public Schema outputSchema(Schema input) {
+               return new AtomSchema("getExponent_"+input.toString()); 
+       }
+
+}

Added: 
incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/nextAfter.java
URL: 
http://svn.apache.org/viewvc/incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/nextAfter.java?rev=668816&view=auto
==============================================================================
--- 
incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/nextAfter.java
 (added)
+++ 
incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/nextAfter.java
 Tue Jun 17 13:22:17 2008
@@ -0,0 +1,71 @@
+package org.apache.pig.piggybank.evaluation.math;
+
+import java.io.IOException;
+
+import org.apache.pig.EvalFunc;
+import org.apache.pig.data.DataAtom;
+import org.apache.pig.data.Tuple;
+import org.apache.pig.impl.logicalLayer.schema.AtomSchema;
+import org.apache.pig.impl.logicalLayer.schema.Schema;
+/**
+ * math.nextAfter implements a binding to the Java function
+* [EMAIL PROTECTED] java.lang.Math#nextAfter(double,double) 
Math.nextAfter(double,double)}. 
+* Given a tuple with two data atom it Returns the 
+* floating-point number adjacent to the first argument in the 
+* direction of the second argument.
+* 
+* <dl>
+* <dt><b>Parameters:</b></dt>
+* <dd><code>value</code> - <code>Tuple containing two DataAtom 
[double]</code>.</dd>
+* 
+* <dt><b>Return Value:</b></dt>
+* <dd><code>DataAtom [double]</code> </dd>
+* 
+* <dt><b>Return Schema:</b></dt>
+* <dd>nextAfter_inputSchema</dd>
+* 
+* <dt><b>Example:</b></dt>
+* <dd><code>
+* register math.jar;<br/>
+* A = load 'mydata' using PigStorage() as ( float1 );<br/>
+* B = foreach A generate float1, math.nextAfter(float1);
+* </code></dd>
+* </dl>
+* 
+* @see Math#nextAfter(double,double)
+* @see
+* @author ajay garg
+*
+*/
+public class nextAfter extends EvalFunc<DataAtom>{
+       
+       /**
+        * java level API
+        * @param input expects a tuple containing two numeric DataAtom value
+        * @param output returns a single numeric DataAtom value, which is 
+        * the floating-point number adjacent to the first argument in the 
+        * direction of the second argument.
+        */
+       @Override
+       public void exec(Tuple input, DataAtom output) throws IOException {
+               output.setValue(nxtAfter(input));
+       }
+       
+       protected double nxtAfter(Tuple input) throws IOException{
+               try{
+                       double first = input.getAtomField(0).numval();
+                       double second = input.getAtomField(1).numval();
+                       return Math.nextAfter(first, second);
+               }
+               catch(RuntimeException e){
+                       throw new IOException("invalid input "+e.getMessage());
+               }
+               
+       }
+       
+       @Override
+       public Schema outputSchema(Schema input) {
+               return new AtomSchema("nextAfter_"+input.toString()); 
+       }
+
+}

Added: 
incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/toDegrees.java
URL: 
http://svn.apache.org/viewvc/incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/toDegrees.java?rev=668816&view=auto
==============================================================================
--- 
incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/toDegrees.java
 (added)
+++ 
incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/toDegrees.java
 Tue Jun 17 13:22:17 2008
@@ -0,0 +1,76 @@
+package org.apache.pig.piggybank.evaluation.math;
+
+import java.io.IOException;
+
+import org.apache.pig.EvalFunc;
+import org.apache.pig.data.DataAtom;
+import org.apache.pig.data.Datum;
+import org.apache.pig.data.Tuple;
+import org.apache.pig.impl.logicalLayer.schema.AtomSchema;
+import org.apache.pig.impl.logicalLayer.schema.Schema;
+/**
+ * math.toDegrees implements a binding to the Java function
+* [EMAIL PROTECTED] java.lang.Math#toDegrees(double) Math.toDegrees(double)}. 
+* Given a single data atom it Converts an angle measured in radians 
+* to an approximately equivalent angle measured in degrees.
+* 
+* <dl>
+* <dt><b>Parameters:</b></dt>
+* <dd><code>value</code> - <code>DataAtom [double]</code>.</dd>
+* 
+* <dt><b>Return Value:</b></dt>
+* <dd><code>DataAtom [double]</code> </dd>
+* 
+* <dt><b>Return Schema:</b></dt>
+* <dd>toDegrees_inputSchema</dd>
+* 
+* <dt><b>Example:</b></dt>
+* <dd><code>
+* register math.jar;<br/>
+* A = load 'mydata' using PigStorage() as ( float1 );<br/>
+* B = foreach A generate float1, math.toDegrees(float1);
+* </code></dd>
+* </dl>
+* 
+* @see Math#toDegrees(double)
+* @see
+* @author ajay garg
+*
+*/
+public class toDegrees extends EvalFunc<DataAtom>{
+       /**
+        * java level API
+        * @param input expects a single numeric DataAtom value
+        * @param output returns a single numeric DataAtom value, 
+        * which is conversion of angle measured in radians to approximately
+        * angle measured in Degrees 
+        */
+       @Override
+       public void exec(Tuple input, DataAtom output) throws IOException {
+               output.setValue(toDegree(input));
+       }
+       
+       protected double toDegree(Tuple input) throws IOException{
+               Datum temp = input.getField(0);
+               double retVal;
+               if(!(temp instanceof DataAtom)){
+                       throw new IOException("invalid input format. ");
+               } 
+               else{
+                       try{
+                               retVal=((DataAtom)temp).numval();
+                       }
+                       catch(RuntimeException e){
+                               throw new IOException((DataAtom)temp+" is not a 
valid number");
+                       }
+               }
+               return Math.toDegrees(retVal);
+               
+       }
+       
+       @Override
+       public Schema outputSchema(Schema input) {
+               return new AtomSchema("toDegrees_"+input.toString()); 
+       }
+
+}

Added: 
incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/toRadians.java
URL: 
http://svn.apache.org/viewvc/incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/toRadians.java?rev=668816&view=auto
==============================================================================
--- 
incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/toRadians.java
 (added)
+++ 
incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/toRadians.java
 Tue Jun 17 13:22:17 2008
@@ -0,0 +1,76 @@
+package org.apache.pig.piggybank.evaluation.math;
+
+import java.io.IOException;
+
+import org.apache.pig.EvalFunc;
+import org.apache.pig.data.DataAtom;
+import org.apache.pig.data.Datum;
+import org.apache.pig.data.Tuple;
+import org.apache.pig.impl.logicalLayer.schema.AtomSchema;
+import org.apache.pig.impl.logicalLayer.schema.Schema;
+/**
+ * math.toRadians implements a binding to the Java function
+* [EMAIL PROTECTED] java.lang.Math#toRadians(double) Math.toRadians(double)}. 
+* Given a single data atom it Converts an angle measured in degrees 
+* to an approximately equivalent angle measured in radians.
+* 
+* <dl>
+* <dt><b>Parameters:</b></dt>
+* <dd><code>value</code> - <code>DataAtom [double]</code>.</dd>
+* 
+* <dt><b>Return Value:</b></dt>
+* <dd><code>DataAtom [double]</code> </dd>
+* 
+* <dt><b>Return Schema:</b></dt>
+* <dd>toRadians_inputSchema</dd>
+* 
+* <dt><b>Example:</b></dt>
+* <dd><code>
+* register math.jar;<br/>
+* A = load 'mydata' using PigStorage() as ( float1 );<br/>
+* B = foreach A generate float1, math.toRadians(float1);
+* </code></dd>
+* </dl>
+* 
+* @see Math#toRadians(double)
+* @see
+* @author ajay garg
+*
+*/
+public class toRadians extends EvalFunc<DataAtom>{
+       /**
+        * java level API
+        * @param input expects a single numeric DataAtom value
+        * @param output returns a single numeric DataAtom value, 
+        * which is conversion of angle measured in degrees to approximately
+        * angle measured in radians 
+        */
+       @Override
+       public void exec(Tuple input, DataAtom output) throws IOException {
+               output.setValue(toRadian(input));
+       }
+       
+       protected double toRadian(Tuple input) throws IOException{
+               Datum temp = input.getField(0);
+               double retVal;
+               if(!(temp instanceof DataAtom)){
+                       throw new IOException("invalid input format. ");
+               } 
+               else{
+                       try{
+                               retVal=((DataAtom)temp).numval();
+                       }
+                       catch(RuntimeException e){
+                               throw new IOException((DataAtom)temp+" is not a 
valid number");
+                       }
+               }
+               return Math.toRadians(retVal);
+               
+       }
+       
+       @Override
+       public Schema outputSchema(Schema input) {
+               return new AtomSchema("toRadians_"+input.toString()); 
+       }
+
+}

Added: 
incubator/pig/trunk/contrib/piggybank/java/src/test/java/org/apache/pig/piggybank/test/evaluation/TestMathUDF.java
URL: 
http://svn.apache.org/viewvc/incubator/pig/trunk/contrib/piggybank/java/src/test/java/org/apache/pig/piggybank/test/evaluation/TestMathUDF.java?rev=668816&view=auto
==============================================================================
--- 
incubator/pig/trunk/contrib/piggybank/java/src/test/java/org/apache/pig/piggybank/test/evaluation/TestMathUDF.java
 (added)
+++ 
incubator/pig/trunk/contrib/piggybank/java/src/test/java/org/apache/pig/piggybank/test/evaluation/TestMathUDF.java
 Tue Jun 17 13:22:17 2008
@@ -0,0 +1,447 @@
+package org.apache.pig.piggybank.test.evaluation;
+
+import org.apache.pig.piggybank.evaluation.math.ABS;
+import org.apache.pig.piggybank.evaluation.math.ACOS;
+import org.apache.pig.piggybank.evaluation.math.ASIN;
+import org.apache.pig.piggybank.evaluation.math.ATAN;
+import org.apache.pig.piggybank.evaluation.math.ATAN2;
+import org.apache.pig.piggybank.evaluation.math.CBRT;
+import org.apache.pig.piggybank.evaluation.math.CEIL;
+import org.apache.pig.piggybank.evaluation.math.COS;
+import org.apache.pig.piggybank.evaluation.math.COSH;
+import org.apache.pig.piggybank.evaluation.math.EXP;
+import org.apache.pig.piggybank.evaluation.math.EXPM1;
+import org.apache.pig.piggybank.evaluation.math.FLOOR;
+import org.apache.pig.piggybank.evaluation.math.HYPOT;
+import org.apache.pig.piggybank.evaluation.math.IEEEremainder;
+import org.apache.pig.piggybank.evaluation.math.LOG;
+import org.apache.pig.piggybank.evaluation.math.LOG10;
+import org.apache.pig.piggybank.evaluation.math.LOG1P;
+import org.apache.pig.piggybank.evaluation.math.MAX;
+import org.apache.pig.piggybank.evaluation.math.MIN;
+import org.apache.pig.piggybank.evaluation.math.POW;
+import org.apache.pig.piggybank.evaluation.math.RINT;
+import org.apache.pig.piggybank.evaluation.math.ROUND;
+import org.apache.pig.piggybank.evaluation.math.SCALB;
+import org.apache.pig.piggybank.evaluation.math.SIGNUM;
+import org.apache.pig.piggybank.evaluation.math.SIN;
+import org.apache.pig.piggybank.evaluation.math.SINH;
+import org.apache.pig.piggybank.evaluation.math.SQRT;
+import org.apache.pig.piggybank.evaluation.math.TAN;
+import org.apache.pig.piggybank.evaluation.math.TANH;
+import org.apache.pig.piggybank.evaluation.math.ULP;
+import org.apache.pig.piggybank.evaluation.math.copySign;
+import org.apache.pig.piggybank.evaluation.math.getExponent;
+import org.apache.pig.piggybank.evaluation.math.nextAfter;
+import org.apache.pig.piggybank.evaluation.math.toDegrees;
+import org.apache.pig.piggybank.evaluation.math.toRadians;
+
+import org.apache.pig.EvalFunc;
+import org.apache.pig.data.DataAtom;
+import org.apache.pig.data.Tuple;
+
+
+import junit.framework.TestCase;
+
+public class TestMathUDF extends TestCase{
+    public double delta = 0.001;
+    
+        public void testABS() throws Exception {
+               EvalFunc<DataAtom> ABS = new ABS();
+               Tuple tup = new Tuple(1);
+               tup.setField(0, -1.0);
+               DataAtom output = new DataAtom();
+               ABS.exec(tup, output);
+               double expected = 1.0;
+               double actual = (new Double(output.strval())).doubleValue();
+            assertEquals(actual, expected, delta);
+           }
+        
+        
+        public void testACOS() throws Exception {
+               EvalFunc<DataAtom> ACOS = new ACOS();
+               Tuple tup = new Tuple(1);
+               tup.setField(0, 0.5);
+               DataAtom output = new DataAtom();
+               ACOS.exec(tup, output);
+               double expected = Math.acos(0.5);
+               double actual = (new Double(output.strval())).doubleValue();
+               assertEquals(actual, expected, delta);
+           }
+        
+        
+        public void testASIN() throws Exception {
+               EvalFunc<DataAtom> ASIN = new ASIN();
+               Tuple tup = new Tuple(1);
+               tup.setField(0, 0.5);
+               DataAtom output = new DataAtom();
+               ASIN.exec(tup, output);
+               double expected = Math.asin(0.5);
+               double actual = (new Double(output.strval())).doubleValue();
+               assertEquals(actual, expected, delta);
+           }
+        
+        public void testATAN() throws Exception {
+               EvalFunc<DataAtom> ATAN = new ATAN();
+               Tuple tup = new Tuple(1);
+               tup.setField(0, 0.5);
+               DataAtom output = new DataAtom();
+               ATAN.exec(tup, output);
+               double expected = Math.atan(0.5);
+               double actual = (new Double(output.strval())).doubleValue();
+               assertEquals(actual, expected, delta);
+           }
+        
+        public void testATAN2() throws Exception {
+               EvalFunc<DataAtom> ATAN2 = new ATAN2();
+               Tuple tup = new Tuple(2);
+               tup.setField(0, 0.5);
+               tup.setField(1,0.6);
+               DataAtom output = new DataAtom();
+               ATAN2.exec(tup, output);
+               double expected = Math.atan2(0.5,0.6);
+               double actual = (new Double(output.strval())).doubleValue();
+               assertEquals(actual, expected, delta);
+           }
+        
+        public void testCBRT() throws Exception{
+                       EvalFunc<DataAtom> CBRT = new CBRT();
+               Tuple tup = new Tuple(1);
+               tup.setField(0, 0.5);
+               DataAtom output = new DataAtom();
+               CBRT.exec(tup, output);
+               double expected = Math.cbrt(0.5);
+               double actual = (new Double(output.strval())).doubleValue();
+               assertEquals(actual, expected, delta);
+        }
+        
+        public void testCEIL() throws Exception{
+                       EvalFunc<DataAtom> CEIL = new CEIL();
+               Tuple tup = new Tuple(1);
+               tup.setField(0, 0.5);
+               DataAtom output = new DataAtom();
+               CEIL.exec(tup, output);
+               double expected = Math.ceil(0.5);
+               double actual = (new Double(output.strval())).doubleValue();
+               assertEquals(actual, expected, delta);
+        }
+        
+        public void testcopySign() throws Exception {
+               EvalFunc<DataAtom> copySign = new copySign();
+               Tuple tup = new Tuple(2);
+               tup.setField(0, -0.5);
+               tup.setField(1,0.6);
+               DataAtom output = new DataAtom();
+               copySign.exec(tup, output);
+               double expected = Math.copySign(-0.5,0.6);
+               double actual = (new Double(output.strval())).doubleValue();
+               assertEquals(actual, expected, delta);
+           }
+        
+        public void testCOS() throws Exception{
+                       EvalFunc<DataAtom> COS = new COS();
+               Tuple tup = new Tuple(1);
+               tup.setField(0, 0.5);
+               DataAtom output = new DataAtom();
+               COS.exec(tup, output);
+               double expected = Math.cos(0.5);
+               double actual = (new Double(output.strval())).doubleValue();
+               assertEquals(actual, expected, delta);
+        }
+        
+        public void testCOSH() throws Exception{
+                       EvalFunc<DataAtom> COSH = new COSH();
+               Tuple tup = new Tuple(1);
+               tup.setField(0, 0.5);
+               DataAtom output = new DataAtom();
+               COSH.exec(tup, output);
+               double expected = Math.cosh(0.5);
+               double actual = (new Double(output.strval())).doubleValue();
+               assertEquals(actual, expected, delta);
+        }
+        
+        public void testEXP() throws Exception{
+                       EvalFunc<DataAtom> EXP = new EXP();
+               Tuple tup = new Tuple(1);
+               tup.setField(0, 0.5);
+               DataAtom output = new DataAtom();
+               EXP.exec(tup, output);
+               double expected = Math.exp(0.5);
+               double actual = (new Double(output.strval())).doubleValue();
+               assertEquals(actual, expected, delta);
+        }
+        
+        public void testEXPM1() throws Exception{
+                       EvalFunc<DataAtom> EXPM1 = new EXPM1();
+               Tuple tup = new Tuple(1);
+               tup.setField(0, 0.5);
+               DataAtom output = new DataAtom();
+               EXPM1.exec(tup, output);
+               double expected = Math.expm1(0.5);
+               double actual = (new Double(output.strval())).doubleValue();
+               assertEquals(actual, expected, delta);
+        }
+        
+        public void testFLOOR() throws Exception{
+                       EvalFunc<DataAtom> FLOOR = new FLOOR();
+               Tuple tup = new Tuple(1);
+               tup.setField(0, 0.5);
+               DataAtom output = new DataAtom();
+               FLOOR.exec(tup, output);
+               double expected = Math.floor(0.5);
+               double actual = (new Double(output.strval())).doubleValue();
+               assertEquals(actual, expected, delta);
+        }
+        
+        public void testgetExponent() throws Exception{
+                       EvalFunc<DataAtom> getExponent = new getExponent();
+               Tuple tup = new Tuple(1);
+               tup.setField(0, -0.5);
+               DataAtom output = new DataAtom();
+               getExponent.exec(tup, output);
+               double expected = Math.getExponent(-0.5);
+               double actual = (new Double(output.strval())).doubleValue();
+               assertEquals(actual, expected, delta);
+        }
+        
+        public void testHYPOT() throws Exception {
+               EvalFunc<DataAtom> HYPOT = new HYPOT();
+               Tuple tup = new Tuple(2);
+               tup.setField(0, -0.5);
+               tup.setField(1,0.6);
+               DataAtom output = new DataAtom();
+               HYPOT.exec(tup, output);
+               double expected = Math.hypot(-0.5,0.6);
+               double actual = (new Double(output.strval())).doubleValue();
+               assertEquals(actual, expected, delta);
+           }
+        
+        public void testIEEEremainder() throws Exception {
+               EvalFunc<DataAtom> IEEEremainder = new IEEEremainder();
+               Tuple tup = new Tuple(2);
+               tup.setField(0, -0.5);
+               tup.setField(1,0.6);
+               DataAtom output = new DataAtom();
+               IEEEremainder.exec(tup, output);
+               double expected = Math.IEEEremainder(-0.5,0.6);
+               double actual = (new Double(output.strval())).doubleValue();
+               assertEquals(actual, expected, delta);
+           }
+        
+        public void testLOG() throws Exception{
+                       EvalFunc<DataAtom> LOG = new LOG();
+               Tuple tup = new Tuple(1);
+               tup.setField(0, 0.5);
+               DataAtom output = new DataAtom();
+               LOG.exec(tup, output);
+               double expected = Math.log(0.5);
+               double actual = (new Double(output.strval())).doubleValue();
+               assertEquals(actual, expected, delta);
+        }
+        
+        public void testLOG10() throws Exception{
+                       EvalFunc<DataAtom> LOG10 = new LOG10();
+               Tuple tup = new Tuple(1);
+               tup.setField(0, 0.5);
+               DataAtom output = new DataAtom();
+               LOG10.exec(tup, output);
+               double expected = Math.log10(0.5);
+               double actual = (new Double(output.strval())).doubleValue();
+               assertEquals(actual, expected, delta);
+        }
+        
+        public void testLOG1P() throws Exception{
+                       EvalFunc<DataAtom> LOG1P = new LOG1P();
+               Tuple tup = new Tuple(1);
+               tup.setField(0, 0.5);
+               DataAtom output = new DataAtom();
+               LOG1P.exec(tup, output);
+               double expected = Math.log1p(0.5);
+               double actual = (new Double(output.strval())).doubleValue();
+               assertEquals(actual, expected, delta);
+        }
+        
+        public void testMAX() throws Exception {
+               EvalFunc<DataAtom> MAX = new MAX();
+               Tuple tup = new Tuple(2);
+               tup.setField(0, -0.5);
+               tup.setField(1,0.6);
+               DataAtom output = new DataAtom();
+               MAX.exec(tup, output);
+               double expected = Math.max(-0.5,0.6);
+               double actual = (new Double(output.strval())).doubleValue();
+               assertEquals(actual, expected, delta);
+           }
+        
+        public void testMIN() throws Exception {
+               EvalFunc<DataAtom> MIN = new MIN();
+               Tuple tup = new Tuple(2);
+               tup.setField(0, -0.5);
+               tup.setField(1,0.6);
+               DataAtom output = new DataAtom();
+               MIN.exec(tup, output);
+               double expected = Math.min(-0.5,0.6);
+               double actual = (new Double(output.strval())).doubleValue();
+               assertEquals(actual, expected, delta);
+           }
+        
+        public void testnextAfter() throws Exception {
+               EvalFunc<DataAtom> nextAfter = new nextAfter();
+               Tuple tup = new Tuple(2);
+               tup.setField(0, -0.5);
+               tup.setField(1,0.6);
+               DataAtom output = new DataAtom();
+               nextAfter.exec(tup, output);
+               double expected = Math.nextAfter(-0.5,0.6);
+               double actual = (new Double(output.strval())).doubleValue();
+               assertEquals(actual, expected, delta);
+           }
+        
+        
+        public void testPOW() throws Exception {
+               EvalFunc<DataAtom> POW = new POW();
+               Tuple tup = new Tuple(2);
+               tup.setField(0, 0.5);
+               tup.setField(1,0.6);
+               DataAtom output = new DataAtom();
+               POW.exec(tup, output);
+               double expected = Math.pow(0.5,0.6);
+               double actual = (new Double(output.strval())).doubleValue();
+               assertEquals(actual, expected, delta);
+           }
+        
+        
+        public void testRINT() throws Exception{
+                       EvalFunc<DataAtom> RINT = new RINT();
+               Tuple tup = new Tuple(1);
+               tup.setField(0, -0.5);
+               DataAtom output = new DataAtom();
+               RINT.exec(tup, output);
+               double expected = Math.rint(0.5);
+               double actual = (new Double(output.strval())).doubleValue();
+               assertEquals(actual, expected, delta);
+        }
+        
+        public void testROUND() throws Exception{
+                       EvalFunc<DataAtom> ROUND = new ROUND();
+               Tuple tup = new Tuple(1);
+               tup.setField(0, 0.5);
+               DataAtom output = new DataAtom();
+               ROUND.exec(tup, output);
+               double expected = Math.round(0.5);
+               double actual = (new Double(output.strval())).doubleValue();
+               assertEquals(actual, expected, delta);
+        }
+        
+        public void testSCALB() throws Exception {
+               EvalFunc<DataAtom> SCALB = new SCALB();
+               Tuple tup = new Tuple(2);
+               tup.setField(0, 1);
+               tup.setField(1,2);
+               DataAtom output = new DataAtom();
+               SCALB.exec(tup, output);
+               double expected = Math.scalb(1,2);
+               double actual = (new Double(output.strval())).doubleValue();
+               assertEquals(actual, expected, delta);
+           }
+        
+        public void testSIGNUM() throws Exception{
+                       EvalFunc<DataAtom> SIGNUM = new SIGNUM();
+               Tuple tup = new Tuple(1);
+               tup.setField(0, 0.5);
+               DataAtom output = new DataAtom();
+               SIGNUM.exec(tup, output);
+               double expected = Math.signum(0.5);
+               double actual = (new Double(output.strval())).doubleValue();
+               assertEquals(actual, expected, delta);
+        }
+        
+        public void testSIN() throws Exception{
+                       EvalFunc<DataAtom> SIN = new SIN();
+               Tuple tup = new Tuple(1);
+               tup.setField(0, 0.5);
+               DataAtom output = new DataAtom();
+               SIN.exec(tup, output);
+               double expected = Math.sin(0.5);
+               double actual = (new Double(output.strval())).doubleValue();
+               assertEquals(actual, expected, delta);
+        }
+        
+        public void testSINH() throws Exception{
+                       EvalFunc<DataAtom> SINH = new SINH();
+               Tuple tup = new Tuple(1);
+               tup.setField(0, 0.5);
+               DataAtom output = new DataAtom();
+               SINH.exec(tup, output);
+               double expected = Math.sinh(0.5);
+               double actual = (new Double(output.strval())).doubleValue();
+               assertEquals(actual, expected, delta);
+        }
+        
+        public void testSQRT() throws Exception{
+                       EvalFunc<DataAtom> SQRT = new SQRT();
+               Tuple tup = new Tuple(1);
+               tup.setField(0, 0.5);
+               DataAtom output = new DataAtom();
+               SQRT.exec(tup, output);
+               double expected = Math.sqrt(0.5);
+               double actual = (new Double(output.strval())).doubleValue();
+               assertEquals(actual, expected, delta);
+        }
+        
+        public void testTAN() throws Exception{
+                       EvalFunc<DataAtom> TAN = new TAN();
+               Tuple tup = new Tuple(1);
+               tup.setField(0, 0.5);
+               DataAtom output = new DataAtom();
+               TAN.exec(tup, output);
+               double expected = Math.tan(0.5);
+               double actual = (new Double(output.strval())).doubleValue();
+               assertEquals(actual, expected, delta);
+        }
+        
+        public void testTANH() throws Exception{
+                       EvalFunc<DataAtom> TANH = new TANH();
+               Tuple tup = new Tuple(1);
+               tup.setField(0, 0.5);
+               DataAtom output = new DataAtom();
+               TANH.exec(tup, output);
+               double expected = Math.tanh(0.5);
+               double actual = (new Double(output.strval())).doubleValue();
+               assertEquals(actual, expected, delta);
+        }
+        
+        public void testtoDegree() throws Exception{
+                       EvalFunc<DataAtom> toDegrees = new toDegrees();
+               Tuple tup = new Tuple(1);
+               tup.setField(0, 0.5);
+               DataAtom output = new DataAtom();
+               toDegrees.exec(tup, output);
+               double expected = Math.toDegrees(0.5);
+               double actual = (new Double(output.strval())).doubleValue();
+               assertEquals(actual, expected, delta);
+        }
+        
+        public void testtoRadians() throws Exception{
+                       EvalFunc<DataAtom> toRadians = new toRadians();
+               Tuple tup = new Tuple(1);
+               tup.setField(0, 0.5);
+               DataAtom output = new DataAtom();
+               toRadians.exec(tup, output);
+               double expected = Math.toRadians(0.5);
+               double actual = (new Double(output.strval())).doubleValue();
+               assertEquals(actual, expected, delta);
+        }
+        
+        public void testULP() throws Exception{
+                       EvalFunc<DataAtom> ULP = new ULP();
+               Tuple tup = new Tuple(1);
+               tup.setField(0, 0.5);
+               DataAtom output = new DataAtom();
+               ULP.exec(tup, output);
+               double expected = Math.ulp(0.5);
+               double actual = (new Double(output.strval())).doubleValue();
+               assertEquals(actual, expected, delta);
+        }
+        
+}


Reply via email to