Double - StarShipTutor/StarshipTutorAPCS GitHub Wiki

double : docs.oracle.com

Primitive Data Type - Double

  • Contains - IEEE 754 Floating Point Number
  • Default - 0.0
  • Size - 64
  • Range ~ 1E-324 to 1E308

Wrapper Class - Double

The wrapper class Double is used to crate an object out of a double.

There are many useful static and instance methods. Here are a few

double x, y;

Double aDouble, anotherDouble, pi;

int theResult;

theResult = Double.compare    ( x, y );          // Static Method
theResult = aDouble.compareTo ( anotherDouble ); // Instance Method

// Static Methods

String piString = "3.1415926";

pi            = Double.parseDouble ( piString ); // returns a double with value piString
aDouble       = Double.valueOf     ( piString ); // returns a Double object with value piString
anotherDouble = Double.valueOf     ( pi );       // returns a Double object with value pi

// and Instance Methods

double theValue;
boolean theAnswer;

theValue  = aDouble.doubleValue (); // double value of Double object
theAnswer = aDouble.isInfinite (); // true if value is infinite
theAnswer = aDouble.isNAN ();      // true if value is Not A Number

String aString = aDouble.toString (); // String of the Double value

See the full list at docs.oracle.com