??? 07/26/10 12:24 Modified: 07/26/10 12:27 Read: times |
#177464 - fp seldom suitable for smaller microcontrollers Responding to: ???'s previous message |
Note that microcontrollers and floating point are not always a good mix.
Most microcontrollers don't have fp hw support, requiring everything to be emulated, consuming much code space and much CPU time. Some compilers/libraries don't have emulation. Some compilers/libraries only have single-precision fp. Where do you get your fp data from? If from a PC, then the PC should be able to change the data to fixed point or something that works better. If your own program is creating fp values, then your program could be rewritten to use fixed point or fixed point + decimal magnitude, in which case it is quite easy to print the numbers. Edit: Replacing the standard sprintf() because it doesn't supports floating point numbers is a quite expensive solution. If you do have a "magic" function that converts a floating point number to a text string, then this string can be printed together with other formatted data using an integer-only sprintf(). sprintf() doesn't do everything on its own - it will call a lot of helper functions inside the C RTL. |
Topic | Author | Date |
strnicmp and sprintf | 01/01/70 00:00 | |
All Compilers have sprintf | 01/01/70 00:00 | |
Why do you need your own sprintf()? | 01/01/70 00:00 | |
sprintf | 01/01/70 00:00 | |
Google is your friend | 01/01/70 00:00 | |
fp seldom suitable for smaller microcontrollers | 01/01/70 00:00 | |
What compiler?![]() | 01/01/70 00:00 |