07-02-2012 10:02 AM
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.
07-02-2012 11:05 AM
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.
07-02-2012 11:20 AM - edited 07-02-2012 11:21 AM
@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! 😄
07-02-2012 11:33 AM
.
07-02-2012 11:39 AM
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.