File:Arduino float-point operation speed.png

Summary

Description
English: Speed of various float-point operations in Arduino.

Board used: noname clone of Sparkfun Promicro 32U4-16MHz-5V.
All variables declared as volatile float.
Compiled/uploaded in Arduino IDE 1.8.13.
Speed measured by toggling a port pin (direct port XOR) and measuring the period of resulting pulses on this pin with a digital scope (one period = two loop cycles). All interrupts were disabled.
The overhead of toggling the pin and looping the loop(), 7 clock cycles or 0.44 us, has been deducted from measured values.

The anomalous short summation time (marked with asterisk) applies to cases when operands are so disparate in value, that after the normalization one of them is reduced to zero and the summation per se is skipped.
Date
Source Own work
Author Retired electrician

Licensing

I, the copyright holder of this work, hereby publish it under the following license:
Creative Commons CC-Zero This file is made available under the Creative Commons CC0 1.0 Universal Public Domain Dedication.
The person who associated a work with this deed has dedicated the work to the public domain by waiving all of their rights to the work worldwide under copyright law, including all related and neighboring rights, to the extent allowed by law. You can copy, modify, distribute and perform the work, even for commercial purposes, all without asking permission.

Category:CC-Zero#Arduino%20float-point%20operation%20speed.png
Category:Self-published work Category:Arduino (hardware) Category:Floating point
Category:Arduino (hardware) Category:CC-Zero Category:Floating point Category:Self-published work