All Downloads are FREE. Search and download functionalities are using the official Maven repository.

fr.nargit.rating.utils.MathUtils Maven / Gradle / Ivy

Go to download

The Rating Algorithm library implement a rating system (Based on ELO) in order to handle multiple types of games (1v1, 2v2, 1v1v1...)

The newest version!
package fr.nargit.rating.utils;

/**
 * Created by NargiT on 13/01/2016
 */
public class MathUtils {

  public static int roundToHalf(double value) {
    double decimals = value - (long) value;
    if (decimals >= 0.5) {
      double roundedValue = Math.round(value * 2.0) / 2.0;
      return (int) Math.ceil(roundedValue);
    }
    return (int) value;
  }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy