From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Isolating specific places of a fixed point number

Hello all,

Is there an easy way to get the specific values of a floating point value? For example, consider the value 12.75. Is there a predefined/standard way to get the 1 when I request the value in the tens position, the 2 when I request the value in the ones position, the 7 when I request the value in the tenths position, and the 5 when I request the value in the hundredths position? Thanks for any and all replies. 

0 Kudos
Message 1 of 4
(2,223 Views)

You can either do the math or operate on the formatted string. Be aware that exact decimal floating point fractions often do not have an exact binary representation.

 

What have you tried?

0 Kudos
Message 2 of 4
(2,220 Views)

What do you mean by do the math? Is there a mathematical way to solve this?

What do you mean by "floating point fractions often do not have an exact binary representation"?

Ultimately I am trying to a FPGA value to a user input value by first matching the integer components, then the tenths component, and then the hundredths component. If the integer components match (e.g. 12.05 and 12.1), I go on and match the tenths component. If the tenths components match, I match the hundredths component. Hopefully this explains what I am implementing further. 


So far I have assumed that I can isolate the integer portion of a fixed point number by converting the fixed point representation into an integer via the "Fixed-Point to Integer Cast Function". I have not figured out how to isolate the other components.

0 Kudos
Message 3 of 4
(2,209 Views)

Well, you are confusing all of us. In the subject you are talking about fixed point and in the body of the post you are talking about floating point. These are very different things!

 

Thanks for adding additional information about the problem. What exactly does the user enter? What is the range (# of bits, scaling) of the fixed point number?

 

OK, you are "matching" things. How is the result later used? Why don't you match in binary instead of in decimal?

0 Kudos
Message 4 of 4
(2,200 Views)