*From*: krishnarupa at gmail.com (Igor Osch)*Subject*: [Glade-users] Glade and math.h*Date*: Fri May 27 10:57:05 2005

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++){ teta_rad=teta*(3.141592654)/180; ro=lrint(x*cos(teta_rad)+y*sin(teta_rad)); 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); //espaco_parametros[lrint((2*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 happening???? I'm really worried about that!!!! Thanks a lot! Krishna

**Follow-Ups**:**[Glade-users] Glade and math.h***From:*Andrej Prsa

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