In a floating point calculation war, which board would win?
void setup() {
Serial.begin(115200);
}
void loop() {
float x, y, z;
unsigned long t1, t2;
int n = Serial.parseInt();
// returns n = 0 after short timeout... but the compiler
// does not "know" the value of n, so we can use it for
// math without the compiler optimizing things away
t1 = micros();
x = n + 5.234f;
y = sinf(x);
z = x / 0.12f + y;
t2 = micros();
Serial.print("result = ");
Serial.println(z);
Serial.print("usec = ");
Serial.println(t2 - t1);
}
Teensy 3.1 34
Teensy-LC 111
Teensy 2.0 164
my statement is correct. Some ARM Cortex M4s have hardware floating point.None of the Teensies have floating point in hardware (although a few ARM Cortex M4s do). 3.0, 3.1, LC and Teensy 2.0/+2.0 (8 bit AVR) use software libraries for floating point.