cancel
Showing results for 
Search instead for 
Did you mean: 

Double Precision on STM32F411E ARM Cortex M4 (32BIT). My question is can i perform Arithmetic operation on 64 bit variables having data types long double having floating point.

SShuj.1
Associate II
 
6 REPLIES 6

Dont recall it supporting 'long double' you'd need to check the math libraries.

The regular 'double' is done if software.​

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
TDK
Guru

Yes, but it will be done in software and be very slow.

"double" is 64-bit, "long double" is the same.

If you feel a post has answered your question, please click "Accept as Solution".

Can you please rephrase "done in software" as my calculations are critical and i need up to 10+ decimal places accuracy

For example with float it gives result after some calculation like "78.5849684125" but its wrong it should be 78.584965876.

Can you please rephrase "done if software" as my calculations are critical and i need up to 10+ decimal places accuracy

For example with float it gives result after some calculation like "78.5849684125" but its wrong it should be 78.584965876.And i have to pass these values from STM32 to FPGA

TDK
Guru

Instead of using an FPU unit which can do the calculation in a few instruction cycles, it is emulated in software and takes way way more instructions.

Float has about 6 places of precision.

If you feel a post has answered your question, please click "Accept as Solution".

Uses software libraries rather than using the FPU hardware. The software describing a sequence of steps to perform the math on exponent and mantissa values, and normalize on completion.

Also unlike Intel and Motorola FPU from the past, the ARM implementation does NOT hold intermediate computations at a higher precision.​

You might have to be more aware of your algorithm and math order to maintain optimal precision.

PC and ARM based computations may differ slightly based on intermediate precision loss. As with all floating point, precision is lost as the size of the number increases. Large numbers have the least precision.​

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..