Thread: More precision than a double

  1. #1
    MFC killed my cat! manutd's Avatar
    Join Date
    Sep 2006
    Location
    Boston, Massachusetts
    Posts
    870

    More precision than a double

    Does anyone know of a type with more precision than a double?
    Silence is better than unmeaning words.
    - Pythagoras
    My blog

  2. #2
    Registered User
    Join Date
    Sep 2001
    Posts
    752
    Your compiler may support "long double"
    The printf/scanf flag for it is %Lf
    Callou collei we'll code the way
    Of prime numbers and pings!

  3. #3
    Its hard... But im here swgh's Avatar
    Join Date
    Apr 2005
    Location
    England
    Posts
    1,688
    For the decimal percision, you can always use setprecision and fixed.

  4. #4
    Registered User
    Join Date
    Jan 2005
    Posts
    7,366
    setprecision and fixed are for display purposes, they don't affect the actual precision of the variable. On many current platforms, long double will have the same precision as double, although you should try using long double if you want extra precision anyway.

    If you need more precision beyond that you will want a third party library that supports larger precision.

  5. #5
    MFC killed my cat! manutd's Avatar
    Join Date
    Sep 2006
    Location
    Boston, Massachusetts
    Posts
    870
    Anyone know of a third party library? In the original post I meant to type long double. All I need is about 5 more decimal places of precision.
    Silence is better than unmeaning words.
    - Pythagoras
    My blog

  6. #6
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    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.

  7. #7
    MFC killed my cat! manutd's Avatar
    Join Date
    Sep 2006
    Location
    Boston, Massachusetts
    Posts
    870
    Awesome! Thanks, Salem. That looks to be perfect for what I am doing.
    Silence is better than unmeaning words.
    - Pythagoras
    My blog

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Copying 2-d arrays
    By Holtzy in forum C++ Programming
    Replies: 11
    Last Post: 03-14-2008, 03:44 PM
  2. C++ to C Conversion
    By dicon in forum C Programming
    Replies: 7
    Last Post: 06-11-2007, 08:38 PM
  3. need some help with last part of arrays
    By Lince in forum C Programming
    Replies: 3
    Last Post: 11-18-2006, 09:13 AM
  4. newbie needs help with code
    By compudude86 in forum C Programming
    Replies: 6
    Last Post: 07-23-2006, 08:54 PM
  5. Unknown Math Issues.
    By Sir Andus in forum C++ Programming
    Replies: 1
    Last Post: 03-06-2006, 06:54 PM