From 410d309c1279d6cc38edc69e7ba3282bba850783 Mon Sep 17 00:00:00 2001 From: oetiker Date: Sun, 6 May 2007 19:38:22 +0000 Subject: [PATCH] don't use round since it is c99 ... use floor(x+0.5) for positive numbers instead. git-svn-id: svn://svn.oetiker.ch/rrdtool/branches/1.2@1055 a5681a0c-68f1-0310-ab6d-d61299d08faa --- program/src/rrd_graph.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/program/src/rrd_graph.c b/program/src/rrd_graph.c index 35978cf6..22439b57 100644 --- a/program/src/rrd_graph.c +++ b/program/src/rrd_graph.c @@ -1673,8 +1673,8 @@ int draw_horizontal_grid(image_desc_t *im) for (i = sgrid; i <= egrid; i++){ double Y0=ytr(im,im->ygrid_scale.gridstep*i); double YN=ytr(im,im->ygrid_scale.gridstep*(i+1)); - if ( round(Y0) >= im->yorigin-im->ysize - && round(Y0) <= im->yorigin){ + if ( floor(Y0+0.5) >= im->yorigin-im->ysize + && floor(Y0+0.5) <= im->yorigin){ /* Make sure at least 2 grid labels are shown, even if it doesn't agree with the chosen settings. Add a label if required by settings, or if there is only one label so far and the next grid line is out of bounds. */ @@ -1837,7 +1837,7 @@ horizontal_log_grid(image_desc_t *im) pre_value = value; Y0 = ytr(im, value); - if(round(Y0) <= im->yorigin - im->ysize) break; + if(floor(Y0+0.5) <= im->yorigin - im->ysize) break; /* major grid line */ gfx_new_dashed_line ( im->canvas, @@ -1897,7 +1897,7 @@ horizontal_log_grid(image_desc_t *im) if(value < im->minval) continue; Y0 = ytr(im, value); - if(round(Y0) <= im->yorigin - im->ysize) break; + if(floor(Y0+0.5) <= im->yorigin - im->ysize) break; /* draw lines */ gfx_new_dashed_line ( im->canvas, @@ -1913,7 +1913,7 @@ horizontal_log_grid(image_desc_t *im) if(value < im->minval) continue; Y0 = ytr(im, value); - if(round(Y0) <= im->yorigin - im->ysize) break; + if(floor(Y0+0.5) <= im->yorigin - im->ysize) break; /* draw lines */ gfx_new_dashed_line ( im->canvas, @@ -1954,7 +1954,7 @@ horizontal_log_grid(image_desc_t *im) if(value < im->minval) continue; Y0 = ytr(im, value); - if(round(Y0) <= im->yorigin - im->ysize) break; + if(floor(Y0+0.5) <= im->yorigin - im->ysize) break; /* draw lines */ gfx_new_dashed_line ( im->canvas, @@ -1971,7 +1971,7 @@ horizontal_log_grid(image_desc_t *im) if(value < im->minval) continue; Y0 = ytr(im, value); - if(round(Y0) <= im->yorigin - im->ysize) break; + if(floor(Y0+0.5) <= im->yorigin - im->ysize) break; /* draw lines */ gfx_new_dashed_line ( im->canvas, -- 2.30.2