Winter 2005 UCLA CS 31 Section 1 (Shinnerl)

Programming Project 3 FAQ File

The most recently added question is shown last.
Questions are in boldface. Answers are in regular text.

Last Update: 6:30pm, Friday, 1/21

Please note: with the Microsoft .NET compiler, you must #include <cfloat> in order to access DBL_MAX. It is apparently not in the .NET version of the <climits> library.

  1. How does the final spec differ from the original beta spec?

    The final spec includes exact formulas for arithmetic and geometric sums, and an approximation for polynomial sums with unit base increment (only). You are not required to print out predicted values of sums and/or the error in an approximation to a sum. However, to verify the correctness of your program, you should compare your output to the values predicted by the formulas.

  2. How do I check that my terms and sums don't exceed the maximum representable value of type double?

    To avoid generating any sums beyond DBL_MAX, keep comparing the next term to DBL_MAX - sum, where sum is your running total. If the next term ever exceeds this bound, then print an error message and don't try to compute the total.

    Avoiding overflow in the calculation of the next term is similar.

  3. I get a linking error when I try to use DBL_MAX, which goes away when I include the <cfloat> library.

    Thanks for pointing this out. You're right about needing <cfloat> in MSVC++.NET. (I had tested some code on a UNIX platform that also found DBL_MAX in <climits>. But the .NET compiler apparently doesn't find it there.)



Project 3 home page