Experimental Physics and
| |||||||||||||||||
|
But what does this exactly mean? I think, the most intuitive sense is to format the value like "%.<PREC>f". At least this is the default behaviour of medm when using a text monitor. But why not like "%.<PREC>g" or "%.<PREC>e"? And why does neither caget nor camonitor honor PREC? And what about negative PREC values? That's my problem: It is not documented what PREC really means. Of course, one can look into the code as Marty suggested, but not many people can really find out what's going on in EPICS just by looking in the code :-) Even after finding and understanding cvtFloatToString, etc. it is hard to say under what circumstances those functions are used. To ignore PREC > 8 and use "%12.5e" instead is not what I expected (found in cvtFloatToString). Even though it seems reasonable, because the precision of a float is very limited. I found that in cvtFloatToString, etc., the precision argument is unsigned short. This does not match the definitions of the PREC fields in the dbd files.
printf "%g" works this way, but EPICS obviously not: record (ai, "ai") { field (PREC, "2") field (VAL, "3.1415") } record (stringin, "string") { field (INP, "DZ-AI") field (PINI, "YES") } The value of string is "3.14" When I use 'field (PREC, "-2")', the value of string is "3.14150000000000018e+00" All in all, it was just an idea, how one could define in the record how the value should be shown and not in caget or the adl file. It is more in line with the EPICS philosophy (as I understand it) to configure as much as possible on the record level. A change in cvtFloatToString, etc. could possibly do it for most applications. Dirk -- Dr. Dirk Zimoch Swiss Light Source Paul Scherrer Institut Computing and Controls phone +41 56 310 5182 fax +41 56 310 4413
| ||||||||||||||||
ANJ, 10 Aug 2010 |
·
Home
·
News
·
About
·
Base
·
Modules
·
Extensions
·
Distributions
·
Download
·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing · |