Argonne National Laboratory

Experimental Physics and
Industrial Control System

2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  <20152016  2017  2018  2019  2020  2021  2022  Index 2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  <20152016  2017  2018  2019  2020  2021  2022 
<== Date ==> <== Thread ==>

Subject: ao record convert overflow
From: "Schoeneburg, Bernd" <bernd.schoeneburg@desy.de>
To: EPICS Core Talk <core-talk@aps.anl.gov>
Date: Fri, 20 Mar 2015 12:01:04 +0100
Epics R3.14.11 (same as 3.14.12)  vxWorks Pentium
I have encountered a problem when using the aoRecord. The convert routine produces an "overlow" when the double is casted to long. When the value is > (double)LONG_MAX the resulting value of RVAL becomes LONG_MIN instead LONG_MAX. This jump is not healthy for output devices. Possibly this happens only in my environment of compiler or Pentium target. I installed the following fix for me.

diff -r1.2 aoRecord.c
22a23
> #include <limits.h>
466,467c467,473
<     if (value >= 0.0)
<         prec->rval = (epicsInt32)(value + 0.5) - prec->roff;
---
>     if (value >= 0.0) {
>         value -= (double)prec->roff + 0.5;
>         if (value > (double)LONG_MAX)
>            prec->rval = LONG_MAX;
>         else
>            prec->rval = (epicsInt32)value;
>     }

Bernd

Replies:
Re: ao record convert overflow Schoeneburg, Bernd
Re: ao record convert overflow Andrew Johnson

Navigate by Date:
Prev: Build failed in Jenkins: epics-base-3.15-cyg64 #182 APS Jenkins
Next: Re: ao record convert overflow Schoeneburg, Bernd
Index: 2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  <20152016  2017  2018  2019  2020  2021  2022 
Navigate by Thread:
Prev: Jenkins build is back to stable : epics-base-3.14-mac #41 APS Jenkins
Next: Re: ao record convert overflow Schoeneburg, Bernd
Index: 2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  <20152016  2017  2018  2019  2020  2021  2022 
ANJ, 16 Dec 2015 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·