You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@vxquery.apache.org by pr...@apache.org on 2012/08/30 23:38:35 UTC

svn commit: r1379170 - in /incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/cast: CastToDoubleOperation.java CastToFloatOperation.java

Author: prestonc
Date: Thu Aug 30 21:38:34 2012
New Revision: 1379170

URL: http://svn.apache.org/viewvc?rev=1379170&view=rev
Log:
Updated the way strings are read in for float and double relating to zero.

Modified:
    incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/cast/CastToDoubleOperation.java
    incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/cast/CastToFloatOperation.java

Modified: incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/cast/CastToDoubleOperation.java
URL: http://svn.apache.org/viewvc/incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/cast/CastToDoubleOperation.java?rev=1379170&r1=1379169&r2=1379170&view=diff
==============================================================================
--- incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/cast/CastToDoubleOperation.java (original)
+++ incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/cast/CastToDoubleOperation.java Thu Aug 30 21:38:34 2012
@@ -207,7 +207,11 @@ public class CastToDoubleOperation exten
         }
 
         dOut.write(ValueTag.XS_DOUBLE_TAG);
-        dOut.writeDouble((negativeValue ? valueDouble : -valueDouble));
+        if (valueDouble == 0.0) {
+            dOut.writeDouble((negativeValue ? -0.0 : 0.0));
+        } else {
+            dOut.writeDouble((negativeValue ? valueDouble : -valueDouble));
+        }
     }
 
     @Override

Modified: incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/cast/CastToFloatOperation.java
URL: http://svn.apache.org/viewvc/incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/cast/CastToFloatOperation.java?rev=1379170&r1=1379169&r2=1379170&view=diff
==============================================================================
--- incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/cast/CastToFloatOperation.java (original)
+++ incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/cast/CastToFloatOperation.java Thu Aug 30 21:38:34 2012
@@ -171,7 +171,11 @@ public class CastToFloatOperation extend
         }
 
         dOut.write(ValueTag.XS_FLOAT_TAG);
-        dOut.writeFloat((negativeValue ? valueFloat : -valueFloat));
+        if (valueFloat == 0.0f) {
+            dOut.writeFloat((negativeValue ? -0.0f : 0.0f));
+        } else {
+            dOut.writeFloat((negativeValue ? valueFloat : -valueFloat));
+        }
     }
 
     @Override