public class Math extends Object
| Constructor and Description |
|---|
Math() |
| Modifier and Type | Method and Description |
|---|---|
static double |
normalize(double i,
double factor)
Useful for normalizing integer or double values to a number between 0 and 1.
|
static long |
pow(long l,
int exp) |
static double |
round(double number,
int decimals) |
static int |
safeAbs(int number)
Java Math.pow has an issue with Long and Integer MIN_VALUE where it returns MIN_VALUE.
|
static long |
safeAbs(long number)
Java Math.pow has an issue with Long and Integer MIN_VALUE where it returns MIN_VALUE.
|
public static long safeAbs(long number)
number - a numberpublic static int safeAbs(int number)
number - a numberpublic static long pow(long l,
int exp)
l - a longexp - exponentpublic static double normalize(double i,
double factor)
(1 / (1 + java.lang.Math.exp(-1 * (factor * i))) - 0.5) * 2
i - any positive longfactor - allows you to control how quickly things converge on 1. For values that range between 0 and the low
hundreds, something like 0.05 is a good starting point.public static double round(double number,
int decimals)
Copyright © 2016 Inbot. All Rights Reserved.