From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

logging float values in a MySQL : wrong fromatting

Hi,

 

I'm using TS with standard DB schema for MySQL to log results from my tests.

Some of the test are standard numeric limit tests (no adapter). Limits and data source are float numbers.

Most of the time everything is well logged in the MySQL DB, but sometimes the floating value is rounded !

 

You can see attached the result in the database and the value from the result which has been logged. In the resultList the data is weel formatted but in MySQL it's rounded.

 

The screen copy shows several numeric limit tests, these numeric limits are in fact the same step which is called at several moments in my sequence. So it's not a problem of result formatting for specific test. However it seems that it happens when the limits (coming from a sequence parameters) are set below 1.

 

What can cause this behavior ?

 

BTW, I'm using TS2012 and MySQL 5.2 (ODBC 5.2.5.0 ANSI Driver).

CLA, CTA, LV Champion
View Cyril Gambini's profile on LinkedIn
This post is made under CC BY 4.0 DEED licensing
Download All
0 Kudos
Message 1 of 3
(4,287 Views)

Hi zyl7,

 

The issue is most likely related to the way floating point values are stored in MySQL. To quote MySQL documentation, "Floating-point numbers sometimes cause confusion because they are approximate and not stored as exact values. A floating-point value as written in an SQL statement may not be the same as the value represented internally".

 

There are more details regarding this in the following link:

http://dev.mysql.com/doc/refman/5.1/en/problems-with-float.html.

 

I have tried to reproduce your scenario using TS 2012 sp1 and MySQL 5.2.5.0 ANSI ODBC Driver but I was unsuccessful even after trying a range of similar values. So the issue you faced is most likely dependent on the machine in use and might not be reproducible in a different set-up.

 

If the reason you raised this concern is because any comparisions on the floating point values stored in the database might be incorrect (because of the differences in the value passed from TestStand and the actual value stored), please follow the guidelines specified in the link above (especially the comments in the end of the page) to ensure your comparision operations always use a tolerence when calculating the results.

TestStand does float comparisions using a tolerence, so the pass/fail status generated by TestStand should be accurate.

 

Let me know if you have any concerns.

 

0 Kudos
Message 2 of 3
(3,750 Views)

Hi TRJ,

 

Indeed this behavior is related to MySQL. I've traced my data from generation to DB saving : within TS the data is consistent. Once it's transfered into MySQL it is rounded.

MySQL DB is holding test limits but also test results (2 different databases on the server). Both are verified but quality service and this behavior might be problematic at some point.

This problem is seen on 4 of our computers (2 different computer architecture) in France, China, and Poland.

 

Thanks for your help.

 

Cyril

CLA, CTA, LV Champion
View Cyril Gambini's profile on LinkedIn
This post is made under CC BY 4.0 DEED licensing
0 Kudos
Message 3 of 3
(3,745 Views)