This is the mail archive of the frysk-cvs@sources.redhat.com mailing list for the frysk project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[SCM] master: Delete BigFloat.


The branch, master has been updated
       via  6de3d6b5f2a17f4db1c82ea6c217b16117a0cf8c (commit)
      from  33a27f5819580a5e4d175f908fc9ed9a18b5ec3e (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email.

- Log -----------------------------------------------------------------
commit 6de3d6b5f2a17f4db1c82ea6c217b16117a0cf8c
Author: Teresa <tthomas@redhat.com>
Date:   Thu Jan 17 16:36:33 2008 -0500

    Delete BigFloat.
    
    frysk-core/frysk/value/ChangeLog
    2008-01-17  Teresa Thomas  <tthomas@redhat.com>
    
    	* BigFloat.java: Delete.
    	* TestBigFloat.java: Delete.
    	* ArithmeticType.java (getBigFloat): Delete.
    	(bigFloatValue): Delete.
    	* IntegerType.java (getBigFloat): Delete.
    	(bigFloatValue): Delete.
    	* FloatingPointType.java (getBigFloat): Delete.
    	(bigFloatValue): Delete.
    	* TestIntegerType.java (testBigFloatValue): Update.
    	* TestFormat.java (checkFormat): Update.

-----------------------------------------------------------------------

Summary of changes:
 frysk-core/frysk/value/ArithmeticType.java    |   10 --
 frysk-core/frysk/value/BigFloat.java          |   98 ------------------
 frysk-core/frysk/value/ChangeLog              |   13 +++-
 frysk-core/frysk/value/FloatingPointType.java |   11 --
 frysk-core/frysk/value/IntegerType.java       |    7 --
 frysk-core/frysk/value/TestBigFloat.java      |  132 -------------------------
 frysk-core/frysk/value/TestFloatingPoint.java |    8 +-
 frysk-core/frysk/value/TestFormat.java        |    4 +-
 frysk-core/frysk/value/TestIntegerType.java   |    3 +-
 9 files changed, 20 insertions(+), 266 deletions(-)
 delete mode 100644 frysk-core/frysk/value/BigFloat.java
 delete mode 100644 frysk-core/frysk/value/TestBigFloat.java

First 500 lines of diff:
diff --git a/frysk-core/frysk/value/ArithmeticType.java b/frysk-core/frysk/value/ArithmeticType.java
index 0dadf8a..170bac7 100644
--- a/frysk-core/frysk/value/ArithmeticType.java
+++ b/frysk-core/frysk/value/ArithmeticType.java
@@ -121,11 +121,6 @@ public abstract class ArithmeticType
     abstract BigInteger getBigInteger(Location location);
     /**
      * Return the entire location, interpreting the raw bytes as a
-     * floating-point value.  This does not do type-conversion.
-     */
-    abstract BigFloat getBigFloat(Location location);
-    /**
-     * Return the entire location, interpreting the raw bytes as a
      * floating-point value.  
      */
     abstract BigFloatingPoint getBigFloatingPoint(Location location);
@@ -146,9 +141,4 @@ public abstract class ArithmeticType
      * involve truncation and/or rounding.
      */
     abstract BigInteger bigIntegerValue(Location location);
-    /**
-     * Return the arthmetic type converted to a BigFloat, this may
-     * involve truncation and/or rounding.
-     */
-    abstract BigFloat bigFloatValue(Location location);
 }
diff --git a/frysk-core/frysk/value/BigFloat.java b/frysk-core/frysk/value/BigFloat.java
deleted file mode 100644
index 6f2a424..0000000
--- a/frysk-core/frysk/value/BigFloat.java
+++ /dev/null
@@ -1,98 +0,0 @@
-// This file is part of the program FRYSK.
-//
-// Copyright 2007, Red Hat Inc.
-//
-// FRYSK is free software; you can redistribute it and/or modify it
-// under the terms of the GNU General Public License as published by
-// the Free Software Foundation; version 2 of the License.
-//
-// FRYSK is distributed in the hope that it will be useful, but
-// WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// General Public License for more details.
-// 
-// You should have received a copy of the GNU General Public License
-// along with FRYSK; if not, write to the Free Software Foundation,
-// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
-// 
-// In addition, as a special exception, Red Hat, Inc. gives You the
-// additional right to link the code of FRYSK with code not covered
-// under the GNU General Public License ("Non-GPL Code") and to
-// distribute linked combinations including the two, subject to the
-// limitations in this paragraph. Non-GPL Code permitted under this
-// exception must only link to the code of FRYSK through those well
-// defined interfaces identified in the file named EXCEPTION found in
-// the source code files (the "Approved Interfaces"). The files of
-// Non-GPL Code may instantiate templates or use macros or inline
-// functions from the Approved Interfaces without causing the
-// resulting work to be covered by the GNU General Public
-// License. Only Red Hat, Inc. may make changes or additions to the
-// list of Approved Interfaces. You must obey the GNU General Public
-// License in all respects for all of the FRYSK code and other code
-// used in conjunction with FRYSK except the Non-GPL Code covered by
-// this exception. If you modify this file, you may extend this
-// exception to your version of the file, but you are not obligated to
-// do so. If you do not wish to provide this exception without
-// modification, you must delete this exception statement from your
-// version and license this file solely under the GPL without
-// exception.
-
-package frysk.value;
-
-import java.math.BigInteger;
-
-/**
- * Type a "portable" floating-point type.
- *
- * This is currently implemented as a quick hack using "double".
- */
-public class BigFloat
-{
-    /**
-     * Underlying value.  Delay conversion until the target value is
-     * known so that rounding and truncation errors don't come in to
-     * play when needed.
-     */
-    private final Number value;
-    /**
-     * Create a BigFloat by converting the big-integer to
-     * floating-point; may involve rounding.
-     */
-    BigFloat(BigInteger value) {
-	this.value = value;
-    }
-    /**
-     * Create a BigFloat from the big-endian raw bytes; if the byte
-     * buffer isn't exactly 4 or 8 bytes, the value will be truncated
-     * to fit.
-     */
-    BigFloat(byte[] bytes) {
-	BigInteger b = new BigInteger(bytes);
-	if (bytes.length < 8)
-	    value = new Float(Float.intBitsToFloat(b.intValue()));
-	else
-	    value = new Double(Double.longBitsToDouble(b.longValue()));
-    }
-    BigInteger bigIntegerValue() {
-	return BigInteger.valueOf(value.longValue());
-    }
-    double doubleValue() {
-	return value.doubleValue();
-    }
-    float floatValue() {
-	return value.floatValue();
-    }
-
-    byte[] toByteArray(int size) {
-	switch (size) {
-	case 4:
-	    return BigInteger.valueOf(Float.floatToRawIntBits(value.floatValue()))
-		.toByteArray();
-	case 8:
-	    return BigInteger.valueOf(Double.doubleToRawLongBits(value.doubleValue()))
-		.toByteArray();
-	default:
-	    return new byte[0];
-	}
-    }
-}
diff --git a/frysk-core/frysk/value/ChangeLog b/frysk-core/frysk/value/ChangeLog
index 143e9fe..9a5615e 100644
--- a/frysk-core/frysk/value/ChangeLog
+++ b/frysk-core/frysk/value/ChangeLog
@@ -1,5 +1,16 @@
 2008-01-17  Teresa Thomas  <tthomas@redhat.com>
 
+	* BigFloat.java: Delete.
+	* TestBigFloat.java: Delete.
+	* ArithmeticType.java (getBigFloat): Delete.
+	(bigFloatValue): Delete.
+	* IntegerType.java (getBigFloat): Delete.
+	(bigFloatValue): Delete.
+	* FloatingPointType.java (getBigFloat): Delete.
+	(bigFloatValue): Delete.
+	* TestIntegerType.java (testBigFloatValue): Update.
+	* TestFormat.java (checkFormat): Update.	
+
 	* Value.java (asBigFloatingPoint): New.
 	(doubleValue): Use BigFloatingPoint.
 	* IntegerType.java (getBigFloatingPoint): New.
@@ -8,7 +19,7 @@
 	(bigFloatingPointValue): New.
 	(assign): Use BigFloatingPoint.
 	* ArithmeticType.java (getBigFloatingPoint): New
-	(bigFloatingPointValue): New.
+	(bigFloatingPointValue): New. 
 	* Format.java (printFloatingPoint): Use BigFloatingPoint.
 	
 	* FloatingPointFormat.java: New.
diff --git a/frysk-core/frysk/value/FloatingPointType.java b/frysk-core/frysk/value/FloatingPointType.java
index 55123c7..88ad4df 100644
--- a/frysk-core/frysk/value/FloatingPointType.java
+++ b/frysk-core/frysk/value/FloatingPointType.java
@@ -92,14 +92,6 @@ public class FloatingPointType
     void putBigInteger(Location location, BigInteger val) {
 	location.put(order(), val.toByteArray(), 0);
     }
-
-    BigFloat getBigFloat(Location location) {
-	return new BigFloat(location.get(order()));
-    }
-
-    BigFloat bigFloatValue(Location location) {
-	return getBigFloat(location);
-    }
    
     BigFloatingPoint getBigFloatingPoint(Location location) {
     	return format.unpack(location.get(order()));
@@ -114,9 +106,6 @@ public class FloatingPointType
     }
 
     void assign(Location location, Value v) {
-//    	BigFloat f = ((ArithmeticType)v.getType())
-//    	.bigFloatValue(v.getLocation());
-//    	location.put(order(), f.toByteArray(getSize()), 0);
     	BigFloatingPoint f = ((FloatingPointType)v.getType()).bigFloatingPointValue(v.getLocation());
     	location.put(order(), format.pack(f, getSize()), 0);
     }
diff --git a/frysk-core/frysk/value/IntegerType.java b/frysk-core/frysk/value/IntegerType.java
index 37a6f97..1cf7b48 100644
--- a/frysk-core/frysk/value/IntegerType.java
+++ b/frysk-core/frysk/value/IntegerType.java
@@ -60,16 +60,9 @@ public abstract class IntegerType
 	format.print(writer, location, this);
     }
 
-    BigFloat getBigFloat(Location location) {
-	return new BigFloat(location.get(order()));
-    }
-
     BigInteger bigIntegerValue(Location location) {
 	return getBigInteger(location);
     }
-    BigFloat bigFloatValue(Location location) {
-	return new BigFloat(getBigInteger(location));
-    }
     
     BigFloatingPoint getBigFloatingPoint(Location location) {
     	return new BigFloatingPoint(bigIntegerValue(location));
diff --git a/frysk-core/frysk/value/TestBigFloat.java b/frysk-core/frysk/value/TestBigFloat.java
deleted file mode 100644
index dd1bf45..0000000
--- a/frysk-core/frysk/value/TestBigFloat.java
+++ /dev/null
@@ -1,132 +0,0 @@
-// This file is part of the program FRYSK.
-//
-// Copyright 2007, Red Hat Inc.
-//
-// FRYSK is free software; you can redistribute it and/or modify it
-// under the terms of the GNU General Public License as published by
-// the Free Software Foundation; version 2 of the License.
-//
-// FRYSK is distributed in the hope that it will be useful, but
-// WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// General Public License for more details.
-// 
-// You should have received a copy of the GNU General Public License
-// along with FRYSK; if not, write to the Free Software Foundation,
-// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
-// 
-// In addition, as a special exception, Red Hat, Inc. gives You the
-// additional right to link the code of FRYSK with code not covered
-// under the GNU General Public License ("Non-GPL Code") and to
-// distribute linked combinations including the two, subject to the
-// limitations in this paragraph. Non-GPL Code permitted under this
-// exception must only link to the code of FRYSK through those well
-// defined interfaces identified in the file named EXCEPTION found in
-// the source code files (the "Approved Interfaces"). The files of
-// Non-GPL Code may instantiate templates or use macros or inline
-// functions from the Approved Interfaces without causing the
-// resulting work to be covered by the GNU General Public
-// License. Only Red Hat, Inc. may make changes or additions to the
-// list of Approved Interfaces. You must obey the GNU General Public
-// License in all respects for all of the FRYSK code and other code
-// used in conjunction with FRYSK except the Non-GPL Code covered by
-// this exception. If you modify this file, you may extend this
-// exception to your version of the file, but you are not obligated to
-// do so. If you do not wish to provide this exception without
-// modification, you must delete this exception statement from your
-// version and license this file solely under the GPL without
-// exception.
-
-package frysk.value;
-
-import java.math.BigInteger;
-import frysk.junit.TestCase;
-
-/**
- * Type a "portable" floating-point type.
- *
- * This is currently implemented as a quick hack using "double".
- */
-public class TestBigFloat
-    extends TestCase
-{
-    /**
-     * Pass when CORRECT is exactly (i.e., bitwize) equal to TEST.
-     */
-    static void checkEquals(String what, double correct, double test) {
-	if (Double.doubleToRawLongBits(correct)
-	    != Double.doubleToRawLongBits(test)) {
-	    fail(what
-		 + ": expected <" + correct + ">"
-		 + " got <" + test + ">");
-	}
-    }
-
-    static final byte[] FLOAT_HALF = new byte[] {
-	0x3f, 0x00, 0x00, 0x00
-    };
-    static final byte[] FLOAT_NEGATIVE_ZERO = new byte[] {
-	(byte)0x80, 0x00, 0x00, 0x00
-    };
-    static final byte[] FLOAT_POSITIVE_ZERO = new byte[] {
-	0x00, 0x00, 0x00, 0x00
-    };
-    static final byte[] FLOAT_ONE = new byte[] {
-	0x3f, (byte)0x80, 0x00, 0x00
-    };
-    static final byte[] FLOAT_TWO = new byte[] {
-	0x40, 0x00, 0x00, 0x00
-    };
-
-    static final byte[] DOUBLE_HALF = new byte[] {
-	0x3f, (byte)0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
-    };
-    static final byte[] DOUBLE_NEGATIVE_ZERO = new byte[] {
-	(byte)0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
-    };
-    static final byte[] DOUBLE_POSITIVE_ZERO = new byte[] {
-	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
-    };
-    static final byte[] DOUBLE_ONE = new byte[] {
-	0x3f, (byte)0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
-    };
-    static final byte[] DOUBLE_TWO = new byte[] {
-	0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
-    };
-
-    public void testFromBigInt() {
-	BigFloat f = new BigFloat(new BigInteger(new byte[] { 1 }));
-	checkEquals("float", 1.0, f.doubleValue());
-    }
-
-    public void testFromBytes() {
-	checkEquals("float .5", 0.5,
-		     new BigFloat(FLOAT_HALF).doubleValue());
-	checkEquals("float -0", -0.0,
-		     new BigFloat(FLOAT_NEGATIVE_ZERO).doubleValue());
-	checkEquals("float +0", +0.0,
-		     new BigFloat(FLOAT_POSITIVE_ZERO).doubleValue());
-	checkEquals("float 1", 1.0,
-		     new BigFloat(FLOAT_ONE).doubleValue());
-	checkEquals("float 2", 2.0,
-		     new BigFloat(FLOAT_TWO).doubleValue());
-
-	checkEquals("double .5", 0.5,
-		     new BigFloat(DOUBLE_HALF).doubleValue());
-	checkEquals("double -0", -0.0,
-		     new BigFloat(DOUBLE_NEGATIVE_ZERO).doubleValue());
-	checkEquals("double +0", +0.0,
-		     new BigFloat(DOUBLE_POSITIVE_ZERO).doubleValue());
-	checkEquals("double 1", 1.0,
-		     new BigFloat(DOUBLE_ONE).doubleValue());
-	checkEquals("double 2", 2.0,
-		     new BigFloat(DOUBLE_TWO).doubleValue());
-    }
-
-    public void testToByteArray() {
-	assertEquals("float to double", DOUBLE_ONE,
-		     new BigFloat(FLOAT_ONE).toByteArray(8));
-	assertEquals("double to float", FLOAT_ONE,
-		     new BigFloat(DOUBLE_ONE).toByteArray(4));
-    }
-}
diff --git a/frysk-core/frysk/value/TestFloatingPoint.java b/frysk-core/frysk/value/TestFloatingPoint.java
index ac8a857..5bee28c 100644
--- a/frysk-core/frysk/value/TestFloatingPoint.java
+++ b/frysk-core/frysk/value/TestFloatingPoint.java
@@ -50,13 +50,13 @@ public class TestFloatingPoint
 {
     public void testBigIntegerValue() {
 	FloatingPointType t = new FloatingPointType("type", ByteOrder.BIG_ENDIAN, 4);
-	Location l = new ScratchLocation(TestBigFloat.FLOAT_ONE);
+	Location l = new ScratchLocation(TestFloatingPoint854Format.FLOAT_ONE);
 	assertEquals("float", 1, t.bigIntegerValue(l).longValue());
     }
     public void testBigFloatValue() {
 	FloatingPointType t = new FloatingPointType("type", ByteOrder.BIG_ENDIAN, 4);
-	Location l = new ScratchLocation(TestBigFloat.FLOAT_ONE);
-	TestBigFloat.checkEquals("float", 1.0,
-				 t.bigFloatValue(l).doubleValue());
+	Location l = new ScratchLocation(TestFloatingPoint854Format.FLOAT_ONE);
+	TestFloatingPoint854Format.checkEquals("float", new BigFloatingPoint("1.0"),
+			                       t.bigFloatingPointValue(l));
     }
 }
diff --git a/frysk-core/frysk/value/TestFormat.java b/frysk-core/frysk/value/TestFormat.java
index f09fda7..54030c9 100644
--- a/frysk-core/frysk/value/TestFormat.java
+++ b/frysk-core/frysk/value/TestFormat.java
@@ -91,9 +91,9 @@ public class TestFormat
 	checkInteger(format, new byte[] {
 			 (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff
 		     }, uint_t, u);
-	checkFloatingPoint(format, TestBigFloat.FLOAT_ONE,
+	checkFloatingPoint(format, TestFloatingPoint854Format.FLOAT_ONE,
 			   float_t, f);
-	checkFloatingPoint(format, TestBigFloat.DOUBLE_TWO,
+	checkFloatingPoint(format, TestFloatingPoint854Format.DOUBLE_TWO,
 			   double_t, d);
 	checkPointer(format, new byte[] {
 			 1, 2, 3, 4
diff --git a/frysk-core/frysk/value/TestIntegerType.java b/frysk-core/frysk/value/TestIntegerType.java
index 64c90e3..6db4210 100644
--- a/frysk-core/frysk/value/TestIntegerType.java
+++ b/frysk-core/frysk/value/TestIntegerType.java
@@ -192,7 +192,8 @@ public class TestIntegerType
     public void testBigFloatValue() {
 	IntegerType t = new SignedType("type", ByteOrder.BIG_ENDIAN, 1);
 	Location l = new ScratchLocation(new byte[] { 1 });
-	TestBigFloat.checkEquals("1", 1.0, t.bigFloatValue(l).doubleValue());
+	TestFloatingPoint854Format.checkEquals("1", new BigFloatingPoint("1.0"), 
+			                       t.bigFloatingPointValue(l));
     }
     public void testBigIntegerValue() {
 	IntegerType t = new SignedType("type", ByteOrder.BIG_ENDIAN, 1);


hooks/post-receive
--
frysk system monitor/debugger


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]