This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

MSP430 and IAR: Is there any difference between float and double in 32 bit mode?

Hi,

 

I wonder if there is any difference between float and double in 32 bit mode?

 

Thanks,

BP.

  • They are the same. Both slow and big but not as slow and big as double in 64-bit mode.

  • For every CPU without a math coprocessor I recommend staying away from floats and doubles. And even if the CPU has one, float and double should only be use where absolutely necessary.

    If you need fractional values, try the Q numbers fixed point arithmethics instead. The MSPs hardwar emultiplier has support for them, and addition/subtraction is quite simple. Only division is a bit tricky but on the bottom line it is way faster than float and due to the fact th<at you know the fractional depth, you won't encounter unwilcome surprises with the value range.

  • The Decimal, Double, and Float variable types are different in the way that they store the values. Precision is the main difference where float is a single precision (32 bit) floating point data type, double is a double precision (64 bit) floating point data type and decimal is a 128-bit floating point data type.

    More info.... http://net-informations.com/q/faq/float.html

    Brian

  • Brian, whether float and double are different precision at all and in which format they are stored, depends on the compiler. So the only valid reference for this information will be the compiler manual.

    The source you referenced is for C#, Asp.Net and VB.net. So any information there is not related or C or C++ compilers. (Decimal is an unknown type in the C/C++world too)

**Attention** This is a public forum