These are the lengths of the data types in bytes:byte 1int 2long int 4double 4...Anyway, based on these results, looks like the Diecimila is about a 0.1 megaflop device, using 4-byte floats/doubles.
I'm too lazy to check for myself, but won't a float be 4 bytes and a double be 8 bytes? (Referring to: http://www.cppreference.com/data_types.html)
Was curious as to the speed of floating point operations on the 16MHz Arduino Diecimila. Could only find a few threads about that (e.g., http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1206534749), with no answer, so I ran some tests.
I must say I'm surprised it can do doubles so fast. Do you have data for division? With division algorithms, you'll need to test a wide range of denominators to get a good feel.
BTW, double is supposed to be 8-bytes: http://www.arduino.cc/en/Reference/DoubleI don't know why sizeof() would return 4.
I just tried it with several different denominators & always get a result in the range of 34 microseconds. So floating point division is about 3-4 times slower than multiplication (9 usec).Even so, that's about 30,000 divisions per second. This seems fast enough for (much) government work!
I would tend to believe what the compiler is reporting, but I just posted something on this in Bugs/Suggestions, so we will see.
Yep, on the AVR's, float and double are both 32 bits.
and for most Arduino apps floats are more than sufficient
Quoteand for most Arduino apps floats are more than sufficientSo far, I haven't hit a situation where I absolutely had to have a double in an embedded project, but why does that statement make me think "640k ought to be enough for anyone"?
So far, I haven't hit a situation where I absolutely had to have a double in an embedded project, but why does that statement make me think "640k ought to be enough for anyone"? QuoteAnd you say that in the forum about the highly capable Arduino that has just 1k
And you say that in the forum about the highly capable Arduino that has just 1k