All Packages Class Hierarchy This Package Previous Next Index
Class comphys.CP
java.lang.Object
|
+----comphys.CP
- public class CP
- extends Object
This class contains static methods similar to java.lang.Math.
These methods perform various routine tasks related input and output
and formatting of numbers, etc.
- Version:
- February 14, 1999
-
CP()
-
-
format(double, int)
- Formats a double with a specified number of digits.
CP
public CP()
format
public static String format(double d,
int precision)
- Formats a double with a specified number of digits.
When java converts a double to a String
it retains the full precision of the number. This can
generate 15 decimal places! This method truncates this output
to some specified number of decimal places.
- Parameters:
- d - the double to format
- precision - the number of digits desired
- Returns:
- returns the formatted string
All Packages Class Hierarchy This Package Previous Next Index