Documentation of 'org.jplot2d.util.NumberUtils' Java class
NumberUtils
org.jplot2d.util

Class 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 boolean approximate(double a, double b, int bit) 
      static java.lang.String calcDeltaFormatStr(double v, double delta)
      Find a proper format to show the delta digit.
      static java.lang.String calcFormatStr(double value, int digits)
      Find a proper format for the given significant digits limit.
      static java.lang.String toString(double v)
      Format the value to avoid the round error.
      static java.lang.String toString(double v, int digits)
      Format the value to the given significant digits limit.
      static java.lang.String toString(float v)
      Format the value to avoid the round error.
      static java.lang.String toString(float v, int digits)
      Format the value to the given significant digits limit.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • NumberUtils

        public NumberUtils()
    • 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 value
        digits - 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

You see the box below because you did not login.