aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache/poi/util/Units.java
diff options
context:
space:
mode:
authorAndreas Beeker <kiwiwings@apache.org>2016-03-14 00:42:59 +0000
committerAndreas Beeker <kiwiwings@apache.org>2016-03-14 00:42:59 +0000
commitfef2ce53cdc91280e89726e84affc634004e32e6 (patch)
tree801e45343a9093f8d0d26f8e1de94206ef3ced6f /src/java/org/apache/poi/util/Units.java
parent8fccd72f9d0e98569a3f4ef6aae0daff83072b17 (diff)
downloadpoi-fef2ce53cdc91280e89726e84affc634004e32e6.tar.gz
poi-fef2ce53cdc91280e89726e84affc634004e32e6.zip
HSLF: Add support for system colors
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1734865 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/poi/util/Units.java')
-rw-r--r--src/java/org/apache/poi/util/Units.java6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/java/org/apache/poi/util/Units.java b/src/java/org/apache/poi/util/Units.java
index 496ca132d3..6649c1f860 100644
--- a/src/java/org/apache/poi/util/Units.java
+++ b/src/java/org/apache/poi/util/Units.java
@@ -96,8 +96,10 @@ public class Units {
* @see <a href="http://msdn.microsoft.com/en-us/library/dd910765(v=office.12).aspx">[MS-OSHARED] - 2.2.1.6 FixedPoint</a>
*/
public static int doubleToFixedPoint(double floatPoint) {
- int i = (int)Math.floor(floatPoint);
- int f = (int)((floatPoint % 1d)*65536d);
+ double fractionalPart = floatPoint % 1d;
+ double integralPart = floatPoint - fractionalPart;
+ int i = (int)Math.floor(integralPart);
+ int f = (int)Math.rint(fractionalPart*65536d);
int fixedPoint = (i << 16) | (f & 0xFFFF);
return fixedPoint;
}