> From [email protected] Wed Jul 19 09:09 CDT 1995
> Date: Wed, 19 Jul 1995 15:08:01 +0100 (BST)
> From: Andy Foster <[email protected]>
> X-Sender: ajf@orc
> To: Epics Questions <[email protected]>
> 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
<1995>
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
- Navigate by Thread:
- Prev:
Internal type conversion in Epics Andy Foster
- Next:
Internal type conversion in EPICS Andy Foster
- Index:
1994
<1995>
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
|