wannaBinventor
Member
I asked a couple days ago about some floating point stuff with sorceforge. I got no responses, so I fell back on the easier to understand Microchip routines. Microchip includes a program to do conversions for you (I presume that's what it's for), but it won't open on my computer. Thus, I made a spreadsheet to help me out and I also did some testing.
It will take a Microchip format floating point hex number and covert it to decimal, and vice versa. It will also do the following math operations on the input, and display the answers in the floating point hex and in decimal so they can be compared to the output of a routine in a PIC program:
Addition
Subtraction
Multiplication
Division
Sine
Cosine
Tangent
Arc Sine
Arc Cosine
Arc Tangent
Square Root
Cube Root
Square
Cube
Log (Base 10)
Natural Log
I may make some other modifications to it later, but for not I think I've got all the bugs out of it.
Hopefully this will help some others get over the floating point fear. AN575 is fairly understandable, and I think the spreadsheet may help bring it full circle.
IMO, floating point gets too bad of a wrap. Sure, its slower, but who gives a crap? How many people are doing something so time sensitive that they need to give up a lot of accuracy for the sake of saving 25 millionths of a second on a division routine?
Only enter info where the text is red. The math operation is selected by the drop down box in that cell. Depending on your version, you may need to put a ' (single quote) before the value if the hex value that you enter is completely numeric.
EDIT: I did this mostly in Open Office, so it may require some formatting adjustments if used in Excel (IE: Column with, text size, etc).
It will take a Microchip format floating point hex number and covert it to decimal, and vice versa. It will also do the following math operations on the input, and display the answers in the floating point hex and in decimal so they can be compared to the output of a routine in a PIC program:
Addition
Subtraction
Multiplication
Division
Sine
Cosine
Tangent
Arc Sine
Arc Cosine
Arc Tangent
Square Root
Cube Root
Square
Cube
Log (Base 10)
Natural Log
I may make some other modifications to it later, but for not I think I've got all the bugs out of it.
Hopefully this will help some others get over the floating point fear. AN575 is fairly understandable, and I think the spreadsheet may help bring it full circle.
IMO, floating point gets too bad of a wrap. Sure, its slower, but who gives a crap? How many people are doing something so time sensitive that they need to give up a lot of accuracy for the sake of saving 25 millionths of a second on a division routine?
Only enter info where the text is red. The math operation is selected by the drop down box in that cell. Depending on your version, you may need to put a ' (single quote) before the value if the hex value that you enter is completely numeric.
EDIT: I did this mostly in Open Office, so it may require some formatting adjustments if used in Excel (IE: Column with, text size, etc).
Attachments
Last edited: