|
|
|
![]() |
|
|||||||
|
||||||||
|
|
Thread Tools | Rate Thread | Display Modes |
|
#3
|
|||||
|
|||||
|
Re: Cannot access "double" values
I can use
double f=9.9; without any trouble. This Microchip implementation of printf doesn't support the printing of floats, but you can easily print them on your own. Code:
#define ACCURACY 1000 //How many decimal places are important to you
void PrintFloat(float value)
{
long i, i2; // Don't need to be longs if you only need a few significant digits
/* Separate the whole number from the fraction and print each of them */
i = (long) value;
i2 = (long) ((value-i)*ACCURACY); // You can get fancy and round by adding .5
printf(" %d.%03d \r", (int)i, (int)i2); //e.g., "234.078"
}
Last edited by Mark McLeod : 05-02-2005 at 22:21. Reason: Loose use of the term "printf" caused confusion |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Acceleration Sensor Connected, but values are odd.... | Leav | Electrical | 7 | 04-02-2005 15:28 |
| trentonDrive.c: our joystick/wheel drive code | gnormhurst | Programming | 16 | 03-02-2005 14:40 |
| Good book to learn MS Access from? | Elgin Clock | Math and Science | 2 | 05-10-2004 20:20 |
| A testimony to my unique FIRST experience: | Ken Leung | General Forum | 22 | 14-04-2004 20:45 |
| Access Database help... | kacz100 | Scouting | 12 | 18-03-2004 19:18 |