Floating Point
Batang
Posts: 234
Is there an officially sanctioned (read gold standard) object that can (or will) do single precision FP with asc to float functions etc and consumes a single cog?
Comments
I don't know if it is GOLD but very good and single COG.
Look in OBX for F32
Thanks
Here is the Float32Full object that has been goldified and marked-up for use with Phil Pilgrim's AutoDocumenter. Phil did an AMAZING job of debugging, correcting, commenting, and marking up this object.
It will be put in the Gold Object repository here soon - I just need to write some demo programs that demonstrate all of the object's functionality.
Thanks,
Daniel
I've just used successfully 22 from the 34 methods of the object in a solar tracking algorithm to calculate some complicate trigonometric formulas and the result is impressive!!!
It contains powerful methods and I was able to manipulate with accuracy the various results in few line of SPIN code!!. (In the past I had to write a lot of code in simple Basic to do the same thing)
For my tests I used the new small miracle of Parallax that Ken has sent to me. The QuickStart!!!
Glad it worked easily and nicely for you!!!
As a bit of feedback, with respect to the code and comments, was the code easy to read and understand how to properly make the method calls? Where there any questions about what a method call might return? I'm still trying to dial in the Gold Standard. Here in the near future, whats on the Parallax Semiconductor website will be going through a pretty good overhaul.
Thanks,
Daniel
I'm pretty sure F32 does everything except the user defined functions and only uses one cog. I believe F32 is faster than Float32Full.
Parallax ought to goldify F32.
Duane
Daniel,
I think that the code is fairly well-written. (it would be impossible to say something different after Phil's Pilgrim code impovement ) The embedded comments in each method help the reader to understand the use of the method and avoid the mistakes.
Personaly as a new propeller programmer I had a small difficulty to fully understund the "Start" and "stop" methods. Finaly I did the following:
However I strongly believe for the necessity of the Gold Standard because everyone of us has his own personal programming style that some times it can confuse the others. "Gold Standard" I think is the key for the successful spread of spin programming.
Precision:
It could remind the user at the outset that the precision is 7+ decimal digits. Whenever a constant is listed in the many examples, it should reflect that precision. E.g. "y := fp.FSub(y, PI) ' Subtract 3.141593... from variable `y." Currently is 3.14159. (Might mention that PI is a compiler constant.)
or
half := fp.FDiv(x, 2.0) 'Divide `x by 2.000000 and assign the result to variable `half.
The trig functions and transcendentals are computed by table lookup, with interpolation, and precision suffers. To be honest, that should be mentioned. Is that an IEEE 754 compliant method? (exception, inverse trig functions use Taylor series. Has anyone checked the precision?)
Different floating point packages.
A couple more sentences about the floating point packages and where to find them. Will Floatmath and Float32 also be made gold? A link to Lonesock's F32 would be good in the interest of options.
The table might also include the hub code footprint of the different packages.
Code sections might be more strongly separated. For example is lost in the color coding. Those separators might be highlighted as a DAT or CON block. Is it anti-gold to put sections out of order? The compiler doesn't care.
This
' might follow the DAT, rather precede it, unless it is otherwise set off in color by CON
I concur and it also satisfies my original question about consuming only 1 cog.