Java Double Number Truncate truncate2decimals(double x)

Here you can find the source of truncate2decimals(double x)

Description

truncatedecimals

License

Open Source License

Declaration

public static double truncate2decimals(double x) 

Method Source Code

//package com.java2s;
/*//from   www  .  j a v  a2s  . c  om
 * Copyright (C) 2009-2015 SM2 SOFTWARE & SERVICES MANAGEMENT
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program has been created in the hope that it will be useful.
 * It is distributed WITHOUT ANY WARRANTY of any Kind,
 * without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see http://www.gnu.org/licenses/.
 *
 * For more information, please contact SM2 Software & Services Management.
 * Mail: info@talaia-openppm.com
 * Web: http://www.talaia-openppm.com
 *
 * Module: utils
 * File: NumberUtil.java
 * Create User: javier.hernandez
 * Create Date: 06/03/2015 14:35:37
 */

public class Main {
    public static double truncate2decimals(double x) {

        return Math.floor(x * 100) / 100;
    }
}

Related

  1. truncate(double x)
  2. truncate(double x, double gran)
  3. truncate(double[] arr, int m)
  4. truncate(final double value, final double min, final double max)
  5. truncate(final double value, final double precision)
  6. truncateDigits(double input, int numberDigits)
  7. truncateDigits(double[][] input, int numberDigits)
  8. truncateDouble(final Double value)
  9. truncateDoubleDecimals(double x1, int num)