+ Reply to Thread
Results 1 to 4 of 4

Thread: What is the difference between double and float variables in Java?

  1. #1
    Hosting Guru vinecottage is on a distinguished road
    Join Date
    Jul 2018
    Location
    Australia
    Posts
    52

    What is the difference between double and float variables in Java?

    What is the difference between double and float variables in Java?

  2. #2
    Hosting Master Krina is on a distinguished road
    Join Date
    Jun 2018
    Location
    India
    Posts
    238
    both float and double datatype are used to represent floating point numbers in Java, a double data type is more precise than float. A double variable can provide precision up to 15 to 16 decimal points as compared to float precision of 6 to 7 decimal digits

  3. #3
    HWHT Starter Davidwatson is on a distinguished road
    Join Date
    Dec 2017
    Location
    Chicago
    Posts
    6
    float is represented in 32 bits, with 1 sign bit, 8 bits of exponent, and 23 bits of the mantissa (or what follows from a scientific-notation number: 2.33728*1012; 33728 is the mantissa).
    double is represented in 64 bits, with 1 sign bit, 11 bits of exponent, and 52 bits of mantissa.

  4. #4
    Hosting Guru sonikathakur is on a distinguished road
    Join Date
    May 2014
    Location
    India
    Posts
    69
    Basic difference is that float is of 32 bits in Java and double is 64 bits. So that would make difference if you are trying to store a sufficiently big value.

+ Reply to Thread

Similar Threads

  1. What is the main difference between Java platform and other platforms?
    By sydneyearplug in forum Web / Graphic Design , Web Development Requests
    Replies: 2
    Last Post: 08-13-2018, 03:55 AM
  2. Replies: 0
    Last Post: 07-24-2018, 09:43 AM
  3. Replies: 0
    Last Post: 07-24-2018, 09:11 AM
  4. What is the main difference between Java platform and other platforms?
    By designpluz in forum Programming Discussion
    Replies: 0
    Last Post: 03-26-2018, 11:40 AM
  5. Double Your Disk Space :: OR :: Double Your Transfer!!! cPanel/WHM March Special
    By TVGHosting in forum Shared and Reseller Hosting Offers
    Replies: 0
    Last Post: 03-07-2007, 03:26 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts