LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

half precision to double

Anyone come up with a way to do a fast conversion of half precision float to double precision float?  I haven't found anything on it and it seems that NI might have already addressed this so I don't have to reinvent the wheel.

Thanks.

 

0 Kudos
Message 1 of 5
(3,921 Views)

How are you recieving the half-precision value?  String?  U16?  U8s?  I'm looking for a place to start.  I'm not familiar with any built-in functions, but it looks like it should be simple enough to make.



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 2 of 5
(3,896 Views)

@rickford66 wrote:

Anyone come up with a way to do a fast conversion of half precision float to double precision float?


Do you already have a slow version and are trying to speed it up?

 

I think all reasonable solution (i.e. not invoving boolean arrays in intermediary steps) will be very fast. I would start here, mask out the sign, exponent, and mantissa, shift if needed, and reassemble into a DBL.

 

If speed is really critical, you could make a lookup table, it's only 2^16 possible outcomes! 😄

 

Message 3 of 5
(3,888 Views)

.

Download All
Message 4 of 5
(3,878 Views)

I have coded up a conversion using tables for the exponent and fraction, but it didn't occur to me to make a table for the entire range.  That would be by far the fastest.  Thanks.

 

0 Kudos
Message 5 of 5
(3,873 Views)