X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=src%2Fmath%2Fchart-geometry.c;h=736f89934b986648cc6ca1c423473a520d7676a5;hb=334ecf90912ed0f3cb3c9ce0c97f175ab9354382;hp=7449cd79564d36507fd151a2d7b0dba088b9e906;hpb=164d1274fcb70c54897f2a03fc7c27152ed4821a;p=pspp
diff --git a/src/math/chart-geometry.c b/src/math/chart-geometry.c
index 7449cd7956..736f89934b 100644
--- a/src/math/chart-geometry.c
+++ b/src/math/chart-geometry.c
@@ -1,28 +1,26 @@
-/* PSPP - computes sample statistics.
+/* PSPP - a program for statistical analysis.
Copyright (C) 2004 Free Software Foundation, Inc.
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- 02110-1301, USA. */
-
+ along with this program. If not, see . */
+#include
#include
#include
#include "chart-geometry.h"
-/* Adjust tick to be a sensible value
+/* 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)
@@ -32,16 +30,16 @@ chart_rounded_tick(double tick)
double diff = DBL_MAX;
double t = tick;
-
+
static const double standard_ticks[] = {1, 2, 5, 10};
const double 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 ) ;
- if ( d < diff )
+ if ( d < diff )
{
diff = d;
t = standard_ticks[i] / factor ;
@@ -49,6 +47,6 @@ chart_rounded_tick(double tick)
}
return t;
-
+
}