Thread: Float-double difference?

  1. #1
    Registered User
    Join Date
    Jul 2007
    Posts
    151

    Float-double difference?

    Hello ,
    I know this is a very frequent question but I couldnt get an answer yet from FAQ or net. At least please give me a link or sth. Thank you..

  2. #2
    Deathray Engineer MacGyver's Avatar
    Join Date
    Mar 2007
    Posts
    3,210
    I don't even know what you're asking.

    Code:
    float a = 5, b = 6;
    float c = b - a;
    There. You have the difference of two floats.

  3. #3
    Registered User
    Join Date
    Jul 2007
    Posts
    151
    I am sorry I forgot to elaborate the question =). What is the difference between the data type double and the data type float?

  4. #4
    Deathray Engineer MacGyver's Avatar
    Join Date
    Mar 2007
    Posts
    3,210
    Doubles are generally 64-bit and hence can cover more numbers. Floats are generally 32-bit.

  5. #5
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,663
    Range and precision - doubles have more of both.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 2
    Last Post: 05-13-2009, 03:25 PM
  2. Copying 2-d arrays
    By Holtzy in forum C++ Programming
    Replies: 11
    Last Post: 03-14-2008, 03:44 PM
  3. C++ to C Conversion
    By dicon in forum C Programming
    Replies: 7
    Last Post: 06-11-2007, 08:38 PM
  4. Need help with program
    By HAssan in forum C Programming
    Replies: 8
    Last Post: 06-10-2007, 08:05 PM
  5. Conversion From C++ To C
    By dicon in forum C++ Programming
    Replies: 2
    Last Post: 06-10-2007, 02:54 PM