MichaelMeissner
Senior Member+
Yes and no.It will have.. but float.
Even with FPU for doubles, that "f" functions are better, since all the vars are float - otherwise they are converted to double and back to float, i think (<- is this correct, Michael ?)
Your code looks good. What's the license of the code from the Freescale-Appnotes you used ?
The current Teensys do not have hardware FP, but it takes longer to emulate double precision than single precision. Even outside of the cost to emulate a single operation, the sqrt function probably needs to execute an additional round or two of Newton-Raphson to get the precision right.
Code imported from the AVR machines like most of the Arduino, sometimes uses doubles, but the compiler silently treats double like float.
However, it isn't always true that single precision is faster than double precision. There are machines that internally do things in double precision and do single precision by doing a rounding step after doing the calculation in double precision. Because C was developed on such a machine (PDP-11 and PDP-8 before the 11) is why C defaults to double precision for constants. The PowerPC that I work on also internally does things in double precision format and scalar 'single precision' values are stored in the register in the double format. Before SSE extension was added to the X86 architecture, floating point was always done in 80-bit floating point on a stack, which was loads of fun to run code that depended on exact IEEE semantics.
Last edited: