Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  <19951996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  Index 1994  <19951996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020 
<== Date ==> <== Thread ==>

Subject: Re: Internal type conversion in Epics
From: mrk@aps.anl.gov (Marty Kraimer)
To: tech-talk@phoebus, ajf@ast.cam.ac.uk
Date: Wed, 19 Jul 1995 09:55:41 -0500
> From ajf@ast.cam.ac.uk Wed Jul 19 09:09 CDT 1995
> Date: Wed, 19 Jul 1995 15:08:01 +0100 (BST)
> From: Andy Foster <ajf@ast.cam.ac.uk>
> X-Sender: ajf@orc
> To: Epics Questions <tech-talk@aps.anl.gov>
> Subject: Internal type conversion in Epics
> Mime-Version: 1.0
> Content-Type> : > TEXT/PLAIN> ; > charset=US-ASCII> 
> Content-Length: 1090
> 
> 
> Marty,
> 
> Thanks for your reply concerning the accuracy of
> converting a Double to a String within EPICS.
> I have done some further investigation and found that
> by setting PREC to 7 in the incoming record (the record
> which is receiving the double), I do indeed get an accuracy
> of 7 decimal places. However, changing PREC to 15 (which you
> might want for the accuracy of a double), 
> I discovered that the double goes through with an
> accuracy of only 5 decimal places!
> 
> The problem lies within the code for "cvtDoubleToString" inside
> libCom/cvtFast.c. Line 150 of cvtFast.c shows that the value will
> be converted to a string as follows, whenever PREC > 8.
> 
> sprintf(pstr_value,"%12.5e\0",flt_value);
> 
> I would say that "%12.5e" format is not what we want in
> this case. Are there any plans to change this to something
> which greater reflects the accuracy expected of a double?

I agree. I will add this to list of bugs in 3.12.1. I think that format should
be  "%22.15e". This change could break code that calls cvtDoubleToString
with insufficiant space for the string. We can only give a warning when
change is made.

Marty Kraimer 


Navigate by Date:
Prev: Internal type conversion in Epics Andy Foster
Next: Re: AO rec flaw Jeff Hill
Index: 1994  <19951996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020 
Navigate by Thread:
Prev: Internal type conversion in Epics Andy Foster
Next: Internal type conversion in EPICS Andy Foster
Index: 1994  <19951996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020 
ANJ, 10 Aug 2010 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·