Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/utils/Formatter.java @ 9421:53e26734e4d2
Fixed NaN handling in salix historical scenarion calculation, added problem report
author | mschaefer |
---|---|
date | Fri, 17 Aug 2018 11:13:31 +0200 |
parents | 8ae7137b67d7 |
children | d194c5b24bf8 |
comparison
equal
deleted
inserted
replaced
9420:2c8ba17b807e | 9421:53e26734e4d2 |
---|---|
385 return Formatter.getFormatter(context, FLOWDEPTH_MAX_DIGITS, FLOWDEPTH_MAX_DIGITS); | 385 return Formatter.getFormatter(context, FLOWDEPTH_MAX_DIGITS, FLOWDEPTH_MAX_DIGITS); |
386 } | 386 } |
387 | 387 |
388 /** | 388 /** |
389 * Decimal half even rounding of a flow depth value | 389 * Decimal half even rounding of a flow depth value |
390 * (throws an exception for NaN or Infinity) | 390 * (ATTENTION: throws an exception for NaN or Infinity!) |
391 */ | 391 */ |
392 public static BigDecimal roundFlowDepth(final double value) { | 392 public static BigDecimal roundFlowDepth(final double value) { |
393 return BigDecimal.valueOf(value).setScale(FLOWDEPTH_MAX_DIGITS, RoundingMode.HALF_EVEN); | 393 return BigDecimal.valueOf(value).setScale(FLOWDEPTH_MAX_DIGITS, RoundingMode.HALF_EVEN); |
394 } | 394 } |
395 | 395 |
397 return Formatter.getFormatter(context, 2, 2); | 397 return Formatter.getFormatter(context, 2, 2); |
398 } | 398 } |
399 | 399 |
400 /** | 400 /** |
401 * Decimal half even rounding of a W value | 401 * Decimal half even rounding of a W value |
402 * (throws an exception for NaN or Infinity) | 402 * (ATTENTION: throws an exception for NaN or Infinity!) |
403 */ | 403 */ |
404 public static BigDecimal roundW(final double value) { | 404 public static BigDecimal roundW(final double value) { |
405 return BigDecimal.valueOf(value).setScale(WATERLEVEL_W_MAX_DIGITS, RoundingMode.HALF_EVEN); | 405 return BigDecimal.valueOf(value).setScale(WATERLEVEL_W_MAX_DIGITS, RoundingMode.HALF_EVEN); |
406 } | 406 } |
407 | 407 |