summaryrefslogtreecommitdiff
path: root/src/org/unitConverter/unit/UnitDatabase.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/org/unitConverter/unit/UnitDatabase.java')
-rw-r--r--src/org/unitConverter/unit/UnitDatabase.java6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/org/unitConverter/unit/UnitDatabase.java b/src/org/unitConverter/unit/UnitDatabase.java
index 9812bd0..9ca9617 100644
--- a/src/org/unitConverter/unit/UnitDatabase.java
+++ b/src/org/unitConverter/unit/UnitDatabase.java
@@ -46,6 +46,7 @@ import org.unitConverter.math.ConditionalExistenceCollections;
import org.unitConverter.math.DecimalComparison;
import org.unitConverter.math.ExpressionParser;
import org.unitConverter.math.ObjectProduct;
+import org.unitConverter.math.UncertainDouble;
/**
* A database of units, prefixes and dimensions, and their names.
@@ -1134,7 +1135,7 @@ public final class UnitDatabase {
// exponent function - first check if o2 is a number,
if (exponentValue.canConvertTo(SI.ONE)) {
// then check if it is an integer,
- final double exponent = exponentValue.getValue();
+ final double exponent = exponentValue.getValueExact();
if (DecimalComparison.equals(exponent % 1, 0))
// then exponentiate
return base.toExponent((int) (exponent + 0.5));
@@ -1650,7 +1651,8 @@ public final class UnitDatabase {
final BigDecimal number = new BigDecimal(name);
final double uncertainty = Math.pow(10, -number.scale());
- return LinearUnitValue.of(SI.ONE, number.doubleValue(), uncertainty);
+ return LinearUnitValue.of(SI.ONE,
+ UncertainDouble.of(number.doubleValue(), uncertainty));
} catch (final NumberFormatException e) {
return LinearUnitValue.getExact(this.getLinearUnit(name), 1);
}