Bug 779 - Analog output module cannot handle 7.5 digit or higher resolution readings
Summary: Analog output module cannot handle 7.5 digit or higher resolution readings
Status: CONFIRMED
Alias: None
Product: libsigrok
Classification: Unclassified
Component: Output: analog (show other bugs)
Version: unreleased development snapshot
Hardware: All All
: Normal normal
Target Milestone: ---
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-03-27 22:48 CEST by mrnuke
Modified: 2020-09-18 17:09 CEST (History)
1 user (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description mrnuke 2016-03-27 22:48:25 CEST
The analog output module assumes all data is represented as floats, and does not check the packet->encoding->unitsize field. In the event that a driver sends data as doubles, the module will produce bogus readings:

Example:

If the value is 9.980094, the module will output:

 "Front: -216919875248769044840448.0000000 V"


7.5 (30M count) digit or higher instruments need to send data with double precision, since single precision numbers can only handle around 16.7 M counts (24-bit mantissa).

For example, a reading of 3.0278874 will be represented as 3.0278873 in single precision. This was discovered with the HP3457A, whose ADC has a resolution of 30.3 million counts.
Comment 1 Gerhard Sittig 2020-09-18 17:09:26 CEST
libsigrok f37f11ec6b3b added support for double precision input data in 
packet feeds. File format input modules and acquisition device drivers can 
migrate to feeding doubles to the session bus. Applications can retrieve 
doubles when the libsigrok API gets extended (not yet done as of today).

Although the public library API currently sticks with single precision 
return values, the internal calculation is done on double precision data 
which can improve behaviour of existing applications transparently.