projects
/
pspp
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge 'master' into 'psppsheet'.
[pspp]
/
src
/
math
/
chart-geometry.c
diff --git
a/src/math/chart-geometry.c
b/src/math/chart-geometry.c
index 573459892e109781e4eaa079ed0d34d5549cbfc7..eb0ad9282a854885768472319a899dbfba6c14ea 100644
(file)
--- a/
src/math/chart-geometry.c
+++ b/
src/math/chart-geometry.c
@@
-20,29
+20,30
@@
#include "chart-geometry.h"
#include "chart-geometry.h"
+static const double standard_ticks[] = {1, 2, 5, 10};
+
+
/* Adjust tick to be a sensible value
ie: ... 0.1,0.2,0.5, 1,2,5, 10,20,50 ... */
double
/* Adjust tick to be a sensible value
ie: ... 0.1,0.2,0.5, 1,2,5, 10,20,50 ... */
double
-chart_rounded_tick(double tick)
+chart_rounded_tick
(double tick)
{
int i;
double diff = DBL_MAX;
double t = tick;
{
int i;
double diff = DBL_MAX;
double t = tick;
- static const double standard_ticks[] = {1, 2, 5, 10};
-
double factor;
/* Avoid arithmetic problems with very small values */
double factor;
/* Avoid arithmetic problems with very small values */
- if (abs (tick) < DBL_EPSILON)
+ if (
f
abs (tick) < DBL_EPSILON)
return 0;
return 0;
- factor = pow
(10,ceil(log10(standard_ticks[0] / tick)))
;
+ factor = pow
(10,ceil (log10 (standard_ticks[0] / tick)))
;
for (i = 3 ; i >= 0 ; --i)
{
for (i = 3 ; i >= 0 ; --i)
{
- const double d = fabs
( tick - standard_ticks[i] / factor )
;
+ const double d = fabs
(tick - standard_ticks[i] / factor)
;
if ( d < diff )
{
if ( d < diff )
{
@@
-52,6
+53,5
@@
chart_rounded_tick(double tick)
}
return t;
}
return t;
-
}
}