Results 1 to 6 of 6

Thread: Difference between double and float

  1. #1
    Join Date
    May 2008
    Posts
    248

    Difference between double and float

    Hello,

    I was confuse to know when a group chatting is going on around us in the college.The confusion is related to the programming languages and the basic things like data type usage are involved in this specification.I used always this forum to solve my problem.So tell me the difference between between double and float data-type.

    Thanks.

  2. #2
    Join Date
    Apr 2008
    Posts
    1,948

    Difference between double and float

    The data-type are very primary and very valuable components of programming.
    There are so many data types are used in different programming languages but some of the programming languages don't require any data type definition and all.

    You have to just define the variable and assign the value whatever you want to assign.The one of the language named Java script.

    If we talk about the data type differences between double and float is some nearest precision difference between both data types and both are capable to assign the point included values.

  3. #3
    Join Date
    May 2008
    Posts
    2,012

    Difference between double and float

    Difference between double and float

    The precision have some matter to differentiate it because both data types are capable to store the floating-point number.

    A variable defined as float data type only has 7 digits of precision where as a variable defined as double has 15 digits of precision.So it depends on your program requirements that what you need to use in your program.

    According to my opinion,the double data type would always be suitable to use in the program for accuracy purpose.

  4. #4
    Join Date
    Apr 2008
    Posts
    2,005

    Floating-point standard of datatype

    Floating-point standard of data-type

    As katty said that the capability to store the precision of float data-type.She also mentioned the position on which a float and double data type are capable to store.

    When a variable is declared as float and the value is being assigned the it takes the following standard.you can see a rounding of numeric values, such as the following:

    Last edited by kelfro; 06-03-2010 at 04:00 PM.

  5. #5
    Join Date
    May 2008
    Posts
    2,297

    Setting up the precision for double and float

    A double data type is basically short for "double float" (but you can't say that). A float is usually 32 bits long and on other hand a double is 64 bits. A long double can be anywhere from 64 (same as double) to 128 bits.

    If you desire to control the decimal or precision, then you can fire these control statement-

    Code:
    setprecision ( 2 ) // only 2 decimal , e.g 12.22
    setprecision ( 3 ) // 12.333

  6. #6
    Join Date
    Oct 2005
    Posts
    2,393

    Difference between double and float

    There are basically three floating point data-types are used in the C or C++ programming - float, double, and long double.

    The type double gives the same precision as a float data type can, and the type long double gives at least as much precision as double. The collection of values of the type float is a subset of the set of values of the type double. the set of values of the type double is a subset of the set of values of the type long double. The value representation of floating-point types is implementation-defined. Integral and floating types are collectively called arithmetic types. Specializations of the standard template std::numeric_limits (18.2) shall specify the maximum and minimum values of each arithmetic type for an implementation.

Similar Threads

  1. Replies: 7
    Last Post: 28-12-2011, 05:18 PM
  2. Casting int to float in C
    By Jensen Ackles in forum Software Development
    Replies: 4
    Last Post: 05-04-2010, 05:08 PM
  3. Float vs Double variable
    By Samarth in forum Software Development
    Replies: 5
    Last Post: 19-12-2009, 01:03 PM
  4. CSS : How to float outside parent div
    By Valerian in forum Software Development
    Replies: 4
    Last Post: 21-05-2009, 12:03 PM
  5. How to make a CSS div float OVER another div
    By Warner in forum Software Development
    Replies: 3
    Last Post: 21-05-2009, 10:50 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,543,134.21652 seconds with 16 queries