[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-libc-dev] Math accuracy

From: Matthew MacClary
Subject: Re: [avr-libc-dev] Math accuracy
Date: Mon, 24 Apr 2006 08:44:37 -0700
User-agent: Mutt/1.4.1i

On Mon, Apr 24, 2006 at 12:21:24AM +0200, Björn Haase wrote:
> Presently there is no difference concerning the code if you are
> writing "double" or "float".

    The same calculations are definitely performed for both. However,
I once ran a quick and dirty floating point benchmark that showed a
small but repeatable speed advantage to using "double" instead of
    Looking back at my notes, I didn't record whether the final
numbers I wrote were collected using "double" or "float", but here is
what I got at 16MHz:

addition      : 30330 flops
subtraction   : 26770 flops
multiplication:  8840 flops
division      : 11690 flops

    It was surprising to me that division was faster than
multiplication. Also these numbers were collected with no optimization
flags. For some reason, the compiler would optimize away floating
point operations even if the floating point variable was volatile.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]