I stick with integer arithmetic. In my particular case, I use a known=20 (standard) pressure, temperature, etc.) and record a half dozen readings=20 over the range to be used. Plug the readings into an Excel spreadsheet,=20 do a XY graph, and generate a formula. Generally a linear (y =3D mx +b) is= =20 accurate sufficient. When moving the formula to the CPU ("C" or ASM,=20 etc.) need to use a little algebra to move terms around and scale (maybe=20 multiply by 100 and then when display/print) adjust the number to=20 prevent over/under flow. In your case, could enter the freescale=20 equation into a spreadheet, and then genreate the formula. On 12/27/2011 6:03 AM, David wrote: > I am using one of the Freescale pressure sensors, the application note > for the I2C interface is below. > > http://www.freescale.com/files/sensors/doc/app_note/AN3785.pdf > > On page 15 it explains the coefficients used in the compensation > algorithm. They do also give sample code for the whole calculation, but > it is a bit of a mess. > > How can I convert these 16 bit coefficients to floating point types in > C? I know this will drag in the floating point library (I use HiTech) > but I am mostly interested in this for debugging, not long term use. > > David > =20 --=20 http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .