A Programming Contest Floating-Point Comparison and Monitoring Program

pfcpfmp

Programming Contest Floating Point problems need a
Programming Contest Floating Point Comparison and Monitoring Program: pcfpcmp

The documentation for pfcpcmp is in the source code, pcfpcmp.c.

To build it, just run make using the Makefile you'll find here (which also builds pcfptag), or do it by hand:

	cc -Dunix -o pcfpcmp pcfpcmp.c
on a UNIX system. It does not depend on anything outside the ISO C standard. To compile it on any other system, use your compiler's options to set strict "ANSI" conformance.

If you want some kind of GUI wrapper around it, you'll have to do it yourself, but there are only four actions needed:

so it should be easy. To make it simpler, the code has been written so that main() only decodes the arguments, while check() does everything else. It uses setjmp() and longjmp() to catch errors. Instead of writing to stdout, my_exit() should put up an alert box. my_exit(EX_SOFTWARE) should quit the program after the alert is displayed.

Don't bother about optimisation or switching off assertions.

For details of the markup, read the source code.

Related files

pcfptag

Programming Contest Floating Point Tagging and Adaption Grinder: pcfptag

This lets you use pcfpcmp for model answers that do not contain floating point numbers, and for the first stage of developing ones that do. You write a model answer with no excess blank lines at the end and no excess blanks at the end of lines, and no special care about reserved characters. Then

	pcfptag <draft >model
or
	pcfptag draft >model

adds the necessary magic characters to allow extra blank lines at the end of an answer and extra blanks at the end of answer lines. Floating point markup you will have to add yourself, but

	pcfptag rawmodel | pcfpcmp - submission

compares a submission against the raw model.

The source code is pcfptag.c.

The same notes about compilation apply. For a Macintosh, or any other GUI interface, there are just four actions:

If someone wants to program that, I'd be delighted to have it.