Showing results for 
Search instead 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:


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…)



0 Kudos
Message 1 of 3

This is what I ended up doing in my function:

Is Extended Float 128bit.png


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

0 Kudos
Message 2 of 3

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!
0 Kudos
Message 3 of 3