incubator-vxquery-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From prest...@apache.org
Subject svn commit: r1382217 - /incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/datamodel/accessors/atomic/XSDecimalPointable.java
Date Sat, 08 Sep 2012 00:23:28 GMT
Author: prestonc
Date: Sat Sep  8 00:23:27 2012
New Revision: 1382217

URL: http://svn.apache.org/viewvc?rev=1382217&view=rev
Log:
Removed one of the operations when no calculation was needed on the result. now information
can pass though with out loss from converting to a double.

Modified:
    incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/datamodel/accessors/atomic/XSDecimalPointable.java

Modified: incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/datamodel/accessors/atomic/XSDecimalPointable.java
URL: http://svn.apache.org/viewvc/incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/datamodel/accessors/atomic/XSDecimalPointable.java?rev=1382217&r1=1382216&r2=1382217&view=diff
==============================================================================
--- incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/datamodel/accessors/atomic/XSDecimalPointable.java
(original)
+++ incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/datamodel/accessors/atomic/XSDecimalPointable.java
Sat Sep  8 00:23:27 2012
@@ -116,7 +116,11 @@ public class XSDecimalPointable extends 
     }
 
     public static long getBeforeDecimalPlaceRounded(byte[] bytes, int start) {
-        return Math.round(getDecimalValue(bytes, start) / Math.pow(10, getDecimalPlace(bytes,
start)));
+        if (getDecimalPlace(bytes, start) != 0) {
+            return Math.round(getDecimalValue(bytes, start) / Math.pow(10, getDecimalPlace(bytes,
start)));
+        } else {
+            return getDecimalValue(bytes, start);
+        }
     }
 
     public long getBeforeDecimalPlace() {
@@ -124,7 +128,12 @@ public class XSDecimalPointable extends 
     }
 
     public static long getBeforeDecimalPlace(byte[] bytes, int start) {
-        return (long) (getDecimalValue(bytes, start) / Math.pow(10, getDecimalPlace(bytes,
start)));
+        if (getDecimalPlace(bytes, start) != 0) {
+            return (long) (getDecimalValue(bytes, start) / Math.pow(10, getDecimalPlace(bytes,
start)));
+        } else {
+            return getDecimalValue(bytes, start);
+        }
+        
     }
 
     public byte getDigitCount() {



Mime
View raw message