org.jplot2d.util
Class NumberUtils
- java.lang.Object
-
- org.jplot2d.util.NumberUtils
-
public class NumberUtils extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor and Description NumberUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method and Description static booleanapproximate(double a, double b, int bit)static java.lang.StringcalcDeltaFormatStr(double v, double delta)Find a proper format to show the delta digit.static java.lang.StringcalcFormatStr(double value, int digits)Find a proper format for the given significant digits limit.static java.lang.StringtoString(double v)Format the value to avoid the round error.static java.lang.StringtoString(double v, int digits)Format the value to the given significant digits limit.static java.lang.StringtoString(float v)Format the value to avoid the round error.static java.lang.StringtoString(float v, int digits)Format the value to the given significant digits limit.
-
-
-
Method Detail
-
approximate
public static boolean approximate(double a, double b, int bit)- Parameters:
a-b-bit- the number of bits that the different is tolerated.- Returns:
-
calcFormatStr
public static java.lang.String calcFormatStr(double value, int digits)Find a proper format for the given significant digits limit.- Parameters:
value- the valuedigits- significant digits- Returns:
- the format string for java Formatter
-
toString
public static java.lang.String toString(float v)
Format the value to avoid the round error. The max precision is 6 significant digits.
-
toString
public static java.lang.String toString(float v, int digits)Format the value to the given significant digits limit. If the limit is 0, to avoid the round error, 6 significant digits is applied.
-
toString
public static java.lang.String toString(double v)
Format the value to avoid the round error. The max precision is 15 significant digits.
-
toString
public static java.lang.String toString(double v, int digits)Format the value to the given significant digits limit. If the limit is 0, to avoid the round error, 15 significant digits is applied.
-
calcDeltaFormatStr
public static java.lang.String calcDeltaFormatStr(double v, double delta)Find a proper format to show the delta digit.- Parameters:
v-delta-- Returns:
- the format string for java Formatter
-
-
DMelt 3.0 © DataMelt by jWork.ORG