[Glade-users] Glade and math.h

Hi there!

I'm having a really big trouble with math.h. I'm developing an image
recognition aplication. This image recognition aplication uses lots of
math.h functions in order to transform my image. I've got two
problems: the function pow(), returns the wrong result. In order to
verify that it was not my fault I took the function and compiled it on
a test program. Them the result pow() returned was correct. I
workarouded this by doing x=y*y instead of x=pow(y,2). Well but later
in my code I need some sin and cos calculation. These calculations are
made inside a for loop.

for (teta=0; teta<180; teta++){
      printf("x: %d, y: %d, diagonal2: %e, lrint: %d, teta: %d, cos
%e, xcos%e, xsin %e, sin %e, ro %e, teta_rad %e\n",x, y, diagonal2,
lrint((diagonal)+ro), teta, cos(teta_rad), sin(teta_rad),
x*cos(teta_rad), y*sin(teta_rad), ro, teta_rad);
      printf("%f %d\n", diagonal2+ro, teta);

Everything is being calculated right, but at some point the result of
sin(teta_rad) is nan! I can't understand agian whats is going on. I've
took this code, and compile it separate (without the glade's makefile)
and the calculation was correct! Does someone have any idea of whats

I'm really worried about that!!!!

Thanks a lot!


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]