LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

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.

Download All
0 Kudos
Message 1 of 10
(5,573 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 LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 10
(5,560 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.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 3 of 10
(5,557 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 10
(5,523 Views)

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

0 Kudos
Message 5 of 10
(5,522 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 10
(5,515 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?

0 Kudos
Message 7 of 10
(5,511 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 10
(5,499 Views)

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
(4,568 Views)

Hi aht,

 

it's (mainly) the ToFXP function:

check.png

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 10 of 10
(4,566 Views)