0

NOTE: First let me be clear that this question is related to a side project I've been working on for fun. This is NOT going to be used in any production/professional code. So answers such as "why did you do this your self when you could have just used ________ library?" are not helpful.

So for the last year or so I've been doing working quite a bit with numerical algorithms, and during that time I messed around a lot with floating point numbers and ways to speed up calculations. So as a fun little side project and as a way to test everything I had learned about them, I've spent the last few months developing a floating point class in my spare time. So far everything appears pretty well and I'm very pleased with it.

So now what I've been trying to do is come up with ways to show that the four basic arithmetic operations are working correctly. I've tested it with several long summations such as the harmonic series and several pi calculations and everything appears to be working correctly.

Are there any other ways that you guys can think of? Any long calculations that have a known answer that you think might be helpful?

Thank for any help you can provide.

  • 1
    Per-operation unit tests against a "known-good" reference are much better at identifying issues than application-level testing. Assuming the your floating-point emulation adheres to IEEE-754, you could do tests against your CPU's built-in floating point unit, such as SSE. You would want to do testing using (1) random test vectors using a high-quality PRNG, (2) manually-determined test vectors of special cases (there is a collection of such test vectors from Belgium that you could use), (3) pattern-based test vectors. – njuffa Apr 30 '15 at 01:29
  • 1
    [2] B. Verdonk, A. Cuyt, and D. Verschaeren, "A precision- and range-independent tool for testing floating-point arithmetric I: basic operations, square root, and remainder" ACM Transactions on Mathematical Software, Volume 27 Issue 1, March 2001, pp. 92-118 [3] N. Schryer, "A test of a computer's floating-point unit". Computer Science Tech. Rep. 89. AT&T Bell Laboratories, Inc., Murray Hill, NJ (1981) – njuffa Apr 30 '15 at 01:37
  • 1
    The ieeeCC754 (IEEE-754 compliance checker) package with the special case test vectors from reference [2] seems to have vanished from the Internet, not even the Internet Archive seems to have a copy. – njuffa Apr 30 '15 at 02:00
  • Wow, excellent articles. Thank you very much! – Mandalf The Beige Apr 30 '15 at 19:55

0 Answers0