New module to perform decimal floating point arithmetic for charts.
authorJohn Darrington <john@darrington.wattle.id.au>
Tue, 6 Jan 2015 06:25:21 +0000 (07:25 +0100)
committerJohn Darrington <john@darrington.wattle.id.au>
Fri, 16 Jan 2015 10:04:03 +0000 (11:04 +0100)
commitaad0ae4913ecd01ccc954f8828623ad5da35cd1b
tree365d658296146888d064f4ea69208c0f960f245b
parentbf4006fb1f0554d72dc5c3c136cca9caa7491700
New module to perform decimal floating point arithmetic for charts.

This change adds a small module to perform floating point arithmetic
with a decimal base, and uses it to calculate the graticule marks for
charts.

Rationale:  Graticule marks want to be displayed in decimal.  However
not all decimal values can be represented in a double precision
floating point binary.  This approach pushes the precision loss from
the value of the mark, to the position on the chart - we don't
particularly care if a tick mark is a fraction of a pixel out of place,
but we do care if 4.0 is displayed as 3.9999999999

Reviewed-by: Ben Pfaff
21 files changed:
src/math/automake.mk
src/math/chart-geometry.c
src/math/chart-geometry.h
src/math/decimal.c [new file with mode: 0644]
src/math/decimal.h [new file with mode: 0644]
src/math/histogram.c
src/output/cairo-chart.c
src/output/cairo-chart.h
src/output/charts/boxplot-cairo.c
src/output/charts/np-plot-cairo.c
src/output/charts/plot-hist-cairo.c
src/output/charts/roc-chart-cairo.c
src/output/charts/scatterplot-cairo.c
src/output/charts/scree-cairo.c
src/output/charts/spreadlevel-cairo.c
tests/automake.mk
tests/math/chart-geometry-test.c [new file with mode: 0644]
tests/math/chart-geometry.at [new file with mode: 0644]
tests/math/chart-get-scale-test.c [new file with mode: 0644]
tests/math/decimal-test.c [new file with mode: 0644]
tests/math/decimal.at [new file with mode: 0644]