Mercurial > lada > lada-server
view src/main/java/de/intevation/lada/util/data/MathUtil.java @ 1282:9473a701cfdb
Added model and service for stammdaten.kta.
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Fri, 03 Feb 2017 14:03:27 +0100 |
parents | c9b84bca3e3d |
children |
line wrap: on
line source
/* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz * Software engineering by Intevation GmbH * * This file is Free Software under the GNU GPL (v>=3) * and comes with ABSOLUTELY NO WARRANTY! Check out * the documentation coming with IMIS-Labordaten-Application for details. */ package de.intevation.lada.util.data; import java.math.BigDecimal; import java.math.MathContext; import java.math.RoundingMode; /** * Utilities for calculations * */ public class MathUtil { public static final MathContext ROUNDING_CONTEXT = new MathContext( 3, RoundingMode.HALF_EVEN); public static Double roundDoubleToThree(Double value) { if (value == null) { return null; } return BigDecimal.valueOf(value).round(ROUNDING_CONTEXT).doubleValue(); } }