Thread: What is a quadruple-precision integer package?

  1. #1
    Registered User Gerling's Avatar
    Join Date
    Aug 2010

    What is a quadruple-precision integer package?

    I'm working through An Introduction to ANSI C on UNIX which has suited me well so far.
    I don't understand this problem they gave me, though.
    "Write a quadruple-precision integer package with integer arrays and the arithmetic routines: qint_add, qint_sub, int_times, qint_quotient, and qint_display."
    I know pretty well about precision, I think, but why not use floats for only four decimal places? The only meaning I can think of for this problem has already been built into C.

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Take a look at GMP, which is an arbitrary precision math library. It allows you to do calculations with number types such that the range of the results can go beyond the range of the built-in integer and floating point types. It seems to me that you are asking to implement an integer math library similiar to GMP's integer math facilities, except that it is limited to quadruple precision, not arbitrary precision. "Quadruple precision" itself probably just means that you are expected to make use of an array of four ints to store the value of your integer type.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    Registered User Gerling's Avatar
    Join Date
    Aug 2010
    The GMP looks very interesting. I'm glad you told me about it. I think I understand the exercise, now. It looks pretty challenging for me at this stage.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. help assignment due tomorrow
    By wildiv in forum C Programming
    Replies: 6
    Last Post: 01-27-2010, 08:38 PM
  2. memory issue
    By t014y in forum C Programming
    Replies: 2
    Last Post: 02-21-2009, 12:37 AM
  3. Link List math
    By t014y in forum C Programming
    Replies: 17
    Last Post: 02-20-2009, 06:55 PM
  4. Looking for constructive criticism
    By wd_kendrick in forum C Programming
    Replies: 16
    Last Post: 05-28-2008, 09:42 AM
  5. load gif into program
    By willc0de4food in forum Windows Programming
    Replies: 14
    Last Post: 01-11-2006, 10:43 AM