This is the mail archive of the kawa@sources.redhat.com mailing list for the Kawa 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]

Re: arith. expression crashes Kawa


Jim White wrote:

I'ld wager that is a consequence of this change:
cvs diff -D 2003-08-19 kawa/lib/numbers.scm

Nope ...


There are other related changes on 2003-08-20

It is indeed one of those changes. But the bug actually has nothing to do with quotient per se. Rather it is that the way addition is being optimized - it incorrectly decides to do the addition using doubles (which looses precision when the numbers are integers). Then there is a second bug where the double is converted to a java.lang.Double rather than a gnu.math.DFloNum. The latter extends <real>, but the former doesn't, so we get teh ClassCastException.

Changing the types of quotient to <number> works around the
second bug, but it doesn't fix either bug.

The attached patch fixes the first bug; I haven't investigated
the second bug yet.
--
	--Per Bothner
per@bothner.com   http://per.bothner.com/

Index: AddOp.java
===================================================================
RCS file: /cvs/kawa/kawa/gnu/kawa/functions/AddOp.java,v
retrieving revision 1.11
diff -u -r1.11 AddOp.java
--- AddOp.java	21 Aug 2003 05:35:19 -0000	1.11
+++ AddOp.java	19 Oct 2003 07:09:19 -0000
@@ -298,7 +298,7 @@
     
   }
 
-  /** Claassify an expression according to its numeric type.
+  /** Classify an expression according to its numeric type.
    * kind==0:  not a number.
    * kind==1:  a non-real number
    * kind==2:  real number
@@ -350,14 +350,9 @@
 
 	if (kind0 == 4 && kind == 4)
 	  type = typeIntNum;
-	else if (kind0 >= 3 && kind >= 3)
-	  {
-	    type = typeDFloNum;
-	    kind0 = 3;
-	  }
 	else if (kind0 >= 2 && kind >= 2)
 	  {
-	    if (kind0 >= 3 || kind >= 3)
+	    if (kind0 == 3 || kind == 3)
 	      {
 		type = typeDFloNum;
 		kind0 = 3;

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