LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

floating point to fixed point conversion :::what is the algorithem

hi member

i have number which is a floating ponit and i converted it to fixed ponit representation by use lab view to fixed block vi

 

i am asking what is the algorithem that have been used by the to fixed block vi??

 

best rgeads

hi ?Q>

0 Kudos
Message 1 of 6
(4,095 Views)

Hi Mangood,

 

May I know what the fixed block vi you are referring to?

 

Are you referring to this function: To fixed point?

 

http://zone.ni.com/reference/en-XX/help/371361J-01/glang/to_fixed_point/

 

Regards,

KwokHow

Applications Engineer | National Instruments
Singapore (65) 6226 5886 | Malaysia (60) 3 7948 2000 | Thailand (66) 2 298 4800
Philippines (63) 2 659 1722 | Vietnam (84) 28 3911 3150 | Indonesia (62) 21 2783 2355
Message 2 of 6
(4,058 Views)

yes
i asking what is the algorithem that can be used to convert floating point to   fixed point with out use this VI!!!!

hi ?Q>

0 Kudos
Message 3 of 6
(4,018 Views)

@mangood wrote:
i asking what is the algorithem that can be used to convert floating point to   fixed point with out use this VI!!!!

The details of the algorithm depend on the configuration of the "To Fixed Point" function (in Properties). With default values, this algorithm produces identical results. A fixed-point value is a lot like an integer, except that the first bit has a value of 2^(-n) instead of a value of 1. To convert a floating point to a nearly-equivalent fixed-point, you multiply the floating point by 2^n, then convert that to an integer.

floating to fixed.png

Message 4 of 6
(4,004 Views)

There's a good paper here which explains the structure of a fixed-point value - http://zone.ni.com/devzone/cda/pub/p/id/303

 

To clarify Nathan's response, basically, a FXP has N bits which are a regular binary integer and M bits for the fraction, which work just like the integer (you multiply and add), but the Mth bit from the point is worth 2^(-M), so .001 is (0*1/2)+(0*1/4)+(1*1/8) or 0.125.


___________________
Try to take over the world!
Message 5 of 6
(3,967 Views)

@tst wrote:

There's a good paper here which explains the structure of a fixed-point value - http://zone.ni.com/devzone/cda/pub/p/id/303

 

To clarify Nathan's response, basically, a FXP has N bits which are a regular binary integer and M bits for the fraction, which work just like the integer (you multiply and add), but the Mth bit from the point is worth 2^(-M), so .001 is (0*1/2)+(0*1/4)+(1*1/8) or 0.125.


thank you

hi ?Q>

0 Kudos
Message 6 of 6
(3,878 Views)