Do ARM Cortex based Arduino boards accept the type double?

Hi everybody,

I read somewhere that the AVR based Arduinos don't deal with the type double, in other words double = float.

Does this stand true with ARM Cortex based Arduino boards programmed with the Arduino IDE ?

Thanks
Paul

Probably what you heard was that AVR 8-bit uC treat INT as 16-bit where 32-bit ARM uC treat INT as 32-bit wide.

Otherwise, numerical types are handled by the gcc compiler.

avr-gcc - GCC Wiki (gnu.org)

The ARM based STM32 line compiler info is here:
GitHub - stm32duino/arm-none-eabi-gcc: The GNU Arm Embedded Toolchain binaries used by STM32duino cores

Microchip has a nice chart:

AVR42787: AVR Software User Guide (microchip.com)

ARM architecture is discussed here:
ARM Compiler armcc User Guide Version 5.05

1 Like

These sloppy C types only mean that double should be wider than float.

If you mean 16, 32 and 64 bit floats then you have to check for each distinct controller what the compiler makes from double or float type. Simple check: let a test program output the sizeof (byte count) for float and double types.

1 Like

"at least as wide as"

yes, I believe all of the ARM cores use 64bit IEEE floats for "double" (and all of the otherwise undesignated floating point functions like "sin", "pow", constants containing decimal point, and intermediate simple math (like 3.14159/(180.0*deg)) This can cause unexpectedly poor performance , especially on the CM0 platforms, which have a pretty unoptimized floating point library.

1 Like

Thanks guys. Very instructive answers. :+1: :+1:

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.