LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Double floating points to fixed points conversions ?

Highlighted

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.

Download All
0 Kudos
Message 1 of 10
(1,872 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

using LV2011SP1 + LV2017 (+LV2020 sometimes) on Win10+cRIO
0 Kudos
Message 2 of 10
(1,859 Views)
Highlighted

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.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
0 Kudos
Message 3 of 10
(1,856 Views)
Highlighted

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 10
(1,822 Views)
Highlighted

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

0 Kudos
Message 5 of 10
(1,821 Views)
Highlighted

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 10
(1,814 Views)
Highlighted

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. It all comes together in GCentral GCentral
What does "Engineering Redefined" mean??
0 Kudos
Message 7 of 10
(1,810 Views)
Highlighted

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 10
(1,798 Views)
Highlighted

kindly upload Above Vi for conversion from  Dbl Floating point to fixed point conversion in labVIEW 2015  version.or upload a screen shot

thanks in advance

 

0 Kudos
Message 9 of 10
(867 Views)
Highlighted

Hi aht,

 

it's (mainly) the ToFXP function:

check.png

Best regards,
GerdW

using LV2011SP1 + LV2017 (+LV2020 sometimes) on Win10+cRIO
Message 10 of 10
(865 Views)