取消
顯示結果 
搜尋替代 
您的意思是: 

U32 to DBL converstion

I am just trying to understand this conversion operation. My understanding was that the conversion to higher data type would be loss less.

 

Can anyone explain why "8389388" of type U32 gets converted to "8389390" DBL.

 

VI

 

Thanks

0 積分
1 條訊息(共 5 條)
5,242 檢視

I think because your indicator is set to show 6 significant digits. The last digit rounds up and you see 8389388 as 8389390

 

Change your indicator's properties to show 7 (or more significant digits and you will see 'the correct value'.

眨眼表情

2 條訊息(共 5 條)
5,229 檢視

Hi Madan,

 

By defult LabVIEW only displays 6 significant digits on the DBL and EXT indicators.  Try right-clicking the indicator, select "Display Format", then raise the digits of precision to 7 or higher.

 

 

Best Regards,

John Passiak
0 積分
3 條訊息(共 5 條)
5,227 檢視

 

搗亂者

 


@Madan wrote:

I am just trying to understand this conversion operation. My understanding was that the conversion to higher data type would be loss less.

 

Can anyone explain why "8389388" of type U32 gets converted to "8389390" DBL.

 

 

 

Thanks


What exactly were you expecting?
A conversion converts the data from one type into another type and keeps the information at the same value.
If you are interested into a binary transer (meaning that the binary data is the same and only the datatype is converted) have a look at typecast:

Typecast.png

Ton

 

Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
0 積分
4 條訊息(共 5 條)
5,225 檢視

 


@Phillip Brooks wrote:

I think because your indicator is set to show 6 significant digits. The last digit rounds up and you see 8389388 as 8389390

 

Change your indicator's properties to show 7 (or more significant digits and you will see 'the correct value'.

眨眼表情


 

To elaborate on Philip's (correct) post, there is a difference between how data is displayed and how data is stored.

When you use U32, that is the internal data type,which explicitly dictates the amount of memory LabVIEW should allocate for that object.

Displaying it is just a matter of formatting the number for the user, in this case, set to 6 significant digits.
But again, this does not mean internally LabVIEW threw out that precision, it just isn't displaying it.

Cory K
0 積分
5 條訊息(共 5 條)
5,193 檢視