I'm working on the International 8m Gemini Telescopes project
which is using EPICS for software control. I recently came
across the following problem and was wondering if anyone else
has experienced the same thing:
I have tried to pass down a double into a record which only
accepts strings. This record has been written especially for
the Gemini project and is known as a CAD record. Since
the CAD only accepts input strings, I had to do this by first
converting the double into a string using something like:
sprintf( pcad->inpa, "%0.15f", val );
Inside the routine that the CAD record calls, I had to do:
val = strtod( pcad->inpa, &c );
This worked fine but seems to be a bit of an overhead for
passing in a double!
I had previously thought that EPICS would do this sort of conversion
automatically. However, when I tried this I found that I lost a great
deal of accuracy in the value that I was passing in.
For example, I tried to pass 9.564328761234322 through
the output link of a double into the CAD input field. The result after:
val = strtod( pcad->inpa, &c );
was 9.564330000000000.
Is this what you would expect or am I missing something obvious
and important?
==========================================================================
Andy Foster
Royal Greenwich Observatory Tel: 44 (0)1223 374899 (direct)
Madingley Road E-mail: [email protected]
Cambridge
CB3 0HA
UK
- Navigate by Date:
- Prev:
[no subject] Andy Foster
- Next:
[no subject] 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
2025
2026
- Navigate by Thread:
- Prev:
[no subject] Andy Foster
- Next:
Re: Internal type conversion in Epics Marty Kraimer
- 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
2025
2026
|