jycli       2004/02/10 14:40:34

  Modified:    java/src/org/apache/xalan/xsltc/compiler Tag:
                        xslt20-compiled RoundCall.java
               java/src/org/apache/xalan/xsltc/runtime Tag: xslt20-compiled
                        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
  No                   revision
  No                   revision
  1.6.6.1   +3 -10     
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.6.6.1
  diff -u -r1.6 -r1.6.6.1
  --- RoundCall.java    30 Jan 2003 18:46:01 -0000      1.6
  +++ RoundCall.java    10 Feb 2004 22:40:34 -0000      1.6.6.1
  @@ -85,15 +85,8 @@
   
        // Get two copies of the argument on the stack
        argument().translate(classGen, methodGen);
  -     il.append(DUP2);
  +     il.append(new INVOKESTATIC(cpg.addMethodref(BASIS_LIBRARY_CLASS, 
  +                                                    "roundF", "(D)D"))); 
   
  -     // 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));
       }
   }
  
  
  
  No                   revision
  No                   revision
  1.61.4.4  +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.61.4.3
  retrieving revision 1.61.4.4
  diff -u -r1.61.4.3 -r1.61.4.4
  --- BasisLibrary.java 4 Dec 2003 20:58:42 -0000       1.61.4.3
  +++ BasisLibrary.java 10 Feb 2004 22:40:34 -0000      1.61.4.4
  @@ -235,6 +235,15 @@
            return 0.0;
        }
       }
  +
  +    /**
  +     * 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()
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to