Thread: Doubles Problem

  1. #1
    Registered User
    Join Date
    Aug 2011
    Posts
    7

    Question Doubles Problem

    Hi, im using MinGW with Code::Blocks and i'm running into a problem with Doubles...

    If i declare two variables:

    float a;
    double b;

    and set them both to hold a large value like 145.232213000

    I then use %f to print out the numbers and i get 145.2322 on BOTH of them... This would be understandable with floats but aren't doubles suppose to hold more information?

  2. #2
    Registered User
    Join Date
    May 2011
    Location
    Around 8.3 light-minutes from the Sun
    Posts
    1,949
    See: printf type specifiers.Additionally, for numerical literals, a suffix of f for floating point and nothing for double.
    Quote Originally Posted by anduril462 View Post
    Now, please, for the love of all things good and holy, think about what you're doing! Don't just run around willy-nilly, coding like a drunk two-year-old....
    Quote Originally Posted by quzah View Post
    ..... Just don't be surprised when I say you aren't using standard C anymore, and as such,are off in your own little universe that I will completely disregard.
    Warning: Some or all of my posted code may be non-standard and as such should not be used and in no case looked at.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. problem w/ doubles in friend's program
    By mkylman in forum C Programming
    Replies: 16
    Last Post: 11-22-2008, 10:45 AM
  2. problem with displaying doubles in array
    By Seiro in forum C Programming
    Replies: 5
    Last Post: 04-21-2006, 04:06 PM
  3. Using Doubles
    By jay kay in forum Windows Programming
    Replies: 4
    Last Post: 03-22-2005, 01:14 PM
  4. Problem with doubles
    By Asbestos in forum C++ Programming
    Replies: 14
    Last Post: 03-18-2005, 05:47 PM
  5. ints and doubles problem
    By iLLiCiT in forum C Programming
    Replies: 1
    Last Post: 12-04-2004, 03:42 PM

Tags for this Thread