]> git.ipfire.org Git - thirdparty/sarg.git/commitdiff
Remove the unnecessary constants in the graph creation
authorFrédéric Marchal <fmarchal@users.sourceforge.net>
Wed, 19 May 2010 19:36:01 +0000 (19:36 +0000)
committerFrédéric Marchal <fmarchal@users.sourceforge.net>
Wed, 19 May 2010 19:36:01 +0000 (19:36 +0000)
grepday.c

index 2175f2cef60da4aac5efa10688e59555d87ba514..107b958f7ad655ec4fec1b28b3045900cb63f831 100644 (file)
--- a/grepday.c
+++ b/grepday.c
 
 #if defined(HAVE_GD)
 
-//! The constant ln(1024).
-#define LOG1024 6.931471805599453084
-
-//! The constant to convert back a linearized binary scale (must be exp(LOGBIN)).
-#define EXPBIN 1024.
-//! The constant to linearise the logarithmic binary scale.
-#define LOGBIN LOG1024
-
 #if defined(HAVE_ICONV_H) && defined(gdFTEX_Unicode)
 #include <iconv.h>
 #define USE_ICONV 1
@@ -317,10 +309,10 @@ static int greport_compute_yaxis(struct PlotStruct *pdata,struct GraphDataStruct
 
       case PTG_LogBin:
          if (pdata->ymin>0.)
-            symin=log(pdata->ymin)/LOGBIN;
+            symin=log(pdata->ymin);
          else
             symin=0.;
-         symax=log(pdata->ymax)/LOGBIN;
+         symax=log(pdata->ymax);
          ymag=1024.;
          break;
 
@@ -397,7 +389,7 @@ static void greport_draw_yaxis(struct PlotStruct *pdata,struct GraphDataStruct *
             break;
 
          case PTG_LogBin:
-            yval=pow(EXPBIN,(double)(y0-y)/gdata->YScale+log(pdata->ymin)/LOGBIN);
+            yval=exp((double)(y0-y)/gdata->YScale+log(pdata->ymin));
             greport_formatbin(yval,2,YLabel,sizeof(YLabel));
             break;
 
@@ -591,9 +583,9 @@ static void greport_plot(const struct userinfostruct *uinfo,struct PlotStruct *p
                if (yval<=pdata->ymin)
                   yval=0.;
                else if (yval>pdata->ymax)
-                  yval=(log(pdata->ymax)-logpmin)/LOGBIN;
+                  yval=log(pdata->ymax)-logpmin;
                else
-                  yval=(log(yval)-logpmin)/LOGBIN;
+                  yval=log(yval)-logpmin;
                greport_formatbin(pdata->datapoints[day],1,blabel,sizeof(blabel));
                break;
             case PTG_Time: