Search code examples
cfloating-pointavr

How does an AVR perform floating point Arithmetic


I'm trying to implement a support for double and float and corresponding basic arithmetic on a CPU without an FPU.

I know that it is possible on all AVR ATmega controllers. An ATmega also has no FPU. So here comes the question: How does it work? If there any suggestions for literature or links with explanations and examples?

At the best case I will provide a support for code like this:

double twice ( double x )
{
  return x*x;
}

Many thanks in advance, Alex


Solution

  • Here are AVR related links with explanations and examples for implementing soft double:

    1. You will find one double floating point lib here.
    2. Another one can be found it in the last message here.
    3. Double is very slow, so if speed is in concern, you might opt for fixed point math. Just read my messages in this thread: