--- /dev/null
+// examples/coord-test.cc
+//
+// Copyright 2010 Martin Read. All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 3. Neither the name of the author nor the names of any other contributors
+// may be used to endorse or promote products derived from this software
+// without their specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+// SUCH DAMAGE.
+
+#include <stdio.h>
+#include <stdint.h>
+#include <libmormegil/Coord.hh>
+
+int main()
+{
+ libmormegil::Coord c1 = { 16, -23 };
+ libmormegil::Coord c2 = { 9, 47 };
+ libmormegil::Offset o = c2 - c1;
+ printf("c1: %d, %d\n", c1.y, c1.x);
+ printf("c2: %d, %d\n", c2.y, c2.x);
+ printf("o: %d, %d\n", o.y, o.x);
+ return 0;
+}
+
+// vim:ts=8:sw=4:expandtab:fo=cq
+// dice-test.cc
--- /dev/null
+.TH "LIBMORMEGIL::DIV_UP" 3 "October 10, 2010" "libmormegil Version 1.0" "libmormegil User Manual"
+.SH NAME
+libmormegil::div_up \- integer divide rounding upwards
+.SH SYNOPSIS
+#include <libmormegil/mathops.hh>
+
+template<typename T> T libmormegil::div_up(T orig, T divisor);
+
+.SH DESCRIPTION
+.I libmormegil::div_up
+is a naively written template for upward-rounding integer division.
+
+This function exists because not all the world is an x86, and integer to
+floating point conversion is \fIpainfully\fIP awkward on at least one major
+load-store architecture.
+
+.SH RETURNS
+The rounded-up result of dividing \fIorig\fP by \fIdivisor\fP.
+
+.SH CAVEATS
+
+Implemented as naively as possible.
+
+May not do what you want if \fIorig\fP is negative. I happen to try to avoid
+dividing negative integers anyway.
+
+.SH AUTHOR
+Martin Read <mpread@chiark.greenend.org.uk>
+
+.SH SEE ALSO
+
+libmormegil(3)
--- /dev/null
+.TH "LIBMORMEGIL::SIGN" 3 "October 10, 2010" "libmormegil Version 1.0" "libmormegil User Manual"
+.SH NAME
+libmormegil::sign \- compute absolute value
+.SH SYNOPSIS
+#include <libmormegil/mathops.hh>
+
+template<typename T> T libmormegil::sign(const T& orig);
+
+.SH DESCRIPTION
+.I libmormegil::sign
+is a naively written template for obtaining the sign of \fIorig\fP.
+
+.SH RETURNS
+1 if \fIorig\fP is positive, 0 if \fIorig\fP is 0, -1 if orig is negative.
+
+.SH CAVEATS
+
+Implemented as naively as possible. Exists because <algorithm> does not
+provide such a feature.
+
+.SH AUTHOR
+Martin Read <mpread@chiark.greenend.org.uk>
+
+.SH SEE ALSO
+
+libmormegil(3)