Accuracy (number of decimal places) in the data received from the Web API

Is there any way to customize the number of decimal places for data that comes through the Web API.

 

We have encountered a problem. A old script using PI SDK gets more accurate data than a new script using Web API.

 

For example:


image.png
Accuracy is critical to our project.

Parents
  • If your PI Points are defined as Float32, then the old script is NOT giving you more accurate data. If they are Float32, the new script is giving you the correct values. What you are observing is the automatic upscaling of a Float32 to a Float64, which introduces those extra digits according to IEEE 754.

     

    The deciding factor should not be how the PIPoints are stored but rather WHAT is the precision of the source input? If the source is a Single or Float32, and you store as a Float64 in PI, then you have introduced noise and insignificant digits to the input value. In this case, it is a false assumption to believe that the 16 digit number is more accurate.

     

     

     

Reply
  • If your PI Points are defined as Float32, then the old script is NOT giving you more accurate data. If they are Float32, the new script is giving you the correct values. What you are observing is the automatic upscaling of a Float32 to a Float64, which introduces those extra digits according to IEEE 754.

     

    The deciding factor should not be how the PIPoints are stored but rather WHAT is the precision of the source input? If the source is a Single or Float32, and you store as a Float64 in PI, then you have introduced noise and insignificant digits to the input value. In this case, it is a false assumption to believe that the 16 digit number is more accurate.

     

     

     

Children
No Data