From: David Schleef Date: Tue, 22 Jan 2002 09:32:28 +0000 (+0000) Subject: Fixed strange unreproducible behavior with insn barfing. Turns out X-Git-Tag: r0_7_18~3 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=6fc61032794a8169d201ada6f2fa90d1dd827a33;p=comedilib.git Fixed strange unreproducible behavior with insn barfing. Turns out that -5 is not really equal to -5. --- diff --git a/comedi_calibrate/comedi_calibrate.c b/comedi_calibrate/comedi_calibrate.c index a2a4357..384983a 100644 --- a/comedi_calibrate/comedi_calibrate.c +++ b/comedi_calibrate/comedi_calibrate.c @@ -651,7 +651,8 @@ int get_bipolar_lowgain(comedi_t *dev,int subdev) for(i=0;imin != -range->max)continue; + /* This method is better than a direct test, which might fail */ + if((range->min+range->max)>(range->max*0.0001))continue; if(range->max>max){ ret = i; max=range->max; @@ -671,7 +672,8 @@ int get_bipolar_highgain(comedi_t *dev,int subdev) for(i=0;imin != -range->max)continue; + /* This method is better than a direct test, which might fail */ + if((range->min+range->max)>(range->max*0.0001))continue; if(range->maxmax; @@ -796,6 +798,8 @@ int comedi_data_read_n(comedi_t *it,unsigned int subdev,unsigned int chan, printf("insn barfed: subdev=%d, chan=%d, range=%d, aref=%d, " "n=%d, ret=%d, %s\n",subdev,chan,range,aref,n,ret, strerror(errno)); + printf("please report this error\n"); + exit(1); return ret; }