Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

High Precision Math

Status
Not open for further replies.

solarwind

New Member
Hey all, I'm designing an application using PIC microcontrollers (PIC18 8 bit series or PIC24 16 bit series, still undecided) which requires the use of high precision math.

I need the precision of a 64 bit floating point type (in C) but none of the compilers support it except for Microchip C30 for the 16 bit PICs.

The only problem with that one is that the math functions (trig, log, etc...) only have a precision of a 32 bit float. Other options include using a math coprocessor but all the ones I've seen are only 32 bit floating point capable.

Another option is to use software math libraries such as MAPM. I got MAPM to compile and run to a certain extent, but since this is a library designed for real computers and not hardware-limited microcontrollers, I was only able to get it to work only to a certain number of decimal places before I ran out of memory.

The very very last option is to use the PIC32 microcontroller who's compiler supports 64 bit floating point data types will optimized, high precision math functions. However - I really don't want to have to use this chip. I'd much rather use the PIC18 series or the 16 bit series.

What should I do? Does anyone know of a 64 bit math coprocessor? Or another way to get this level of precision that I need? It seems to me that the most reasonable option right now (if there is no 64 bit math coprocessor available) is to use the 16 bit PIC with the C30 compiler and use the 64 bit floats and reimplement the math functions myself.

What do you guys think?
 
Last edited:
What should I do?

Compromise! LoL - You can't have it all. :D

Seriously though, do you really need to have that precision? Can you explain what you are doing and why that precision is needed? Double precision math is usually used for numerical modeling on full computers. Single precision math gives 23 bits of precision which is enough for demanding audio applications and complete overkill for system control and/or measurements. Do you realize that double precision floats give 52 bits or precision?:eek:

If single precision floats are not good enough, then 32 bit integer math can give an improvement (8 more bits!), even if it's more work to implement. Many people don't realize that 32 bit integers are more precise than single precision floats; even if the fixed point representation has some drawbacks.
 
Compromise! LoL - You can't have it all. :D

Seriously though, do you really need to have that precision? Can you explain what you are doing and why that precision is needed? Double precision math is usually used for numerical modeling on full computers. Single precision math gives 23 bits of precision which is enough for demanding audio applications and complete overkill for system control and/or measurements. Do you realize that double precision floats give 52 bits or precision?:eek:

If single precision floats are not good enough, then 32 bit integer math can give an improvement (8 more bits!), even if it's more work to implement. Many people don't realize that 32 bit integers are more precise than single precision floats; even if the fixed point representation has some drawbacks.

1. Yes, yes I can have it all. That's why I'm here.

2. I need the precision and that's that.

3. I don't care how many binary bits of precision it gives. I know how many decimal digits it gives and I need at least a 64 bit floating point.

4. I need floating point, not fixed point.
 
I think the best option right now is to use a 16 bit device and use the C30 compiler which supports 64 bit float and port a high precision math library.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top