LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 
Reply

Double floating points to fixed points conversions ?

Hi all

I converted double float points to fixed points as shown in the attachments but the get fixed points which are similar to double float points  and wondering  if there is something wrong.

0 Kudos
Message 1 of 8
(980 Views)

Hi Sattam,

 

please attach a VI next time instead of images of an VI…

 

So you convert numbers from a representation allowing fine resolution to a different representation with less resolution and now you wonder about small differences?

Btw. what is the exact FXP format you are using? (Which is NOT visible from your images, but would have been easy to check with a VI!)

Best regards,
GerdW
CLAD expired, using 2009SP1 + LV2011SP1 + LV2017 (+LV2018 sometimes) on Win7+cRIO
Kudos are welcome Smiley Wink

0 Kudos
Message 2 of 8
(967 Views)

I see nothing wrong from the results.  Fixed Point will be less accurate than a DBL for a number of reasons, but use fewer bits making Fixed Point useful for FPGA.  Any other system, I would just stick with DBL representation.


There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
0 Kudos
Message 3 of 8
(964 Views)

Hi GerdW

Thanks for your help.I have attached the VI , if you have any comments please feel free.

Thanks

Sattam

 

 

0 Kudos
Message 4 of 8
(930 Views)

Thanks for your comments. I  need Fixed Point for FPGA.

0 Kudos
Message 5 of 8
(929 Views)

There's a couple of things I'd point out Sattam.

 

If you look at DBL, your resolution is (from Wikipedia): 2−53 ≈ 1.11 × 10−16

With your settings for the FXP, your resolution is 1.52879 × 10−5 

 

That's quite a difference in decimal places.  You should expect to see a difference if you're making this conversion.  You're losing precision.

 

The second thing I'd question is "need" for FPGA.  In many cases, there is a clear need for FXP on FPGA applications.  In others, the SGL datatype is sufficient for your requirements.  Again, it'll lose some resolution from DBL.  But, it's quicker for most to develop with.  If you're not meeting benchmarks, then it might be time to look at moving towards the FXP implementation.

0 Kudos
Message 6 of 8
(922 Views)

When attaching code, please put some interesting default data into the controls so we see what you are trying to show us.

 

What are your requirements for range, resolution and precision? If the values are typically small, maybe you can allocate more for the fractions and less for the integer portion. You also seem to take the absolute value later. Why not take the absolute value first and then use a unsigned FXP representation, giving you one more bit for data.

 

Your original post was completely pointless, because we cannot compare numbers between two arrays from an image, especially if they are truncated. Also, you seem to convert "to DBL" on the left of your code? Why? What was the representation before that? Why convert twice in a row?


LabVIEW Champion Do more with less code and in less time
0 Kudos
Message 7 of 8
(918 Views)

Thanks Both 

Thanks for your comments. My VI is complex (Envelope tracking)which requires some hardware to run.Thus, I attached the photos only.I need fixed points for FPGA but I'm not sure about the required resolution and precision yet.

0 Kudos
Message 8 of 8
(906 Views)