|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Very wierd compiling problem!
Hey,
I've tried to make a very simple statment: Code:
float test = 3.14;
printf("%f", test);
Thanks. |
|
#2
|
|||||
|
|||||
|
Re: Very wierd compiling problem!
Quote:
|
|
#3
|
|||||
|
|||||
|
Re: Very wierd compiling problem!
So far as I can tell, with the C18 compiler we use,
1) strings to be printf'd need a terminating \r and 2) %f is not supported. |
|
#4
|
||||
|
||||
|
Re: Very wierd compiling problem!
Quote:
|
|
#5
|
||||
|
||||
|
Re: Very wierd compiling problem!
Quote:
|
|
#6
|
||||
|
||||
|
Re: Very wierd compiling problem!
2 things:
To be technical, your error (as you've explained it) is run-time, not compile-time error. A run-time error is something odd that happens during the execution of the code that you didn't expect. It may be a crash or just may not print what you thought it would. The other "thing" is this: when do you need to print out floats? I dunno, maybe you do need them. Important values like motors are unsigned chars, however. Most of what you're working with is bits and chars. If you really need this to work, it's worth your time; otherwise, there are probably 400 better things to do. Best of luck with it... Paul dennis |
|
#7
|
|||
|
|||
|
Re: Very wierd compiling problem!
If you absolutely must print out a float,do this: print the integer part, then take the remaining decimal part, multiply by some power of ten (say, 1000) and print out this number after a decimal point.
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Need a realistic Statics Problem | sanddrag | Technical Discussion | 10 | 05-12-2005 15:07 |
| Programming Problem: Extremely Frustrating | chantilly_team | Programming | 19 | 12-02-2005 23:00 |
| Problem compiling edubot | Ben B | Programming | 3 | 14-01-2004 00:51 |
| The problem with scouting... | archiver | 2001 | 10 | 23-06-2002 23:49 |
| Major problem with chipphua motors | aka Scott White | Motors | 18 | 19-03-2002 19:44 |