Java Number Round roundChipRewardDown(long chips)

Here you can find the source of roundChipRewardDown(long chips)

Description

round Chip Reward Down

License

Apache License

Declaration

static public long roundChipRewardDown(long chips) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    public static final double LOG_10 = Math.log(10);

    static public long roundChipRewardDown(long chips) {
        if (chips < 1000)
            return chips;

        int digits = ((int) Math.floor(Math.log(chips) / LOG_10)) + 1;
        double divider = Math.pow(10, (digits - 1));
        chips = (long) (Math.floor(chips / divider) * divider);

        return chips;
    }/*from   w  w w .ja  v a  2s . c  o m*/
}

Related

  1. roundAndCrop(final float x, final int min, final int max)
  2. roundByGridSize(int value)
  3. roundByte(final double value)
  4. roundBytesToGB(long bytes)
  5. roundBytesUpToWords(int bytes)
  6. roundCss(double v, int n)
  7. rounded(double value, int places, int ceilOrFloor)
  8. ROUNDED_DIV(long a, long b)
  9. rounded_shift_down(long x, int n)