Mercurial > dive4elements > river
diff artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/tkhcalculation/TkhCalculator.java @ 9375:a0a2e68a1e11
Fixed: cm rounding in S-Info flow depth/tkh and U-Info salix via BigDecimal, half_even mode
author | mschaefer |
---|---|
date | Fri, 03 Aug 2018 17:00:45 +0200 |
parents | 7dc238bd062c |
children | 787fc085459b |
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/tkhcalculation/TkhCalculator.java Thu Aug 02 20:14:26 2018 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/tkhcalculation/TkhCalculator.java Fri Aug 03 17:00:45 2018 +0200 @@ -135,7 +135,7 @@ if (Double.isNaN(meanBedHeight)) return TkhCalculateState.NO_BED_HEIGHT; - final double flowDepth = Formatter.roundFlowDepth(wst) - Formatter.roundFlowDepth(meanBedHeight); + final double flowDepth = Formatter.roundFlowDepth(wst).subtract(Formatter.roundFlowDepth(meanBedHeight)).doubleValue(); row.putValue(SInfoResultType.flowdepth, flowDepth); final double discharge = this.dischargeProvider.getDischarge(km); @@ -175,14 +175,14 @@ switch (kind) { case starr: - row.putValue(SInfoResultType.tkhup, (double) Math.round(tkh)); + row.putValue(SInfoResultType.tkhup, Math.rint(tkh)); row.putValue(SInfoResultType.tkhdown, 0.0); break; case mobil: default: - row.putValue(SInfoResultType.tkhup, (double) Math.round(tkh / 2)); - row.putValue(SInfoResultType.tkhdown, (double) -(Math.round(tkh / 2))); + row.putValue(SInfoResultType.tkhup, Math.rint(tkh / 2)); + row.putValue(SInfoResultType.tkhdown, -(Math.rint(tkh / 2))); break; } @@ -230,11 +230,11 @@ switch (tkhKind) { case starr: - return flowDepth - Math.round(tkhValue) / 100.0; + return flowDepth - Math.rint(tkhValue) / 100.0; case mobil: default: - return flowDepth - Math.round(tkhValue / 2) / 100.0; + return flowDepth - Math.rint(tkhValue / 2) / 100.0; } } } \ No newline at end of file