Results 1 to 6 of 6

Thread: Float vs Double variable

  1. #1
    Join Date
    Aug 2006
    Posts
    162

    Float vs Double variable

    I have created an program in c language. The variables are declare before that function. All the number in my program are declare as Float, i want to the difference between Float and Double variable. What is maximum value can be assign to the number if it is declare as Float?

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

    Re: Float vs Double variable

    Float with precision total is 7 digit. double with precision total is 15 digit. float :floating-point number, double :double precision floating-point number. Doubles and floats are useful for imprecise extreme numbers which cannot be written as an integer (not even int64) like 1.35-e27.

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

    Re: Float vs Double variable

    There are three floating point types: float, double and long double. The type double provides at least as much precision as float, and the type long double provides at least as much precision as double.Usually, 'double' contains more _significant_digits_, so, as a general case, 'double' is more precise for *any* values.Also, usually, 'double' has a wider range. The set 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.

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

    Re: Float vs Double variable

    The declarator for a simple floating-point declaration is an identifier. Double: Double precision floating point number.8bytes : +/- 1.7e +/- 308 (~15 digits). You can initialize a simple floating-point variable with a float constant or with a variable or expression that evaluates to an integer or floating-point number.

  5. #5
    Join Date
    Feb 2008
    Posts
    1,852

    Re: Float vs Double variable

    If you want to use a variable in C, you must declare it specifying which data type we want it to be. You can store a float value in a float variable and a double value in a double variable. Floats are not always faster than doubles. The syntax to declare a new variable is to write the specifier of the desired data type (like int, bool, float...) followed by a valid variable identifier.

  6. #6
    Join Date
    Jan 2008
    Posts
    1,521

    Re: Float vs Double variable

    C has a concept of 'data types' which are used to define a variable before its use. The float data type are used in c program to save the numbers with 6 digits of precision. C++ practically offers most of the necessary data types except for a basic data type string. Integers are whole numbers with a range of values, range of values are machine dependent.

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. Difference between double and float
    By garfield1 in forum Software Development
    Replies: 5
    Last Post: 06-03-2010, 04:13 PM
  4. Replies: 2
    Last Post: 28-08-2009, 07:51 PM
  5. CSS : How to float outside parent div
    By Valerian in forum Software Development
    Replies: 4
    Last Post: 21-05-2009, 12:03 PM

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,274,712.40287 seconds with 17 queries