From: oetiker Date: Sun, 6 May 2007 19:38:22 +0000 (+0000) Subject: don't use round since it is c99 ... use floor(x+0.5) for positive numbers instead. X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=49129134ea26ca65862bc9da64f36fe5aaf8fe83;p=rrdtool.git 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/program@1055 a5681a0c-68f1-0310-ab6d-d61299d08faa --- diff --git a/src/rrd_graph.c b/src/rrd_graph.c index 35978cf..22439b5 100644 --- a/src/rrd_graph.c +++ b/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,