LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to get a rid of unnecessary numbers.

hello every one,

i have one number which is 0.125401 i just need to show 0.12 and get a rid of other (5401). how can i do it?

thank you in advance.

0 Kudos
Message 1 of 6
(1,070 Views)

Hi new,

 

the easiest would be to change the formatting options used for your indicator.

 

On the other hand you want to explicitely ROUND DOWN in contrast to default "bankers rounding" when you want to display "0.12" for a given input of "0.125401" - most would expect a display of "0.13" instead.

So the answer is: multiply by 100, round down, divide by 100, display using a format of %.2f…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 6
(1,052 Views)

 

Getting rid of numbers is very difficult. 

 

Here is a little number that just keeps showing up! Totally unnecessarily 


"Should be" isn't "Is" -Jay
Message 3 of 6
(1,031 Views)

🙄 Uhg!  Is NO PLACE sacred anymore?  What a world. 😩

LabVIEW Pro Dev & Measurement Studio Pro (VS Pro) 2019 - Unfortunately now moving back to C#, .NET, Python due to forced change to subscription model by NI. 8^{
0 Kudos
Message 4 of 6
(989 Views)

@newmemeber123 wrote:

hello every one,

i have one number which is 0.125401 i just need to show 0.12 and get a rid of other (5401). how can i do it?

thank you in advance.


 

Completely ambiguous questions:

 

What is the datatype of the "number"?

 

  • If it is a string just take the substring from the beginning to 2 characters after the decimal points.
  • If this is a numeric indicators, just change the display format to show two decimal digits (right-click...display format. And yes, that would show 0.13 in your case).
  • If this is a floating point datatype (DBL, SGL) and you want to truncate the actual "wire data" for a fixed number of decimal places, you are out of luck because most fractions that look nice in decimal would need an infinite number of mantissa bits in the internal binary representation. Impossible!
0 Kudos
Message 5 of 6
(956 Views)

This is one way you can do it, there are many others. 

snip.png

______________________________________________________________
Have a pleasant day and be sure to learn Python for success and prosperity.
0 Kudos
Message 6 of 6
(941 Views)