From: oetiker Date: Thu, 3 May 2007 12:43:15 +0000 (+0000) Subject: Testing an double and an integer for equality is bound to produce odd results on... X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=8961594e154d8d662abd25d43567f5331a81aef4;p=rrdtool-all.git Testing an double and an integer for equality is bound to produce odd results on times. Don't do it! -- rrdtool@oldach.net git-svn-id: svn://svn.oetiker.ch/rrdtool/branches/1.2@1052 a5681a0c-68f1-0310-ab6d-d61299d08faa --- diff --git a/program/src/rrd_graph.c b/program/src/rrd_graph.c index 69d68718..aae13170 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 ( Y0 >= im->yorigin-im->ysize - && Y0 <= im->yorigin){ + if ( round(Y0) >= im->yorigin-im->ysize + && round(Y0) <= 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. */