LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

fraction to integer

According to my local FPGA expert,  Labview FPGA does not support floating point math, only integer math.  So you cannot multiply 1.234 X 2.  You have to create your own floating point math routines.  One thing you could do is to multiply the floating point by powers of 10 until the decimal is gone.  For instance, 1.234 X 1000 = 1234.  Now you have an integer.  Multiply 1234 X 2 = 2468.  Now you have to get this back in floating point.  FPGA doesn't have a divide function so you have to figure out where the decimal should go.  In this example, it is easy to see that the answer should be 2.468.  You will have to work out the details.
 
The local expert here says most people tend to not use floating point numbers in FPGA applications.  If there is a way around it, you would be best to avoid using floating point numbers.
- tbob

Inventor of the WORM Global
0 Kudos
Message 11 of 12
(1,000 Views)
LabVIEW FPGA does not support floating point data types, e.g. single (SGL) and double (DBL). All math in LabVIEW FPGA is performed using integer data types. In addition the basic division function is not supported on the FPGA.
 
For information on scaling and multiplying values on the FPGA by non-integer constants look at this application note.
 
 
authored by
Christian L, CLA
Systems Engineering Manager - Automotive and Transportation
NI - Austin, TX


  
0 Kudos
Message 12 of 12
(994 Views)