This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Floating point calculations

Hello

I am trying to execute a floating point calculation with the 8051. Something like:

Result = Val1 * 0.75 + Val2 * 0.25

The C51 compiler can take that no problem, but it takes a long time to execute, would anyone know a smarter and faster way to execute this kind of code.

Thanks a lot.
Laurent

Parents
  • would anyone know a smarter and faster way to execute this kind of code.

    sure, use fixed point and calculate like this
    value *= 3;
    value /= 4;

    The C51 compiler can take that no problem, but it takes a long time to execute

    of course it does the '51 is a microcontroller not a microprocessor

    If you need floating point calculations done with any speed, choose a suitable processor.

    Erik

Reply
  • would anyone know a smarter and faster way to execute this kind of code.

    sure, use fixed point and calculate like this
    value *= 3;
    value /= 4;

    The C51 compiler can take that no problem, but it takes a long time to execute

    of course it does the '51 is a microcontroller not a microprocessor

    If you need floating point calculations done with any speed, choose a suitable processor.

    Erik

Children
No data