You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by jy...@apache.org on 2004/02/10 23:28:04 UTC
cvs commit: xml-xalan/java/src/org/apache/xalan/xsltc/runtime BasisLibrary.java
jycli 2004/02/10 14:28:04
Modified: java/src/org/apache/xalan/xsltc/compiler RoundCall.java
java/src/org/apache/xalan/xsltc/runtime BasisLibrary.java
Log:
Fix for bugzilla bug report 24111.
The string values for both positive and nagative zero are 0. However,
a number div 0 returns Infinity, a number div -0 returns -Infinity.
Revision Changes Path
1.7 +4 -14 xml-xalan/java/src/org/apache/xalan/xsltc/compiler/RoundCall.java
Index: RoundCall.java
===================================================================
RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/compiler/RoundCall.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- RoundCall.java 30 Jan 2003 18:46:01 -0000 1.6
+++ RoundCall.java 10 Feb 2004 22:28:04 -0000 1.7
@@ -65,9 +65,7 @@
import java.util.Vector;
-import org.apache.bcel.generic.BranchHandle;
import org.apache.bcel.generic.ConstantPoolGen;
-import org.apache.bcel.generic.IFNE;
import org.apache.bcel.generic.INVOKESTATIC;
import org.apache.bcel.generic.InstructionList;
import org.apache.xalan.xsltc.compiler.util.ClassGenerator;
@@ -84,16 +82,8 @@
final InstructionList il = methodGen.getInstructionList();
// Get two copies of the argument on the stack
- argument().translate(classGen, methodGen);
- il.append(DUP2);
-
- // Check if the argument is NaN
- il.append(new INVOKESTATIC(cpg.addMethodref("java.lang.Double",
- "isNaN", "(D)Z")));
- final BranchHandle skip = il.append(new IFNE(null));
- il.append(new INVOKESTATIC(cpg.addMethodref(MATH_CLASS,
- "round", "(D)J")));
- il.append(L2D);
- skip.setTarget(il.append(NOP));
+ argument().translate(classGen, methodGen);
+ il.append(new INVOKESTATIC(cpg.addMethodref(BASIS_LIBRARY_CLASS,
+ "roundF", "(D)D")));
}
}
1.69 +10 -1 xml-xalan/java/src/org/apache/xalan/xsltc/runtime/BasisLibrary.java
Index: BasisLibrary.java
===================================================================
RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/runtime/BasisLibrary.java,v
retrieving revision 1.68
retrieving revision 1.69
diff -u -r1.68 -r1.69
--- BasisLibrary.java 14 Jan 2004 20:20:04 -0000 1.68
+++ BasisLibrary.java 10 Feb 2004 22:28:04 -0000 1.69
@@ -228,6 +228,15 @@
}
/**
+ * XSLT Standard function round()
+ */
+ public static double roundF(double d) {
+ if (d >= -0.5 && d < 0) return -0.0;
+ if (d == 0.0) return d;
+ else return Math.floor(d + 0.5);
+ }
+
+ /**
* XSLT Standard function boolean()
*/
public static boolean booleanF(Object obj) {
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org