From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

# LabVIEW

cancel
Showing results for
Did you mean:

## Size of Extended Float/Complex

Hi everyone,

I'm developing a function that can convert any numeric type value to any other numeric type.

Before converting, I would like to check if the output type is big enough to contain the input type.

There is one particular case that bothers me: from U64/I64 to Extended Float (also by extension, Extended Complex).

If the extended float has 128 bits (or actually 80 bits) of precision, it is enough to take an U64 or I64.
If however it has only 64 bits, then it is not enough. How do I know the actual size of an extended float ?

Here it says the extended float size varies depending on the platform without saying much more:

https://www.ni.com/docs/en-US/bundle/labview/page/lvhowto/floating_point_numbers.html

Is there a simple way of knowing the size of an extended float on the current target ?

(appart from measuring the flattened string size of course…)

Thanks,

Raphaël.

Message 1 of 3
(555 Views)

## Re: Size of Extended Float/Complex

This is what I ended up doing in my function:

But still wanted to know if there is a more elegant way of doing.

Message 2 of 3
(523 Views)

## Re: Size of Extended Float/Complex

I don't know how you plan for your conversion to work exactly, but one thing you can probably do is maintain a lookup table (probably a map) which has the combination of input and output type as the key. When you first encounter a combo, do a  conversion for some max value of that type, then convert back and compare to the original. If the result is the same, that should mean the conversion can work and you can cache that answer.

___________________
Try to take over the world!
Message 3 of 3
(508 Views)