j123b567 / scpi-parser

Open Source SCPI device library
BSD 2-Clause "Simplified" License
473 stars 196 forks source link

Number of significant digits (precision) returned by SCPI_ResultDouble #101

Open jfichtner opened 6 years ago

jfichtner commented 6 years ago

Hello @j123b567, have you ever considered making the number of significant digits returned by SCPI_ResultDouble configurable? Or perhaps creating another function (e.g. "SCPI_ResultDoubleN(scpi_t * context, double val, size_t prec)") that provides a parameter for precision?

I am using scpi-parser in an instrument that uses doubles to represent a value with 8 significant digits, and some of the stakeholders on my team mentioned that the 15 digits that are returned are less than ideal, given the extra 7 meaningless digits in a result that is returned at a rate of 100 rdgs/sec. I figured maybe you had thought about this before, and if not, I wondered if you'd be open to that sort of feature.

j123b567 commented 6 years ago

You have several possibilities

It is not so easy to make it configurable because it uses several techniques on different platforms.