Floating Point Greater Than 32 bits, What are my Options?
Hello All,
I need at least 40 bit floating point multiply and divide. The calling application is small and speed isn't a big factor (10's of milliseconds per floating point multiply or divide should be OK). I've used the floating point objects from the object exchange but they're all limited to 32 bits. I've asked Imagecraft if their C-compiler for the propeller does more than 32 bit float - nope, and seemingly no plan for it.
Any suggestions before I decide whether to re-invent the wheel, or move to another processor? Ideally, I wish for arbitrary-precision floating point for the prop.
Thanks for any suggestions... David
I need at least 40 bit floating point multiply and divide. The calling application is small and speed isn't a big factor (10's of milliseconds per floating point multiply or divide should be OK). I've used the floating point objects from the object exchange but they're all limited to 32 bits. I've asked Imagecraft if their C-compiler for the propeller does more than 32 bit float - nope, and seemingly no plan for it.
Any suggestions before I decide whether to re-invent the wheel, or move to another processor? Ideally, I wish for arbitrary-precision floating point for the prop.
Thanks for any suggestions... David
Comments
If you only need add/sub mul and div for 32 or more significant digits... maybe you can implement some (it is not that difficult) double precision routines. I think it is really fun, and I planned to do it anyways so if you do not need it for yesterday... I can do it for you. Just let me know if any of this helps you.
Ale, I've studied the application a bit further and I think I can get away with 38 or 39 bits, so perhaps your BCD lib with 12 digits can handle this(?) Do you have your BCD arithmetic routines rolled up into an object? If so, where may I download it (it's not in ObEx)? If not, I take it the code on the Wiki is stable enough to scrape of the page?
The application is calculating optimal divider values used to program a Silicon Laboratories Si570 programmable clock generator with sub Hertz resolution.
Most would think a 32-bit heavy-lifter like the Propeller would be able to handle double-precision with ease, I did at-first. An acquaintance has successfully implemented an identical application with a little Freescale 8-bit HCS08 architecture micro-controller (MC9S08QG8) programmed in C. No problem with 64 bit precision. I was very disappointed with Imagecraft dismissing out-of-hand double precision in their C-compiler. This is one of the rare times when I wonder if the prop is the right part for the job.
Maybe I'll have a crack at arbitrary precision arithmetic. It should be pretty simple to bang out a brute force Euclidean algorithm for divide. Multiply seems even simpler.
Thanks, David
For double precision, I'm working now in the addition and subtraction, they are done, I'm testing comparing the results with my pc
Well, there are some libraries for the HC08, being a descendant of the 6800 those exists since the 70s
I finally saw the link at the bottom of the wiki page for the BCD math code, thanks. Ya, the prop is overkill for just driving the Si570 but in the end the prop will do more. Plus I would like to bring the Si570 to the prop as drivers for most every other mainstream processor seem to have been done already. (I suspect lack of precision above 32 bits with the prop is the reason.)
Arbitrary precision might be a better solution then fixed 64 bit, especially with divide. I'm no expert but at first glance arbitrary precision divide might even be easier to code. Plus, arbitrary precision would allow users to choose the precision they require, this may (or may-not) reduce the memory footprint when full 64 bit precision isn't needed (hmmm....). I look forward to seeing what you come up with. Thanks for your time and effort...
Regards, David