| java.lang.Object edu.hws.jcm.data.NumUtils
NumUtils | public class NumUtils (Code) | | This class provides a few static functions for converting real numbers
to strings and strings to real numbers. It should probalby be reimplemented
to use the standard NumberFormat class for converting real to string.
|
Method Summary | |
public static String | realToString(double x) Return a string representation of the real number
x occupying, if possible, at most 10 spaces. | public static String | realToString(double x, int width) Goal is to return a reasonable string representation
of x, using at most width spaces. | public static double | stringToReal(String s) Return the real number represented by the String s,
or return Double.NaN if s does not represent a legal
real number. |
realToString | public static String realToString(double x)(Code) | | Return a string representation of the real number
x occupying, if possible, at most 10 spaces.
|
realToString | public static String realToString(double x, int width)(Code) | | Goal is to return a reasonable string representation
of x, using at most width spaces. (If the parameter width is
unreasonably big or small, its value is adjusted to
lie in the range 6 to 25.)
Parameters: x - value to create string representation of. Parameters: width - maximum number of spaces used in string representation, if possible. a string representation for x. If x is Double.NaN, "undefined" is returned.If x is infinite, "INF" or "-INF" is returned. |
stringToReal | public static double stringToReal(String s)(Code) | | Return the real number represented by the String s,
or return Double.NaN if s does not represent a legal
real number.
|
|
|