Jefferson Mendoza schrieb am Mo, 18.8.2008:
> I mean sir, the formula is log(cos(15)
>
> how can i get the answer in negative and
> decmal form.. for example..
>
> #include<math.h>
> #include<stdio.h>
> int main(void)
> {
> int x;
> int y;
>
> x = cos(15);
> y = log10(x);
The function cos() takes as a parameter a value in *radians* (not in degrees).
Also, the argument of a log funtion is, by definition, a positive number, so be
careful what you plug into the log there. A sinusoidal function is likely to
cause trouble.
To convert from deg to rad, all you need to know is that 180 deg = PI rad.
> printf("%d",y);
> }
int main() should return a value.
> the error is log10:sing error
> overflow
That's because cos(15) < 0.
HTH
--
Ignacio
Buenos Aires, Argentina
__________________________________________________
Do You Yahoo!?
Sie sind Spam leid? Yahoo! Mail verfügt über einen herausragenden Schutz gegen
Massenmails.
http://mail.yahoo.com