View previous topic :: View next topic |
Author |
Message |
platon16382
Joined: 26 Oct 2005 Posts: 4
|
hi, i have some problems with math.h |
Posted: Wed Oct 26, 2005 3:43 pm |
|
|
hello , i was working with math.h header file in pcwh 3.207 compiler , when i use the wizard its works. but when i dont use the wizard and i include the library it dont work.
my code is :
#device PIC16F877
#include <defs_877.h>
#include <lcd_out.h>
#include <lcd_out.c>
#include <math.h>
void main(void)
{
float p;
while(1)
{
lcd_cursor_pos(0, 0);
printf(lcd_char, "multiplicacion 5*2.5");
lcd_cursor_pos(2, 0);
p = 5-2.5;
printf(lcd_char," p = %f", p);
}
}
I'm a new user of ccs, someone can help me
thanks for all |
|
![](templates/subSilver/images/spacer.gif) |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Wed Oct 26, 2005 3:53 pm |
|
|
Explain what you expect to see, and tell us what you actually see. |
|
![](templates/subSilver/images/spacer.gif) |
Guest
|
|
Posted: Wed Oct 26, 2005 6:09 pm |
|
|
maybe your problem is that you are subracting when you are trying to multiply?
a better way (expliclty express types):
Code: |
p = 5.0 * 2.5;
or
p = (double)5 * 2.5;
|
also you do not need math.h to do basic arithmetic in c. |
|
![](templates/subSilver/images/spacer.gif) |
|